1.0.0 • Published 4 years ago

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

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • assertEqual(actual, expected): prints message if two values are equal
  • assertArraysEqual(arr1, arr2): prints message if two arrays are equal
  • assertObjectsEqual(obj1, obj2): prints message if two objects are equal
  • countLetters(sentence): counts the number of letters in a string
  • countOnly(allItems, itemsToCount): reports the number of instances some items occur within an array according to an object
  • eqArrays(arr1, arr2): returns true or false based on a perfect match between two arrays
  • eqObjects(obj1, obj2): returns true or false based on a perfect match between two objects
  • findKey(object, callback): returns a key if it matches the result of the given callback func
  • findKeyByValue(object, value): returns a key based on a given value
  • head(array): returns the first item in an array
  • letterPositions(sentence): returns the position (index) of a given item in a string
  • map(array, callback): returns an array of items that match the given callback function's results
  • middle(array): returns the middle section of an array with length 3 or greater
  • tail(array): returns the tail of an array
  • takeUntil(...): returns an of values up until a point designated by the callback
  • without(source, toRemove): creates a new array without words that are inputed to be removed