1.0.0 • Published 3 years ago
@declan_lyons/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 @declan_lyons/lotide
Require it:
const _ = require('@declan_lyons/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head
: Grabs the first element in an array.tail
: Grabs the last element in an array.middle
: Grabs the middle element of an array.assertArraysEqual
: Asserts that two arrays are equal.assertEqual
: Asserts that two values are equal.assertObjectsEqual
: asserts that two objects are equal.countLetters
: Counts how many of a given letter are contained in a string.countOnly
: Counts how many instances of a word are in a string.eqArrays
: Asserts that two arrays are equal.eqObjects
: asserts that two abjects are equal.findKey
: Finds a value within an object based on a given key.findKeyByValue
: Finds the key of an object based on the given value.flatten
: Flattens an array of nested arrays into one single array.letterPosition
: Finds the index of a given letter within a string.map
: Takes in a given array and a function and outputs a new, transformed array.takeUntil
: Takes the values from a given array until a predefined point in the array. The predefined point is specified by a function that returns a truthy value.without
: Returns a subset of a given array excluding all instances of a specified unwanted element.
1.0.0
3 years ago