@s3leha/lotide
v1.0.1
Published
mini version of lodash js library
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 @s3leha/lotide
Require it:
const _ = require('@s3leha/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head
: returns the head of given array (first element)tail
: takes an array and returns a new array equals the original but without the headmiddle
: takes one array as parameter and return the middle element (one if odd, two if even)assertArraysEqual
: takes two arrays and compare if they matchassertEqual
: takes 2 parameter and use the === operator to check if the params matchassertObjectsEqual
: takes 2 objects and check if they matchcountLetters
: takes a string as parameter and return an obj with count of each lettercountOnly
: takes arry and opject as params, count array elements based on classification from the objeqArrays
: takes two arrays as parameters and return true if they match false otherwiseeqObjects
: takes 2 objects as params and return true or fals based on perfect matchfindKey
: takes an object and a callback function loop through obj and return key of fuond value from the cbfindKeyByValue
: takes an obj and a value as params, returns the first key that contain the matching valueletterPositions
: takes a sentence as parameter and returns an obj with each letter index (zero based)map
: takes an array and a callback, returns a new array
*** This library works, but it is far from done ***