1.0.0 • Published 2 years ago

@angelblacite/lotide v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
2 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 @angelblacite/lotide

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • _.head(arr): return the first element (index0) of the input array
  • _.tail(arr): return a copy of input array with the first element (index0) removed
  • _.middle(arr): return an array containing the middle element(s) of input array
  • _.assertArraysEqual(...): assert if two arrays are equal
  • _.assertEqual(...): assert if two elements are equal
  • _.countLetters(...): count what letter presence and no. of occurence
  • _.countOnly(arr, obj): count occurence in array as specificed in obj
  • _.eqArrays(arr1, arr2): eval if two arrays are equal
  • _.eqObjects(obj1, obj2): eval if two objects are equal
  • _.findKey(obj, callback): when callback return true, return key
  • _.findKeyByValue(obj, val): return the key of key/val pair from an object
  • _.flatten(arr): return a flat array by flattening the input nested array
  • _.letterPositions(string): return an object with each diff letter as key, and the index of where it appears
  • _.map(arr, callback) return an array with each element from input array processed by the callback
  • _.takeUntil(arr, callback): return a copy of input array with every element until callback function return true
  • _.without(arr, exceptionEle): return a copy of input array with exceptionEle removed
1.0.0

2 years ago