1.0.0 • Published 4 years ago
@jowe81/lotide v1.0.0
Lotide
A mini clone of the Lodash library.
Purpose
BEWARE: This library was published for learning purposes. It is not intended for use in production-grade software.
This project was created and published by me as part of my learnings at Lighthouse Labs.
Usage
Install it:
npm install @jowe81/lotide
Require it:
const _ = require('@jowe81/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
countLetters(string): returns an object with a key for each character, the value indicating the frequency of character instringcountOnly(array, settings): returns an object indicating how many times each array item indicated insettingsoccurs inarrayeqArrays(array1, array2): returns true ifarray1andarray2are deeply equaleqObjects(object1, object2): returns true ifobject1andobject2are deeply equalfindKey(object, callback(item)): returns the first key fromobjectwhose value matches the condition expressed incallbackfindKeyByValue(object, value): returns the first key fromobjectwhose value matchesvalueflatten(array): returns a flattened version ofarray(nesting allowed)head(array): returns the first element ofarrayor the empty arrayletterPositions(string): returns an object indicating for each letter instringwhere it occursmap(array,callback): executescallbackon each element ofarrayand returns an array with the resultmiddle(array): returns the middle element(s) ofarray, or the empty arraytail(array): returns a copy ofarraywithout its first element, or the empty arraytakeUntil(array, callback): returns the first part ofarrayuntil and excluding the first element that satisfies the condition expressed incallbackwithOut(array, array2): returns a copy ofarraythat does not contain elements fromarray2
1.0.0
4 years ago