“Util” Methods
_.iteratee([func=_.identity])
创建一个函数,通过创建函数的参数调用 func
函数。 如果 func
是一个属性名,传入包含这个属性名的对象,回调返回对应属性名的值。 如果 func
是一个对象,传入的元素有相同的对象属性,回调返回 true
。 其他情况返回 false
。
4.0.0
[func=_.identity]
(*): 转换成 callback 的值。(Function): 返回回调函数 callback。
var users = [ { 'user': 'barney', 'age': 36, 'active': true }, { 'user': 'fred', 'age': 40, 'active': false }]; // The `_.matches` iteratee shorthand._.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));// => [{ 'user': 'barney', 'age': 36, 'active': true }] // The `_.matchesProperty` iteratee shorthand._.filter(users, _.iteratee(['user', 'fred']));// => [{ 'user': 'fred', 'age': 40 }] // The `_.property` iteratee shorthand._.map(users, _.iteratee('user'));// => ['barney', 'fred'] // Create custom iteratee shorthands._.iteratee = _.wrap(_.iteratee, function(iteratee, func) { return !_.isRegExp(func) ? iteratee(func) : function(string) { return func.test(string); };}); _.filter(['abc', 'def'], /ef/);// => ['def']
数组 Array
_.chunk
_.compact
_.concat
_.difference
_.differenceBy
_.differenceWith
_.drop
_.dropRight
_.dropRightWhile
_.dropWhile
_.fill
_.findIndex
_.findLastIndex
_.first
-> head
_.flatten
_.flattenDeep
_.flattenDepth
_.fromPairs
_.head
_.indexOf
_.initial
_.intersection
_.intersectionBy
_.intersectionWith
_.join
_.last
_.lastIndexOf
_.nth
_.pull
_.pullAll
_.pullAllBy
_.pullAllWith
_.pullAt
_.remove
_.reverse
_.slice
_.sortedIndex
_.sortedIndexBy
_.sortedIndexOf
_.sortedLastIndex
_.sortedLastIndexBy
_.sortedLastIndexOf
_.sortedUniq
_.sortedUniqBy
_.tail
_.take
_.takeRight
_.takeRightWhile
_.takeWhile
_.union
_.unionBy
_.unionWith
_.uniq
_.uniqBy
_.uniqWith
_.unzip
_.unzipWith
_.without
_.xor
_.xorBy
_.xorWith
_.zip
_.zipObject
_.zipObjectDeep
_.zipWith
集合 Collection
_.countBy
_.each
-> forEach
_.eachRight
-> forEachRight
_.every
_.filter
_.find
_.findLast
_.flatMap
_.flatMapDeep
_.flatMapDepth
_.forEach
_.forEachRight
_.groupBy
_.includes
_.invokeMap
_.keyBy
_.map
_.orderBy
_.partition
_.reduce
_.reduceRight
_.reject
_.sample
_.sampleSize
_.shuffle
_.size
_.some
_.sortBy
日期 Date
函数 Function
Lang
_.castArray
_.clone
_.cloneDeep
_.cloneDeepWith
_.cloneWith
_.conformsTo
_.eq
_.gt
_.gte
_.isArguments
_.isArray
_.isArrayBuffer
_.isArrayLike
_.isArrayLikeObject
_.isBoolean
_.isBuffer
_.isDate
_.isElement
_.isEmpty
_.isEqual
_.isEqualWith
_.isError
_.isFinite
_.isFunction
_.isInteger
_.isLength
_.isMap
_.isMatch
_.isMatchWith
_.isNaN
_.isNative
_.isNil
_.isNull
_.isNumber
_.isObject
_.isObjectLike
_.isPlainObject
_.isRegExp
_.isSafeInteger
_.isSet
_.isString
_.isSymbol
_.isTypedArray
_.isUndefined
_.isWeakMap
_.isWeakSet
_.lt
_.lte
_.toArray
_.toFinite
_.toInteger
_.toLength
_.toNumber
_.toPlainObject
_.toSafeInteger
_.toString
数学 Math
对象 Object
_.assign
_.assignIn
_.assignInWith
_.assignWith
_.at
_.create
_.defaults
_.defaultsDeep
_.entries
-> toPairs
_.entriesIn
-> toPairsIn
_.extend
-> assignIn
_.extendWith
-> assignInWith
_.findKey
_.findLastKey
_.forIn
_.forInRight
_.forOwn
_.forOwnRight
_.functions
_.functionsIn
_.get
_.has
_.hasIn
_.invert
_.invertBy
_.invoke
_.keys
_.keysIn
_.mapKeys
_.mapValues
_.merge
_.mergeWith
_.omit
_.omitBy
_.pick
_.pickBy
_.result
_.set
_.setWith
_.toPairs
_.toPairsIn
_.transform
_.unset
_.update
_.updateWith
_.values
_.valuesIn
Seq
字符串 String
_.camelCase
_.capitalize
_.deburr
_.endsWith
_.escape
_.escapeRegExp
_.kebabCase
_.lowerCase
_.lowerFirst
_.pad
_.padEnd
_.padStart
_.parseInt
_.repeat
_.replace
_.snakeCase
_.split
_.startCase
_.startsWith
_.template
_.toLower
_.toUpper
_.trim
_.trimEnd
_.trimStart
_.truncate
_.unescape
_.upperCase
_.upperFirst
_.words
实用函数 Util
_.attempt
_.bindAll
_.cond
_.conforms
_.constant
_.defaultTo
_.flow
_.flowRight
_.identity
_.iteratee
_.matches
_.matchesProperty
_.method
_.methodOf
_.mixin
_.noConflict
_.noop
_.nthArg
_.over
_.overEvery
_.overSome
_.property
_.propertyOf
_.range
_.rangeRight
_.runInContext
_.stubArray
_.stubFalse
_.stubObject
_.stubString
_.stubTrue
_.times
_.toPath
_.uniqueId
Properties
Methods