1.0.0 • Published 2 years ago

@andyzhen/lotide v1.0.0

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

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • countLetters(string): counts the number of characters in a string.
  • countOnly(array, item to count): only count given values.
  • findKey(object): returns they key of matched element
  • findKeyByValue(object): returns a key given an Object Value
  • flatten(array):flattens an array
  • head(array): gets the first element of an array
  • letterPosition(string) return all indicies where the character is found on a given string/
  • map(array, function): returns a new array with the results of calling a provided function on every element in that calling array.
  • middle(array): gets the middle element
  • tails(array): gets all but first element of an array
  • takeUntil(array,callback): returns an array of sliced elements from the beginning until a given value is reached.
  • without(array,values to exclude): creates an array exluding given values.