Skip to content

Latest commit

 

History

History
69 lines (46 loc) · 1.26 KB

README.md

File metadata and controls

69 lines (46 loc) · 1.26 KB

@js-rocks/lodash-tiny

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.

Quick start

Installation

yarn add @js-rocks/lodash-tiny

Usage

import * as _ from '@js-rocks/lodash-tiny';

_.isObject({})

APIs

string

  • startWith, endWith, contains(includes), padStart, padEnd(fillZero)
  • trim, trimStart, trimEnd, repeat, camelize, capitalize, dasherize, underscored

array

  • contains, removeAt,remove,flatten,unique,compact,pluck,
  • max, min, groupBy,sortBy,union,intersect,diff

inheritances

  • ES6 Class implementation
  • new
  • instanceOf

date

pass a date

  • getDaysInMonth
  • isLeapYear
  • getFirstDateInQuarter
  • getLastDateInQuarter
  • getFirstDateInMonth
  • getLastDateInMonth
  • getDatePeriod

oop

  • eventBus (on, emit, off, once)

fp tools

  • currying
  • compose(pipe)
  • partial, partialRight

others

  • is-xx-like function(isFunction, isArray)
  • function 的 bind, call, apply
  • deepClone
  • debounce, throttle
  • get
  • arrayToTree
  • JSON.parse, JSON.stringify