1.0.0 • Published 2 years ago
@zhuicode99/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 @zhuicode99/lotide
Require it:
const _ = require('@zhuicode99/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
- head(Array): takes an array as input and then return the first item of the array.
- tail(Array): takes an array as input and then return the same array without the first item.
- middle(Array): takes an array as input and return the middle item or average of middle two numbers.
- assertEqual(): compare two items, return true if equal.
- eqArrays(): compare two arrays, return true if equal.
- assertArraysEqual(): compare two arrays, return 'pass' message if equal.
- without(): loop thru an array and return new array without items don't meet condition.
- countLetters(): takes a string as input and return the numbers of each letters in the string.
- countOnly(): takes an array as input and return the numbers of each item in the array.
- letterPositions(): takes a string as input and return the position of each letter in the string.
- findKeyByValue(): find an object key by given its value.
- eqObjects(): compare two objects, return true if equal.
- assertObjectsEqual(): compare two objects, return 'pass' message if equal.
- map(): receive a helper function to make change on an array, and then make a new array.
- takeUntil(): loop thru an array and push items to an empty new array until condition not met.
- findKey(): loop thru an object by a helper function, return the key if meet condition.
1.0.0
2 years ago