npm i utils-lite -S
import { debounce } from 'utils-lite'
// commonjs package is 'utils-lite/lib/index.cjs.js'
debounce(() => {
// code...
}, 1000)
<script src="https://unpkg.com/utils-lite/lib/index.umd.min.js"></script>
<script>
UtilsLite.debounce(function () {
// code ...
}, 1000)
</script>
Now css utils package has three file type: less, sass, stylus as index.less
/
index.sass
/index.styl
, you can choose one and import to you project, for example
@import 'project-path/node_modules/utils-lite/index.less';
.test {
.text-ellipsis
}
@import 'project-path/node_modules/utils-lite/index.sass';
.test {
@include text-ellipsis;
}
@import 'project-path/node_modules/utils-lite/index.styl';
.test
text-ellipsis();
debounce(<fn>, <delay>)
throttle(<fn>, <wait>, [delay])
get(<target>, <path>, [default])
path format: 'a.b.c'
set(<target>, <path>, <value>)
clone(<target>)
cloneDeep(<target>)
getType(<target>)
getTypeof(<target>)
isObject(<target>)
isArray(<target>)
isFunction(<target>)
isString(<target>)
isBoolean(<target>)
isEmptyObj(<target>)
isNumber(<target>)
getStore(<key>)
setStore(<key>, <value>)
kebabToCamel(<key>)
camelToKebab(<key>)
unique(<array>)
getLinearValue(<x1>, <y1>, <x2>, <y2>, [x3])
getFnAndObjValue(<function|object>, <key>)
arrDelItem(<array>, <diffItem>)
arrDelArrItem(<array>, <diffArrayItem>)
toArray(<arrayLike>)
getArrayMin(<array>)
extend(<sourceObj>, [otherObj])
hasOwn(<target>)
isEqual(<alice>, <bob>)
chunk(<array>, <number>)
.target {
.text-ellipsis
}
.target {
.text-loading([time])
}
MIT