1.0.0 • Published 4 years ago
@rickwu93/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 @rickwu93/lotide
Require it:
const _ = require('@rickwu93/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
const assertArraysEqual = function(arr1, arr2): Compares two arrays to return true if equalconst assertEqual = function(actual, expected): True if actual === expectedconst eqObjects = function(object1, object2): Compares two objects with assertObjectEqualconst assertObjectsEqual = function(actual, expected): Compares two objects to return true if equalconst countLetters = function(string): Returns their letter position in the stringconst countOnly = function(allItems, itemsToCount): Counts up items if contained in the second array by positionconst eqArrays = function(arr1, arr2): Compares two arrays with assertAttaysEqualconst findKey = function(object, callback): Returns first key which callback returns trueconst findKeyByValue = function(object, value): Returns key with matching argumentconst head = function(arr): Returns head of arrayconst letterPositions = function(sentence): Returns index of specified letter in stringconst map = function(array, callback): Returns a new array of results with callbackconst middle = function (arr): Returns middle element in arrayconst tail = function(arr): Returns tail with head removedconst takeUntil = function(array, callback): Returns elements in array until callback is falseconst without = function(source, itemsToRemove): Returns new array without specified items
1.0.0
4 years ago