1.0.0 • Published 11 months ago

@alinx/lotide v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
11 months 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 @alinx/lotide

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • head(arr): retrieves the first element from the array
  • tail(arr): retrieves every element except the head of the array
  • middle(arr): returns the middle-most element(s) of the array
  • countLetters(sentence): returns a count of each of the letters in the sentence
  • countOnly(allItems, itemsToCount): returns counts for a specific subset of the items
  • eqArray(arr1, arr2): compares two arrays for a perfect match
  • findKey(obj, callback): scans the object and return the first key
  • findKeyByValue(obj, value): finds a key on an object where its value matches a given value
  • letterPositions(sentence): returns all the indices in the sentence where each character is found
  • map(array, callback): returns a new array based on the results of the callback function
  • takeUntil(array, callback): returns a slice of the array with elements taken from the beginning
  • without(source, itemsToRemove): returns a subset of a given array, removing unwanted elements
1.0.0

11 months ago