1.0.0 • Published 4 years ago

@ktobar/lotide v1.0.0

Weekly downloads
1
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 @ktobar/lotide

Require it:

const _ = require('ktobar/lotide');

Call it:

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

Documentation

The following functions are currently implemented:

  • head(array): Retrieve the first element of array
  • tail(array): Retrieve all but the first element of array
  • middle(array): Retrieve the middle elements of array that is 3 or greater
  • assertArraysEqual(actualArr, expectedArr): Arrays compare and success / failure messages printed to console
  • assertEqual(actualVal, expectedVal): Values compare and success / failure messages printed to console
  • assertObjectsEqual(actualObj, expectedObj): Object compare and success / failure messages printed to console
  • counterLetter(string): Retrieve counts for character in string
  • countOnly(allItems, itemsToCount): Retrieve count for a specific value
  • eqArrays(actualArr,expectedArr): Compare two arrays for a equal match
  • eqObjects(actualObj,expectedObj): Compare two objects for a equal match
  • findkey(object, callback): Search for a key in object for value matching a given value
  • findKeyByValue(obj,key): Searche an object and return the first key matching callback
  • letterPositions(string): Return all the indices (zero-based positions) in the string where each character is found
  • map(array, callback): Retrieve a new array based on the results of the callback function
  • takeUntil(array, callback): Retrive a slice of the array with elements taken from the beginning
  • without(array1,array2): Retrive a subset of a given array, removing unwanted elements