@saif4004/lotide
v1.0.0
Published
This is a project for LHL lotide
Downloads
4
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 @saif4004/lotide
Require it:
const _ = require('@saif4004/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(...)
: This function checks if the two arrays are equal.assertEqual(...)
: This function is used to check if vaules are the same.assertObjectEqual(...)
: This function checks if two objects are the same or not.countLetters(...)
: This function counts how many times a character occurs in a string.countOnly(...)
: This function counts how many times a name occurs in the list it is given.eqArrays(...)
: This fuction is used in the assertArraysEqual. It first test if both arrays are of the same length and than it checks if they are the same.eqObjects(...)
: This function is used in the assertObjectEqual. It return true if both objects have identical keys with identical values. other wise it return false.findKey(...)
: This is a call back function. It is used to find the key in an object.findKeyByValue(...)
: This function find the key in the object based on the value it is passed to.head(...)
: this function returns the first element of an array.map(...)
: This is a call back function that returns the character based on the index it is passed to it. If the character does not exist it returns unundefined.middle(...)
: This function returns the middle element of an array.tail(...)
: this function removes the first element of the array and returns a new array.takeUntil(...)
: This is a call back function that takes an array and a call back function. It add element of the given array to a new array. It keeps going till the call back condtion is false or untill the last element of the given array has been pushed to the new array.without(...)
: This function takes two arrays. It removes elemnts of from the first array based on the second array. it returns a new array. it does not destroy the orignal array.