Skip to content

Instantly share code, notes, and snippets.

@aleclarson
Created September 23, 2024 21:58
Show Gist options
  • Save aleclarson/a7198339c0a68991cb6c94cf9d60fa29 to your computer and use it in GitHub Desktop.
Save aleclarson/a7198339c0a68991cb6c94cf9d60fa29 to your computer and use it in GitHub Desktop.

Here's the Lodash parity data I've compiled so far.

The status "100" means it's an exact match with the Lodash implementation.

Implemented

name notes status rename
capitalize 100
uniqBy • Renamed to unique. yes unique
groupBy • Renamed to group.
• Property shorthand not supported (but coming soon).
yes group
pickBy • Renamed to pick. yes pick
castArray • If the given value is an array, the array is shallow copied.
• We also have castArrayIfExists which is similar but null/undefined are returned as is.
yes
pick • Exactly one array of keys must be passed. No more, no less.
• You may pass a selector function instead (pickBy functionality).
yes
zip 100
set • “Key arrays” are not supported. Only string-based JSON paths. yes
clone • Unsure about the differences as of now. Help wanted. yes
flow • Renamed to chain.
• Full type safety with TypeScript (to a max of 10 functions).
• Instead of taking an array of functions, each function is an argument to chain.
yes chain
isPlainObject • Returns false for built-in namespaces like Math, JSON, etc.
• Returns false for the arguments object of a function call.
yes
get • “Key arrays” are not supported. Only string-based JSON paths. yes
isFunction 100
isString • Boxed strings (e.g. new String("foo")) are not supported. yes
debounce • No leading or trailing option. Only a trailing debounce is supported.
• No maxWait option. The function may be debounced indefinitely if called frequently enough.
• The pending method is renamed to isPending.
yes
isBoolean • Boxed values (e.g. new Boolean(true)) are not supported. yes
isNumber • Boxed numbers (e.g. new Number(0)) are not supported. yes
throttle • No leading or trailing option. Only a trailing behavior is supported.
• The pending method is renamed to isThrottled.
• No cancel or flush method.
yes
isObject • Returns false for RegExp, Date, and other built-in, complex objects.
• Returns false for arrays.
• Returns false for functions.
yes
isEmpty • There are likely quite a bit of differences here. Help wanted on this! yes
snakeCase • Renamed to snake. yes snake
startCase • Renamed to title. yes title
once • Support for clearing the cached result to allow running the function again. See the once.reset function. yes
kebabCase • Renamed to dash. yes dash
memoize • Built-in support for TTL (time to live) invalidation.- By default, the cache key is computed with JSON.stringify of the arguments array. Lodash only uses the first argument if a custom key resolver is not provided.
• Lodash uses a Map to support any type of cache key, while only JSON-compatible arguments are supported in Radashi.
• No cache property, so the cache is not directly accessible.
yes memo
uniq • Renamed to unique. yes unique
camelCase • Renamed to camel. yes camel
cloneDeep • Ours accepts a custom strategy (similar to cloneDeepWith). yes
flatten • Renamed to flat. yes flat
difference • Renamed to diff.
• Requires two arrays exactly. No more, no less.
• Supports an “identity function” that enables comparison through a property or other computation.
yes diff

Not implemented

name notes status rename
reduce • “Collection” polymorphism is unaligned with Radashi's vision. no
filter • “Collection” polymorphism is unaligned with Radashi's vision. no
some • “Collection” polymorphism is unaligned with Radashi's vision. no
values • Use Object.values instead. no
map • “Collection” polymorphism is unaligned with Radashi's vision. no
padEnd • Use String.prototype.padEnd instead. no
forEach • “Collection” polymorphism is unaligned with Radashi's vision. no
flattenDeep • Use Array.prototype.flat instead. no
keys • Use Object.keys instead.
• Radashi has its own keys function that is unrelated to Lodash keys.
no

Unknown

name notes status rename
defaults
merge • Radashi has a merge function, but it's for merging two arrays based on a key function.
truncate
union
isArguments
mergeWith
escapeRegExp
escape
isMatch
isUndefined
isNil
has
deburr
defaultsDeep
unescape
toPath
reject
transform
lowerCase
padStart
isTypedArray
chunk
pad
without
toArray
maxBy
xorBy
flatMap
startsWith
invokeMap
isEqualWith
every
uniqueId
uniqWith
tail
forOwn
intersection
compact
orderBy
last
pullAll
repeat
keysIn
create
range
indexOf
zipObject
lowerFirst
unset
keyBy
eq
trim
shuffle
trimStart
unionWith
isError
cond
toNumber
size
trimEnd
clamp
isObjectLike
at
differenceWith
cloneDeepWith
head
hasIn
isRegExp
sample
words
isDate
toPlainObject
endsWith
round
unionBy
xor
findLast
sortedLastIndex
invert
partition
setWith
random
result
findKey
defer
times
initial
invoke
pull
upperCase
isLength
isNull
inRange
sampleSize
remove
toString
parseInt
flowRight
differenceBy
property

Not all Lodash functions are included. These were chosen based on NPM downloads of > 10,000.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment