2.1.7 • Published 4 months ago

sloadash v2.1.7

Weekly downloads
-
License
ISC
Repository
github
Last release
4 months ago

Custom Lodash-like Utility Functions This project provides a set of utility functions that replicate some common methods found in the Lodash library. These functions aim to simplify everyday tasks such as cloning objects, deep merging arrays, and handling collections, but without requiring a full Lodash library.

Functions Here is a brief description of each function included in this package:

Functions

Function NameDescriptionExample Usage
cloneDeepDeeply clones an object or array, ensuring all nested properties are copied.cloneDeep({a: {b: 1}});
onceReturns a function that is only invoked once, no matter how many times it is called.const func = once(() => console.log('Called'));
getRetrieves the value at a given path of an object, safely handling undefined paths.get(obj, 'a.b.c');
concatConcatenates multiple arrays into a single array.concat([1, 2], [3, 4]);
differenceReturns an array of values that are present in the first array but not in the subsequent arrays.difference([1, 2, 3], [3, 4]);
dropReturns a new array with the first n elements removed.drop([1, 2, 3], 2);
fillFills an array with a specific value between start and end indexes.fill([1, 2, 3], 0, 2);
flattenDeepFlattens a deeply nested array into a single level array.flattenDeep([1, [2, [3, [4]]]]);
headReturns the first element of an array.head([1, 2, 3]);
initialReturns a new array excluding the last element.initial([1, 2, 3]);
intersectionReturns an array of values that are present in all provided arrays.intersection([1, 2], [2, 3]);
joinJoins the elements of an array into a string, separated by a specified separator.join([1, 2, 3], ',');
findIndexFinds the index of the first element in an array that satisfies the provided predicate function.findIndex([1, 2, 3], x => x === 2);
reverseReverses the order of the elements in an array.reverse([1, 2, 3]);
tailReturns a new array excluding the first element.tail([1, 2, 3]);
unionCombines multiple arrays into a single array, removing duplicate elements.union([1, 2], [2, 3], [3, 4]);
pullRemoves all instances of the given values from an array.pull([1, 2, 3, 4, 5], 2, 4);
forEachIterates over an array or object, executing a provided function for each element.forEach([1, 2, 3], console.log);
takeCreates a slice of an array with n elements taken from the beginning.take([1, 2, 3, 4], 2);
uniqReturns a duplicate-free version of an array, preserving the first occurrence of each unique element.uniq([1, 2, 2, 3, 4, 4]);
2.1.7

4 months ago

2.1.6

9 months ago

2.1.5

9 months ago

2.1.4

9 months ago

2.1.3

9 months ago

2.1.2

9 months ago

2.1.1

9 months ago

2.1.0

9 months ago

2.0.0

9 months ago

1.8.0

9 months ago

1.7.0

9 months ago

1.4.0

9 months ago

1.3.0

9 months ago

1.2.0

9 months ago

1.1.0

9 months ago

1.0.0

9 months ago