Javascript doesn't ship with a fully functional official SDK, so we have to use third-party tools like lodashJS
, momentJS
for daily development. For learning purposes, we will implement those functions by ourselves.
Installation
yarn add @js-rocks/lodash-tiny
Usage
import * as _ from '@js-rocks/lodash-tiny';
_.isObject({})
- startWith, endWith, contains(includes), padStart, padEnd(fillZero)
- trim, trimStart, trimEnd, repeat, camelize, capitalize, dasherize, underscored
- contains, removeAt,remove,flatten,unique,compact,pluck,
- max, min, groupBy,sortBy,union,intersect,diff
- ES6 Class implementation
- new
- instanceOf
pass a date
- getDaysInMonth
- isLeapYear
- getFirstDateInQuarter
- getLastDateInQuarter
- getFirstDateInMonth
- getLastDateInMonth
- getDatePeriod
- eventBus (on, emit, off, once)
- currying
- compose(pipe)
- partial, partialRight
- is-xx-like function(isFunction, isArray)
- function 的 bind, call, apply
- deepClone
- debounce, throttle
- get
- arrayToTree
- JSON.parse, JSON.stringify