toolscript
v0.1.22
Published
tool-js-package js
Downloads
51
Readme
toolscript
A mini tools of JavaScript
Install
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
- echo
- detectIE
- copyText
- throttle
- timeDifference
- arrayRemoveEle
- isPlainObject
- rgbToHex
- countMaxRepetition
- unitNormalization
- getScriptPath
Tools
Release
npm publish
License
The MIT License (MIT). Please see License File for more information.