pocket-lodash icon indicating copy to clipboard operation
pocket-lodash copied to clipboard

读lodash源码,lodash source code analyze

pocket-lodash

能做事的做事,能发声的发声。有一分热,发一分光,就令萤火一般,也可以在黑暗里发一点光,不必等候炬火。

​ ——鲁迅

很喜欢鲁迅的这段话,在很多社区也会引用作为签名。鲁迅这段话有反抗的意味,用于单纯的技术分享似乎不太合适,可是管它呢。

前一段时间,从 Zepto 开始,初尝了阅读源码,以前觉得很难,现在有点上了瘾,这次阅读的是 lodash ,平时也会用到这个库,希望可以借此对它有更深入的了解。

这系列的每篇文章应该不会很长,依 lodash 的组织,每个文件都会有一篇对应的文章,因此命名为 pocket-lodash

源码版本

lodash master 分支

GitBook

pocket-lodash

目录

  • internal

    • Hash
    • assocIndexOf
    • ListCache
    • MapCache
    • SetCache
    • baseFindIndex
    • baseIsNaN
    • strictIndexOf
    • baseIndexOf
    • arrayIncludes
    • arrayIncludesWith
    • cacheHas
    • baseDifference
    • baseGetTag
    • getTag
    • isFlattenable
    • baseFlatten
    • baseWhile
    • baseIntersection
    • castArrayLikeObject
    • strictLastIndexOf
    • isIndex
    • baseIndexOfWith
    • copyArray
    • basePullAll
    • isKey
    • memoizeCapped
    • stringToPath
    • castPath
    • toKey
    • baseGet
    • baseAt
    • parent
    • baseUnset
    • basePullAt
    • compareAscending
    • baseSortedIndexBy
    • baseSortedIndex
    • baseSortedUniq
    • setToArray
    • createSet
    • baseUniq
    • baseProperty
    • baseXor
    • baseAssignValue
    • assignValue
    • baseZipObject
    • baseSet
    • arrayReduce
    • baseFor
    • freeGlobal
    • root
    • nodeTypes
    • arrayLikeKeys
    • baseForOwn
    • baseEach
    • baseReduce
    • arrayEach
    • arrayEachRight
    • baseForRight
    • baseForOwnRight
    • baseEachRight
    • baseSortBy
    • compareMultiple
    • baseOrderBy
    • arrayReduceRight
    • asciiSize
    • hasUnicode
    • unicodeSize
    • stringSize
    • Stack
    • cloneBuffer
    • copyObject
    • copyArrayBuffer
    • cloneDataView
    • cloneTypedArray
    • cloneRegExp
    • cloneSymbol
    • getSymbols
    • copySymbols
    • getSymbolsIn
    • copySymbolsIn
    • getAllKeys
    • getAllKeysIn
    • isPrototype
    • initCloneObject
    • baseClone
    • baseConformsTo
    • equalArrays
    • mapToArray
    • equalByTag
    • equalObjects
    • baseIsEqualDeep
    • baseIsEqual
    • isStrictComparable
    • getMatchData
    • baseIsMatch
    • iteratorToArray
    • asciiToArray
    • unicodeToArray
    • stringToArray
    • baseValues
    • baseToNumber
    • baseToString
    • createMathOperation
    • createRound
    • baseSum
    • baseInRange
    • assignMergeValue
    • baseMergeDeep
    • baseMerge
    • createAssigner
    • baseFindKey
    • basePickBy
    • basePick
    • baseUpdate
    • castSlice
    • createCaseFirst
    • unicodeWords
    • basePropertyOf
    • deburrLetter
    • createPadding
    • charsEndIndex
    • charsStartIndex
    • baseConforms
    • matchesStrictComparable
    • baseMatches
    • baseMatchesProperty
    • basePropertyDeep
    • baseRange
    • createRange
  • slice

  • chunk

  • compact

  • eq

  • map

  • isObjectLike

  • isArguments

  • isLength

  • isArrayLike

  • isArrayLikeObject

  • difference

  • last

  • differenceBy

  • differenceWith

  • drop

  • dropRight

  • dropRightWhile

  • dropWhile

  • findLastIndex

  • head

  • flatten

  • flattenDeep

  • flattenDepth

  • fromPairs

  • indexOf

  • initial

  • intersection

  • intersectionBy

  • intersectionWith

  • isObject

  • isSymbol

  • toNumber

  • toFinite

  • toInteger

  • lastIndexOf

  • nth

  • pullAll

  • pull

  • pullAllBy

  • pullAllWith

  • memoize

  • get

  • pullAt

  • remove

  • sortedIndex

  • sortedIndexBy

  • sortedIndexOf

  • sortedLastIndex

  • sortedLastIndexBy

  • sortedLastIndexOf

  • sortedUniq

  • sortedUniqBy

  • tail

  • take

  • takeRight

  • takeRightWhile

  • takeWhile

  • union

  • unionBy

  • unionWith

  • uniq

  • uniqBy

  • uniqWith

  • filter

  • zip

  • unzipWith

  • without

  • xor

  • xorBy

  • xorWith

  • zip

  • zipObject

  • zipObjectDeep

  • zipWith

  • isBuffer

  • isTypedArray

  • keys

  • reduce

  • countBy

  • forEach

  • forEachRight

  • every

  • findLast

  • flatMap

  • flatMapDeep

  • flatMapDepth

  • groupBy

  • invoke

  • invokeMap

  • keyBy

  • orderBy

  • partition

  • reduceRight

  • filterObject

  • negate

  • reject

  • sample

  • sampleSize

  • shuffle

  • isString

  • size

  • after

  • before

  • debounce

  • throttle

  • defer

  • delay

  • flip

  • once

  • overArgs

  • castArray

  • keysIn

  • clone

  • cloneDeep

  • cloneDeepWith

  • cloneWith

  • conformsTo

  • gt

  • gte

  • isArrayBuffer

  • isBoolean

  • isDate

  • isPlainObject

  • isElement

  • isEmpty

  • some

  • eqDeep

  • isEqualWith

  • isError

  • isFunction

  • isMap

  • isMatch

  • isMatchWith

  • isNative

  • isNil

  • isNull

  • isNumber

  • isRegExp

  • isSet

  • isUndefined

  • isWeakMap

  • isWeakSet

  • lt

  • lte

  • values

  • toArray

  • toLength

  • toPlainObject

  • toSafeInteger

  • toString

  • add

  • ceil

  • divide
  • floor
  • maxBy
  • meanBy
  • mean
  • minBy
  • multiply
  • round
  • subtract
  • sum
  • sumBy
  • clamp
  • inRange
  • random
  • at
  • create
  • defaults
  • mergeWith
  • defaultsDeep
  • fromEntries
  • findKey
  • findLastKey
  • functions
  • has
  • hasIn
  • invert
  • invertBy
  • mapKey
  • mapValue
  • merge
  • pick
  • pickBy
  • result
  • set
  • setWith
  • transform
  • unset
  • update
  • updateWith
  • upperFirst
  • words
  • camelCase
  • capitalize
  • deburr
  • endsWith
  • escape
  • escapeRegExp
  • kebabCase
  • lowerCase
  • lowerFirst
  • repeat
  • pad
  • padEnd
  • padStart
  • parseInt
  • replace
  • snakeCase
  • split
  • startCase
  • startsWith
  • trim
  • trimEnd
  • trimStrat
  • truncate
  • unescape
  • upperCase
  • attempt
  • cond
  • conforms
  • defaultTo
  • flow
  • flowRight
  • matches
  • matchesProperty
  • method
  • methodOf
  • nthArg
  • over
  • overEvery
  • overSome
  • property
  • propertyOf
  • range
  • rangeRight
  • times
  • toPath
  • uniqueId
  • someValues
  • hasPath
  • hasPathIn

License

署名-非商业性使用-禁止演绎 4.0 国际 (CC BY-NC-ND 4.0)

所有文章都会同步发送到微信公众号上,欢迎关注,欢迎提意见: