1.0.1 • Published 4 years ago
@nforne/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 @nforne/lotide
Require it:
const _ = require('@nforne/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
const lotide = {
assertArraysEquals : require("./assertArraysEqual"),
assertEqual : require("./assertEqual.js"),
eqArrays : require("./eqArrays"),
head : require("./head"),
middle : require("./middle"),
tail : require("./tail"),
eqObjects : require("./eqObjects"),
countLetters : require("./countLetters"),
assertObjectsEqual : require("./assertObjectsEqual"),
countOnly : require("./countOnly"),
findKey : require("./findKey"),
findKeyByValue : require("./findKeyByValue"),
flatten : require("./flatten"),
letterPositions : require("./letterPositions"),
map : require("./map"),
takeUntil : require("./takeUntil"),
without : require("./without")
};
module.exports = lotide;
function1(assertArraysEquals)
: an assertion function to establish the equality of arraysfunction2(assertEqual)
: an assertion function to determine if two primitives are equalfunction3(eqArrays)
: compares two arrays and establish if they're equal or notfunction4(head)
: returns x0 of a given array xfunction5(middle)
: returns the middle elment(s) of a given arrayfunction6(tail)
: returns an array of elments in a given array x, except x0function7(eqObjects)
: compares two objects and establish if they're equal or notfunction8(countLetters)
: establish the frequency of each element in a given stringfunction9(assertObjectsEqual)
: an assertion function to establish the equality of objectsfunction10(countOnly)
: selectively counts the occurrrence of given elements in a given array poolfunction11(findKey)
: callback operation on a given element of an object searched by its keyfunction12(findKeyByValue)
: find key by value for a given objectfunction13(flatten)
: reduce a nested array to a single level arrayfunction14(letterPositions)
: returns all the indices of each element a in given stringfunction15(map)
: takes an array and returns another after a callback operationsfunction16(takeUntil)
: takes an array and returns another after a callback operationsfunction17(without)
: selectively remove given elements from a given arrayfunction18(...)
: description