Appearance
Mini Lodash-ES 源码解析: 精选核心工具函数的实现原理
本书将带你深入 Lodash 源码,掌握 JavaScript 工具函数的设计思想与实现技巧。
第一部分:基础架构 (Foundations)
第二部分:类型判断方法 (Lang Methods)
- 类型判断方法概览
- 基础类型判断:isArray、isObject、isFunction
- 空值与边界判断:isNil、isEmpty、isEqual
- 数值类型判断:isNumber、isNaN、isFinite
- 深度克隆:clone 与 cloneDeep
- 类型转换:toArray、toString、toNumber
第三部分:数组方法 (Array Methods)
- 数组方法概览与设计模式
- 数组分块与展平:chunk、flatten、flattenDeep
- 数组过滤:compact、uniq、uniqBy
- 数组查找:find、findIndex、indexOf
- 数组集合运算:difference、intersection、union
- 数组取值:head、last、nth、take、drop
- 数组变换:zip、unzip、fromPairs
- 数组移除:pull、pullAll、remove、without
第四部分:集合方法 (Collection Methods)
- 集合方法概览与迭代器模式
- 遍历方法:forEach、forEachRight
- 映射方法:map、flatMap
- 过滤方法:filter、reject、partition
- 查找方法:find、findLast、includes
- 归约方法:reduce、reduceRight
- 分组方法:groupBy、keyBy、countBy
- 排序方法:sortBy、orderBy
- 判断方法:every、some
- 采样与随机:sample、sampleSize、shuffle
第五部分:对象方法 (Object Methods)
- 对象方法概览与属性遍历
- 属性访问:get、set、has、unset
- 对象合并:assign、merge、defaults
- 对象筛选:pick、pickBy、omit、omitBy
- 对象遍历:keys、values、entries、forIn
- 对象变换:mapKeys、mapValues、invert
第六部分:函数方法 (Function Methods)
- 函数方法概览与高阶函数
- 节流防抖:debounce、throttle
- 函数缓存:memoize
- 调用控制:once、before、after
- 柯里化:curry、curryRight
- 参数处理:partial、partialRight、ary
- 函数包装:negate、flip、wrap
- 延迟执行:defer、delay
第七部分:字符串方法 (String Methods)
- 字符串方法概览
- 大小写转换:camelCase、kebabCase、snakeCase
- 字符串处理:trim、pad、repeat、truncate
- 字符串检测:startsWith、endsWith、includes
- 模板引擎:template
第八部分:数学与数值方法 (Math & Number Methods)
- 数学方法:add、subtract、multiply、divide
- 统计方法:max、min、mean、sum
- 数值处理:clamp、inRange、random
- 精度控制:ceil、floor、round
第九部分:工具方法 (Util Methods)
- 工具方法概览
- 迭代器工厂:iteratee、matches、property
- 函数组合:flow、flowRight
- 生成器:range、times、uniqueId
- 常量函数:identity、constant、noop
- 条件执行:cond、conforms、defaultTo