1.0.0 • Published 3 years ago

@sylastheodor/lotide v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
3 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 @sylastheodor/lotide

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • head(array): returns the first element (head) of an array
  • tail(array): returns the last element (tail) of an array
  • middle(array): returns the middle 1 or 2 elements depending on array length
  • countLetters(text): counts the amount of letters in a string of text
  • countOnly(array, targets): counts ONLY the targets within an array
  • findKey(object, callback): find the property of an object called in the callback
  • findKeyByValue(object, value): returns the property of an object that has the matching value
  • letterPositions(text): returns a list of all letters in the text, and their position in the sentence
  • map(array, function): runs a function on each element of an array
  • takeUntil(array, callback): return the elements of an array until the conditions of the callback function are met
  • without(source, itemsToRemove): return a new array containing none of the items in the itemsToRemove array