Coming from Just
Map angus-c/just helpers to @vinicunca/perkakas, with notes where the APIs differ.
Each heading is a Just function. The Perkakas equivalent is checked against @vinicunca/perkakas v1.17.1. Names that Remeda documents but Perkakas does not ship are called out. In-page links such as #reverse jump to that Just section.
extend
Just extend → merge.
- Just's
extendperforms an in-place merge which mutates the first argument. Perkakas functions never mutate the arguments. Because of this extra care is needed when migrating. - If you have the
deepflag enabled use Perkakas'smergeDeepinstead. Arrays are not merged deeply in Perkakas, unlikeextendwhich clones arrays. - There is no equivalent function for merging of arrays. Extending arrays is
only relevant for sparse arrays
which are uncommon. For regular arrays
extendis similar tosplice. - If you are merging more than two objects, use
mergeAllwhich takes an array of objects to merge. Notice that this merge is shallow; there is no equivalent function in Perkakas which would perform a deep merge of multiple objects.
New object
// Just
const result = extend({}, a, b);
// Perkakas
const result = merge(a, b);
Replace
// Just
const DATA = { ... };
extend(DATA, b);
// Perkakas
let DATA = { ... };
DATA = merge(DATA, b);
Deep
// Just
extend(true /* deep */, a, b);
// Perkakas
mergeDeep(a, b);
Arrays
// Just
const DATA = [...];
extend(DATA, b);
// Perkakas
let DATA = [...];
DATA = splice(DATA, 0 /* start */, b.length /* deleteCount */, b /* replacement */);
Multiple objects
// Just
const DATA = { ... };
extend(DATA, b, c, d);
// Perkakas
let DATA = { ... };
DATA = mergeAll([DATA, b, c, d]);
has
Just has → hasProp.
- Just's
hasaccepts deep paths (e.g.["a", "b"],"a.b"). Perkakas'shasProponly checks a single key.
// Just
has(obj, 'a');
// Perkakas
hasProp(obj, 'a');