1.0.0 • Published 5 years ago

@willow123red/lotide v1.0.0

Weekly downloads
1
License
ISC
Repository
-
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 @willow123red/lotide

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • assertArraysEqual(current, expected): check if an array is equal to what is expected
  • assertEqual(current, expected): compare if an outcome is as expected when passing an argument
  • assertObjectsEqual(object1, object2): compare if two objects are equal
  • countLetters(string): count the number of times a character appears in a string
  • countOnly(allItems, itemsToCount): count number of particular item in a group of items
  • eqArrays(arr1, arr2): Check if two arrays are equal
  • eqObjects(obj1, obj2): Compares two objects keys and values
  • findKey(obj, call): Find key in an object
  • findKeyByValue(obj, name): find a key in object by value
  • flatten(previous): Flatten a nested array
  • head(arr): Return the head index of an array
  • index(): Index of library
  • letterPositions(string): Find index of characters in a string
  • map(array, callback): Return a new array based on a callback
  • middle(array: Find the middle index/indexes in an odd or even numbered array
  • tail(array): Find the tail indexes of an array
  • takeUntil(array, callback): Iterate through an array until reaching a callback item
  • without(array, callback): Remove items from an array based on a callback item