1.0.0 • Published 4 years ago
@ian.c.cameron/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 @ian.c.cameron/lotide
Require it:
const _ = require('@ian.c.cameron/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head
:returns the first item in an array
tail
:returns an array without the first item
middle
:returns the item, or two items, in the middle of an array
assertArrayEqual
:outputs a message about if two given arrays are equivelent
assertEqual
:outputs a message about if two given primatives are equal
assertObjectsEqual
:outputs a message about if two given objects are equivelent
countLetters
:returns an objects containing the count of each letter in a string
countOnly
:returns an object with the number of occurances of the given strings in a sentance
eqArrays
:when passed two arrays it returns true if they are equivilent, and false if they arn't
eqObjects
:when passed two objects it returns true if they are equivilent, and false if they arn't
findKeyByValue
:searches an object for a value, and returns the first key with that value
findKey
:flatten
:turns a multi-dimentional array into a one dimentional array
letterPositions
:returns an object with the positions of each letter in a string
map
:performs a passed function on all the items in an array
takeUntil
:returns the part of an array before a passed function is satisfied by a value
without
:takes an array, and returns all the values not in another passed array
min
:returns the lowest value in an array
1.0.0
4 years ago