1.0.0 • Published 5 years ago
laurtann-lotide v1.0.0
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 @laurtann/lotide
Require it:
const _ = require('@laurtann/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(): will assert if arrays are equal and log T or FassertEqual(): will assert if elements are equal and log T or F (not for use on objects)assertObjectsEqual(): will assert if objects are equal and log T or FcountLetters(): will take a string as an argument and return an object with counts for each lettercountOnly(): will take in an array of elements (arg 1) and return counts for a specific subset of these elements (arg 2)eqArrays(): will check if arrays are equal and return T or FeqObjects(): will check if objects are equal and return T or FfindKey(): will take in an object and callback and return first key that callback returns as truthyfindKeyByValue(): will take in an object and value and return first key that contains the valueflatten(): will flatten a nested array into a single-level arrayhead(): will return element 0 of an element or array.letterPositions(): will take in a string and return all indices where character foundmap(): will take in an array and callback and return a new array based on callbackmiddle(): will take in an array return the element(s) in the middle position(s). Will return [] if array.length < 3.tail(): will take in an array return all elements except for that at index 0 (the head). Will return [] if array.length < 2.takeUntil(): will take in an array and callback and will slice array from index 0 until callback returns a truthy value.takeUntil(): will take in an array and callback and will slice array from index 0 until callback returns a truthy value.without(): will take in an array and callback and will slice array from index 0 until callback returns a truthy value.
1.0.0
5 years ago