1.0.0 • Published 2 years ago

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

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • countLetters('LHL'): Counts letters in the given string { L: 2, H: 1 }
  • countOnly(array, { 'string1': true, 'string2': false, 'strin...': true}): Counts specific strings in the giben array based on the filtering object.
  • findKeyByValue(object, 'value'): Returns the key in the object by the given value
  • findKey(object, func): Returns the key in the object filtered by the callback filtering function
  • flatten([1, 2, [3, 4], 5, [6, [7, 8, 9, [10, 11, 12]]]]): Returns a single array from the given array that may contain nested arrays.
  • head([5, 6, 7]): Returns the first element in the array 5
  • letterPositions('Hello'): Returns the letter positions of a given string {H:0,e:1,l:2,3,o:4}
  • map(array, func): Returns a new array based on the callback function manipulation
  • middle([1, 2, 3]): Returns an array with the middle element of the given array 2
  • reverse('hello'): Reverses the given string 'olleh'
  • tail([1,2,3,4,5,6]): Returns an array with all the elements after the first 2,3,4,5,6
  • takeUntil(array, func): Returns an array of elements until the callback funtions return false.
  • without(array, array): Returns an array with all the elements not contained in the second array.
1.0.0

2 years ago