1.0.0 • Published 5 years ago

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

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • assertArraysEqual(actual, expected): equality assertion for two arrays
  • assertEqual(actual, expected): strict equality assertion for two values
  • assertObjectsEqual(actual, expected): equality assertion for two objects
  • countLetters(allLetters, lettersToCount): counts letters in string allLetters, in object lettersToCount
  • countOnly(allItems, itemsToCount): counts items in array allItems, based on object itemsToCount
  • eqArrays(arr1, arr2): compares two arrays for equality
  • eqObjects(object1, object2): compares two objects for equality
  • findKey(obj, callback): returns first key based on parameters of callback
  • findKeyByValue(obj, val): returns first key based on a specified value
  • flatten(nestedArray): returns a flattened array, from a nested array
  • head(arr): returns head on an array
  • letterPositions(str): returns all indices of each letter in the sentence
  • map(arr1, arr2): shallow version of the iterator map
  • middle(arr): returns middle element(s) of an array
  • min(numbers): returns the smallest number in an array
  • tail(arr): returns tail of an array
  • takeUntil(array, callback): pushes array elements into a new array until the stopping condition in callback is met
  • without(source, itemsToRemove): returns a new, filtered array, removing any itemsToRemove that match source