@gascon-m/lotide
v1.0.1
Published
This is a limited copy of the lodash library, with a few select functionalities. This was done as a first project at Lighthouse Labs.
Downloads
7
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 @gascon-m/lotide
Require it:
const _ = require('@gascon-m/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head
: returns the first item of an arraytail
: returns all but the first item of an arraymiddle
: returns the middle item of the array, if the array is of even length, returns two itemsassertArraysEqual
: formats a proper answer after using eqArraysassertEqual
: check if two items are equal, does not work on arrays or objects (see assertArraysEqual or assertObjectEqual)assertObjectEqual
: formats a proper answer after using eqObjectscountLetters
: count the letters in a stringcountOnly
: counts the occurence of a specified item in an array of stringseqArrays
: checks if two arrays are equaleqObjects
: checks if two objects are equalfindKey
: returns the value with the specified keyfindKeyByValue
: returns the key with the specified valueflatten
: returns a multiple-level array as a single level arrayletterPositions
: takes a string and returns an object with letters as keys and values are the index at which the letters appearmaps
: accepts an array and a callback function and returns what was asked of the callback functiontakeUntil
: accepts an array and a callback function. Returns an array with all the values until the value of the callback function is reached.without
: accepts an array and an item. Returns the array with the specified item removed from it.