1.0.1 • Published 2 years ago

@kbmaglalang/lotide v1.0.1

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

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • assertArraysEqual(actual, expected): assert if two arrays are equal
  • assertEqual(actual, expected): assert if two primitives are equal (not array or object)
  • assertObjectsEqual(actual, expected): assert if two objects are equal
  • countLetters(stringInput): count the existance of each letter in a string passed
  • countOnly(allItems, itemsToCount): count the number of times the object key exists in an array
  • eqArrays(actual, expected): compares two arrays
  • eqObjects(object1, object2): compares two objects
  • findKey(objectInput, callbackFunction): find the key of an object from the callback function passed
  • findKeyByValue(objectInput, searchKey): find the key of an object from the key-value passed
  • flatten(array): creates a single depth array from nested arrays
  • head(array): get the first element of an array
  • index: an object of all functions of lotide
  • letterPositions(sentence): list the index of each letter in a string
  • map(array, callback): returns a new array of transformned by the callback function
  • middle(array): get the middle element of an array
  • tail(arrayInput): returns a new array without the first element of the original array
  • takeUntil(array, callback): returns a slice of the array with elements taken from the beginning depending on callback function
  • without(source, itemsToRemove): returns a new array of the original array without the array element specified