rush
rush copied to clipboard
Port some of the LoDash functions
LoDash/Underscore is a widely used Javascript library with some helper functions. Many of them could be translated directly to rush.
- [ ]
chunk(for arrays and strings) - [x]
compact(equivalent offilter(bool & (!))if that was a valid syntax) - [ ]
concat(accepting variable number of array arguments) - [ ]
deburr(as Unicode NFD conversion) - [ ]
flip - [ ]
flatten(likeconcatbut accepts array of arrays) - [ ]
head(both arrays and strings) - [x]
identity(asid) - [ ]
initial(asinit) - [x]
invert(as an overload forrevfor object arguments) - [x]
keys(for objects, arrays, and strings (return array of indices for the latter two)) - [ ]
last(both arrays and strings) - [ ]
now(possibly astime; may make sense to create adatetime/instanttype) - [x]
omit(for objects, arrays, and strings; keys as array) - [ ]
pad(for both strings and arrays) - [ ]
padEnd(aspadright, for both strings and arrays) - [ ]
padStart(aspadleft, for both strings and arrays) - [x]
pick(for objects, arrays, and strings; keys as array) - [x]
reject(opposite offilter) - [x]
sample(Size)(assample, for arrays, strings, and objects (return random value for objects); sample size as first arg) - [x]
shuffle(for arrays and strings) - [ ]
tail(both arrays and strings) - [ ]
uniq(both arrays and objects (objects uniq'd by values)) - [ ]
uniqBy(both arrays and objects (objects uniq'd by values)) - [x]
values - [x]
words - [ ]
zipObject(asobject; it should accept either two same-sized arrays (keys and values), or a single array (alternating keys and values))