Skip to content

Latest commit

 

History

History
169 lines (133 loc) · 2.17 KB

.readme.md

File metadata and controls

169 lines (133 loc) · 2.17 KB

Usage

var _ = require('min-util')

Inspired by lodash and underscore

Very Small Size

min-util (~4kb gzipped)

Lodash is ~24kb gzipped

Try in Browser

Try in console, exports as _

Check Unit Tests

Api

Array like

  • _.each -> forEach
  • _.map
  • _.filter
  • _.some
  • _.every
  • _.reduce
  • _.reject
  • _.invoke
  • _.findIndex
  • _.find
  • _.slice
  • _.indexOf
  • _.includes
  • _.uniq
  • _.uniqBy
  • _.flatten
  • _.union
  • _.sample
  • _.sampleSize
  • _.shuffle
  • _.difference
  • _.without
  • _.rest
  • _.compact
  • _.size
  • _.first
  • _.last
  • _.groupBy
  • _.partition
  • _.range
  • _.pullAt
  • _.remove
  • _.fill
  • _.nth

Object

  • _.keys
  • _.forIn
  • _.extend
  • _.defaults
  • _.values
  • _.pick
  • _.functions
  • _.only
  • _.mapKeys
  • _.mapObject
  • _.create
  • _.has
  • _.get
  • _.set
  • _.isMatch
  • _.toPlainObject
  • _.size
  • _.invert

Function

  • _.bind
  • _.once
  • _.memoize
  • _.throttle
  • _.debounce
  • _.delay
  • _.after
  • _.before
  • _.curry
  • _.wrap
  • _.negate

String

  • _.trim
  • _.split
  • _.indexOf
  • _.slice
  • _.toLower
  • _.toUpper
  • _.toString
  • _.camelCase
  • _.capitalize
  • _.upperFirst
  • _.lowerFirst
  • _.includes
  • _.size
  • _.startsWith
  • _.endsWith
  • _.repeat
  • _.padLeft
  • _.padRight
  • _.template not support templateSettings

Utility

  • _.noop
  • _.now
  • _.chain
  • _.value
  • _.constant
  • _.identity
  • _.mixin
  • _.inherits
  • _.random
  • _.uniqueId

Lang

  • _.isString
  • _.isArray
  • _.isArrayLike
  • _.isBoolean
  • _.isElement
  • _.isEmpty
  • _.isFunction
  • _.isInteger
  • _.isNaN
  • _.isNumber
  • _.isObject
  • _.isPlainObject
  • _.isRegExp
  • _.isUndefined
  • _.toArray

More Check

_.is equals min-is

assert(_.is.arraylike({0: 'foo', length: 1}))

Platform Support

  • all browsers even IE6+
  • node.js