1.0.0 • Published 5 years ago
@dominiquemasena/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 @dominiquemasena/lotide
Require it:
const _ = require('@dominiquemasena /lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
- tail(arr): function where the result is tail end of an array. All items in array expect first item.
- head(arr): function where the result is head of an array. The first item in an array.
- middle(arr): function where the result is item in the middles of an array.
- tail(arr): function where there result is tail end of an array. All items in array expect first item.
- countOnly(allItems, itemsToCount): function where the occurence of a given item is counted in an array.
- assertArraysEqual(arr1, arr2): function where the two arrays are compared to assert if they're equal or not.
- assertEqual(actual, expected): function where the actual and expected outcomes are compared to assert if they're equal or not.
- takeUntil(array, callback): function where items in an array are pushed into another array until it reaches a given item.
- eqArrays(arr1, arr2): function where the actual and expected outcomes of two arrays are compared.
- findKey(object, callback): function where the result is the first key in an object that returns a truthy value.
- assertObjectsEqual(actual, expected): function where the two objects are compared to assert if they're equal or not.
- eqObjects(object1, object2): function where the actual and expected outcomes of two objects are compared.
- letterPositions(sentence): function where the position of a given letter in a sentence is given.
- countLetters(string): function where the number of letters in a string are counted.
- without(arr1, arr2): function where the resulting array is an array without the items in another.
- map(array, callback): function where an array is transformed through a callback.
- findKeyByValue(shows, genre): function where the result is a key in an object corresponding to a given value.
1.0.0
5 years ago