1.0.1 • Published 5 years ago
@maridoh13/lotide v1.0.1
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 @maridoh13/lotide
Require it:
const _ = require('@maridoh13/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
function head
: returns the first element of an arrayfunction tail
: removes the first element of an array and returns the restfunction middle
: returns the middle elements of an arrayfunction assertArraysEqual
: compares the actual and expected results (when arrays)function assertEqual
: compares actual and expected values (cannot be used with arrays and objects)function assertObjectsEqual
: compares the actual and expected results (when objects)function countLetters
: counts each letter of a given stringfunction countOnly
: counts specific items in an arrayfunction eqArrays
: compares arraysfunction eqObjects
: compares objectsfunction findKey
: finds the main key when going through values that are objectsfunction findKeyByValue
: returns the key from an object when inputing the valuefunction flatten
: returns a simple array when inputing an array with (simple) arrays insidefunction letterPositions
: returns the positions of the characters of a string (ignores spaces)function map
: returns a new array of elements 'filtered' by the (callback) functionfunction takeUntil
: returns the first part of an array that has been sliced up to a given 'parameter'function without
: returns a new array that has been 'subtracted' of any given elements (input)