1.0.0 • Published 5 years ago
@cytusalive/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 @cytusalive/lotide
Require it:
const _ = require('@cytusalive/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(array): return the first element of the arraytail(array): return all elements except the first of the arraymiddle(array): return the middle value of the arrayassertEqual(actual, expected): asserts if 2 values are equalassertArraysEqual(actual, expected): asserts if 2 arrays are equaleqArrays(array1, array2): returns a boolean whether or not an array equals anothereqObjects(object1, object2): returns a boolean whether or not an object have the same properties as anotherassertObjectsEqual(actual, expected): asserts if 2 objects are equalcountLetters(string): returns the count of each letter in a stringletterPositions(string): returns the location of each letter in a stringcountOnly(string, char): returns the count of the target character in a stringfindKey(object, callback): find the key in an object that satisfy the condition given in callbackfindKeyByValue(object, value): find the key that contains the given valueflatten(array): get rid of sub arraysmap(array, callback): apply the callback function to every element of an arraytakeUntil(array, callback): return values of array until callback returns truewithout(source, toRemove): return a new array with given elements removed from original array
1.0.0
5 years ago