1.0.0 • Published 4 years ago
@rajulramani/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 @rajulramani/lotide
Require it:
const _ = require('@rajulramani/lotide');
Call it:
const results = _.head([1, 2, 3]) // => 1
Documentation
The following functions are currently implemented:
assertArraysEqual(array1, array2): arrertion for 2 equal arraysassertEqual (actual, expected): arrertion for 2 equal numbersassertObjectsEqual(actual, expected): assertion for 2 equal objectsacountOnly (allItems, itemsToCount): Counts the number of item in a listeqArrays (array1, array2): checks for 2 equal arrayseqObjects (object1, object2): checks for 2 equal objectsfindKey(object, callback): returns the key of given object using callback functionfindKeyByValue (givenObject, givenValue): finds key of the object from given valuehead(array): returns first element of any arraymap (array, callback): returns an array of mapped items from the callback functionmiddle (array): returns middle element from an odd array and returns middle 2 elements from an even arraytakeUntil (array, callback): returns a sliced array of elements based on callback functionwithout (array1, array2): returns an array after removing array 2 elements from array1
1.0.0
4 years ago