too

toolscript

🔧 It's particular tools about js

Showing:

Popularity

Downloads/wk

25

GitHub Stars

46

Maintenance

Last Commit

3yrs ago

Contributors

2

Package

Dependencies

3

License

ISC

Type Definitions

Tree-Shakeable

No?

Categories

Readme

toolscript

A mini tools of JavaScript

NPM version build status Test coverage npm download

Install

NPM

yarn add toolscript --dev

or npm

npm install toolscript --save-dev

Usage


import * as tool from 'toolscript'

tool.echo.red('echo red')
// echo red string
tool.detectIE(9)
//if current browser is IE 9 return true else  return false
tool.copyText('content')
//copy the `content` to clipboard
tool.throttle(Func, 50, 100)
//The call that is triggered continuously within a 50ms interval, the latter call will handle the pending processing of the previous call, but at least once every 100ms
tool.timeDifference('2017-01-01 12:00:00', '2018-01-01 13:00:00')
//Calculate the difference between two times, return '365天1小时0分钟0秒'
tool.arrayRemoveEle(['1', '2', '3'], '1')
//Remove the element that belong to the array
tool.isPlainObject(obj)
//Judge the value is a Object.
tool.rgbToHex(255, 255, 255)
//rgb switch to the Hexadecimal.
too.countMaxRepetition('abskgoxugnska14432q1124')
//Count the characters that repeat the most times in a string.
too.unitNormalization(1.259, 2) //1.26
//Format the number that reserve the decimal for the specified number of digits.


OR

import { echo, detectIE, ...other } from 'toolscript'

echo.red('echo red')
// echo red string
detectIE(9)
//if current browser is IE 9 return true else  return false
copyText('content')
//copy the `content` to clipboard
...

Tool List

Tools

name function parameters description
echo

echo.black(content)

echo.red(content)

echo.green(content)

echo.yellow(content)

echo.blue(content)

echo.carmine(content)

echo.cyan(content)

any data echo colorful information in console
detectIE detectIE(version)

`int`

version of IE
judge IE version
copyText copy(text)

string

the content
copy the content to clipboard, it must be called as a direct result of user action.
throttle throttle(fn, delay, mustRunDelay)

throttle function`function`

the time that successive calls do not trigger, it's in milliseconds `number`

the time that at least once, it's in milliseconds `number`

function throttle
timeDifference timeDifference(startTime, endTime)

startTimen`String`

endTime`String`

Calculate the difference between two times
arrayRemoveEle arrayRemoveEle(array, removeValue)

array`Array`

removeValue`Element type`

Remove the element that belong to the array
isPlainObject isPlainObject(obj)

any data

Judge the value is a Object
rgbToHex rgbToHex(R, G, B)

the rgb value`number`

rgb switch to the Hexadecimal
countMaxRepetition countMaxRepetition('abskgoxugnska14432q1124')

`string`

Count the characters that repeat the most times in a string.
unitNormalization unitNormalization(1.253, 2)

`number`

`int`

Format the number that reserve the decimal for the specified number of digits.
getScriptPath getScriptPath() Get current script url.

Release

npm publish

License

The MIT License (MIT). Please see License File for more information.

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial