1.0.1 • Published 5 years ago
@xsavoie/lotide v1.0.1
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 @xsavoie/lotide
Require it:
const _ = require('@xsavoie/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual: verify that 2 arrays are equalassertEqual: Basic assertion function using ===fassertObjectEqual: verify that 2 objects are equalcountLetters: will count occurance of each letter in given stringcountOnly: will count occurance of specified character in given stringeqArrays: verify that two arrays are equaleqObjects: verify that two objects are equalfindKey: takes in a callback function to return key of specified valuefindKeyByValue: takes in a value and will return key associated to that valueflatten: takes in an array containing elements, including nested arrays, and returns flattened version of that arrayhead: will return the first element of an arrayletterPositions: returns objects with index positions of each letter in given stringmiddle: returns middle element of array. Will return 2 element if array.length is evenmap: take a callback function and will modify each element of given array according to callback functiontail: returns tail of an arraytakeUntil: takes in an array and pushes element to a new array until specified condition is metwithout: takes in an array and returns new array with each element, excepts specified value