1.0.0 • Published 4 years ago

@kennytse/lotide v1.0.0

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

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • assertArraysEqual(arrayOne, ArrayTwo): asserts that arrayOne is equal to arrayTwo
  • assertEqual(actual, expected): asserts if the actual value is the expected value
  • assertObjectsEqual(actual, expected): asserts if the actual object is the expected object
  • countLetters(someString): counts the amount of times a letter appears in a string
  • countOnly(allItems, itemsToCount): counts the amount of times a string appears in an array given an object of strings to count
  • eqArrays(arrayOne, ArrayTwo): returns true/false based on if the two arrays are the same
  • findKey(object, cb): finds the first key in an object that matches the callback's search specifications
  • findKeyByValue(objectToLook, value): finds the key that matches the specified value
  • flatten(arrayToFlatten): turns a two dimensional array into a one dimensional array
  • head(array): returns the first element in the array
  • letterPositions(sentence): shows the index of each character's apppearance in a given string
  • map(array, callback): returns an array based on the callback specifications
  • middle(array): returns an array with the middle element(s)
  • reverse(string): returns the string in reverse
  • tail(array): removes the first element in the array
  • takeUntil(array, callback): returns an array with elements up until a value specified by the callback
  • without(source, itemsToRemove): returns the array without the element specified