1.0.0 • Published 5 years ago

@harrishs/lotide v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
5 years ago

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 @harrishs/lotide

Require it:

const _ = require('@harrishs/lotide');

Call it:

const results = _.tail([1, 2, 3]) // => [2, 3]

Documentation

The following functions are currently implemented:

  • assertArraysEqual(arr1, arr2): Assert whether two arrays are equal
  • assertEqual(actual, expected): Assert whether two values are equal
  • assertObjectsEqual(actual, expected): Assert whether two objects are equal
  • countLetters(items): Count number of letters in each instance
  • countOnly(allItems, items): Return count of specified item from a set of items
  • eqArrays(arr1, arr2): Compare 2 arrays and check if equal
  • eqObjects(obj1, obj2): Compare 2 objects and check if equal
  • findKeyByValue(key, val): Find key of given value
  • findKey(obj, callback): Find key where callback function gives truthy value
  • flatten(arr): Remove nesting from arrays
  • head(arr): Returns first value of array
  • letterPosition(sentence): Return index of of letters in sentence
  • map(array, callback): Put values of array through a callback function
  • middle(arr): Returns middle value or middle 2 values if even of an array in an array
  • tail(arr): Return all but first value of array
  • takeUntil(arr, callback): Return array of items until callback function becomes true
  • without(arr, remove): Return new array after removing unwanted items from given array
1.0.0

5 years ago