@oaya/lotide
v1.0.2
Published
school project which create clone of lo_dash
Downloads
8
Readme
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 @oaya/lotide
Require it:
const _ = require('@oaya/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(arr1, arr2)
: asserts the two arrays are equivalentassertEqual(actual, expected)
: assert the two values are equivalentassertObjectsEqual(actual, expected)
: assert the two object values are equivalentcountLetter(string)
: count number of charactors and return with the charactor and value as a objectcountOnly(array, object)
: takes an array and an object, returns new object that contains the count array elements are in objecteqArrays(arr1, arr2)
: takes two array and compare them.eqObjects(actual, expected)
: compare two objects are equal or notfindKey(obj, callback)
: check callback function condition and find the object and return the Key of the objectfindKeyByValue(obj, value)
: find the object Key by given value in the object and return Keyflatten(array)
: takes an array and if there are nested array take the array out and return as a single arrayhead(arr)
: takes an array and return the first element of the arrayletterPositions(sentence)
: takes an string and return object with letter positionsmap(array ,callback)
: takes array and return a new array with values with callback condition applied to each valuemiddle(array)
: takes array and return the middle of the value of arraytail(array)
: takes array and reutn the value of without the first elementtakeUntil(array ,callback)
: takes an array and apply the callback condition to each element. when the condition become falsethy place the element in to new array when become truthy, stop excuteing and return the new array.without(source, itemToRemove)
: takes two array and remove the item from the first array that match with second array and return the the remainning element in the new array.