1.0.0 • Published 4 years ago

@tgibbs/lotide v1.0.0

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

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • assertArraysEqual(array1, array2): Tells if 2 arrays are equal.
  • assertEqual(el1, el2): Tells if 2 elements are equal.
  • assertObjectsEqual(obj1, obj2): Tells if 2 objects are equal.
  • countOnly(obj, str): Counts number of occurances of string in an object.
  • eqArrays(arr1, arr2): Compares two arrays for equality.
  • findKey(obj, callback): Scan the object and return the first key which contains the given value.
  • findKeyByValue(obj, srchVal): Scan the object and return the first key which contains the given value.
  • head(arr): Returns the first elements of an array.
  • map(array, callback), Returns the length of each element in an array.
  • middle(array): Returns an array with the middle element(s) of an array.
  • takeUntil(array, callback): Will return a slice of the array with elements taken from the beginning.
  • without(array, value): Returns an array with value removed from the original array.