https://github.com/victorola-coder/lotide
loadash clone
https://github.com/victorola-coder/lotide
Last synced: over 1 year ago
JSON representation
loadash clone
- Host: GitHub
- URL: https://github.com/victorola-coder/lotide
- Owner: Victorola-coder
- Created: 2023-11-20T09:15:04.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-12-18T00:56:04.000Z (over 2 years ago)
- Last Synced: 2025-02-08T11:43:36.467Z (over 1 year ago)
- Language: JavaScript
- Size: 35.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Lotide
A mini clone of the [Lodash](https://lodash.com) 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 @victorola-coder/lotide`
**Require it:**
`const _ = require('@victorola-coder/lotide');`
**Call it:**
`const results = _.tail([1, 2, 3]) // => [2, 3]`
## Documentation
The following functions are currently implemented:
* `assertArrayEqual(arrayA, arrayB)`: shows pass/fail in console depending if both Arrays are equal
* `assertEqual(itemA, itemB)`: shows pass/fail in console depending if both Variables are equal
* `assertObjectsEqual(objA, objB)`: shows pass/fail in console depending if both Objects are equal
* `countLetters(string)`: returns an object with the number of times each letter occurs in a string
* `countOnly(array, itemsToCount)`: returns an object with the number of times each item in itemsToCount appears in a array.
* `eqArrays(arrayA, arrayB)`: returns true if both arrays are equal
* `eqObjects(objA, objB)`: returns true if both objects are equal
* `findKey(object, callback)`: returns key if callback(object.key) is true
* `findKeyByValue(object, value)`: returns key if it exists in object, otherwise returns undefined
* `flatten(array)`: returns flat array with no nesting
* `head(array)`: returns the first element of an array
* `letterPositions(sentence)`: returns an object that shows every letter in the string and the index's they appear in the string
* `map(array, callback)`: return a new array after calling a callback function on each item in the given array
* `middle(array)`: return the middle of the array, if the middle has 2 elements return both.
* `tail(array)`: return a array without the first element
* `takeUntil(array, callback)`: return an array up to the point where the callback on the item in the array returns true
* `without(array, itemsToRemove)`: return an array without any items that occurs in itemsToRemove