1.0.0 • Published 2 years ago
@joetang0825/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 joetang0825/lotide
Require it:
const _ = require('joetang0825/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(ar1, ar2)
: Compare two arrays using eqArray() and display message to confirm if the actual result matches the expected resultassertEqual(actual, expected))
: Display message to indicate if the actual result matches the expected resultassertObjectsEqual(actual, expected))
: Check if number of keys from 2 objects are the samecountLetters(sentence))
: Count the occurences of letter in a sentencecountOnly(allItems, itemsToCount))
: Count the number of occurence of object keys in an arrayeqArrays(array1, array2))
: Compare 2 arrays to see if they are the sameeqObjects(object1, object2))
: Check if 2 objects are the samefindKey(objects, callback))
: Find the key in Objects by providing a callback functionfindKeyByValue(showObj, Name))
: Search key's value in an object and return the keyflatten(nestedArray))
: Assume at most there is only 1 level of array inside the test array and extract all elements from all the array(s) inside to one new arrayhead(Array))
: Return first element in an arrayletterPositions(sentence))
: Find the position of every unique character in the sentence, with index starting at 0map(array, callback))
: Create an array that store the result of a callback functionmiddle(array))
: Return the middle element(s) of an arraytail(Array))
: Return an array of all elements passed in, except the first elementtakeUntil(array, callback))
: Take an array and return each elements until the condition in the callback is satisfiedwithout(source, itemsToRemove))
: Remove elements from source array that match element from itemsToTRemove array
1.0.0
2 years ago