1.0.0 • Published 3 years ago

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

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • head(array): returns the 1st element of the array.
  • tail(array): returns every element except the head (first element) of the array.
  • middle(array): returns the middle-most element(s) of the given array.
  • countLetters(string): takes in a sentence (as a string) and returns a count of each of the letters in that sentence.
  • countOnly(array, object): returns an object containing counts of everything that the input object listed.
  • findKey(object, callback): returns a key on an object where its value matches a given value.
  • findKeyByValue(object, string): returns a key on an object where its value matches a given value.
  • letterPositions(string): returns all the indices (zero-based positions) in the string where each character is found.
  • map(array, callback): returns the length of each string in the input array.
  • takeUntil(array, callback): returns a slice of the array with elements taken from the beginning.
  • without(array1, array2): returns a subset of a given array, removing unwanted elements listed in the 2nd array.