1.0.0 • Published 4 years ago
@chris_tater/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 @chris_tater/lotide
Require it:
const _ = require('@chris_tater/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual = function (a1, a2): Checks if two arrays are equalassertEqual = function (actual, expected): Assertion function you can use to test the actual vs expected outputeqObjects = function (object1, object2): Verifies if two objects are equalassertObjectsEqual = function (actual, expected): Assertion for eqObjectscountLetters = function (string): Counts the number of times a leter appears in a stringcountOnly = function (allItems, itemsToCount): Sorts through an object and only counts the number of times a value appears. Will return false if the value is not in the object.findKey = function (object, callback): Returns the key if given the valuefindKeyByValue = function (object, value): finds the key if given the valuehead(array): returns the first value in an array.letterPositions = function (sentence): returns each index of a letter in a string.map = function (array, callback): The map function will return a new array based on the results of the callback function.middle = function (array): Will return the middle value(s) of an array.tail = function (array): Returns the entire array except the first value.takeUntil = function (array, callback): Will return the array up until a given value.without = function (sourceArray, itemsToRemove): Removes items from an array.
1.0.0
4 years ago