1.0.0 • Published 3 years ago

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

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • function 1head returns the first element in the array, return the first element as an array.
  • function 2tail returns eerything except for the first item (head) of the provided array.
  • function 3middle return an array with only the middle element(s) of the provided array
  • function 4countLetters returns a count of each of the letters in that sentence.
  • function 5countOnly returns an object containing counts of everything that the input object listed.
  • function 6findKey return the first key for which the callback returns a truthy value. If no key is found, then it should return undefined.
  • function 7findKeyByValue scan the object and return the first key which contains the given value. If no key with that given value is found, then it returns undefined.
  • function 8letterPositions return all the indices (zero-based positions) in the string where each character is found.
  • function 9map returns a new array based on the results of the callback function
  • function 10takeUntil will keep collecting items from a provided array until the callback provided returns a truthy value.
  • function 11without returns a subset of a given array, removing unwanted elements