1.0.0 • Published 3 years ago

lotidejosephd 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 @josephd/lotide

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • head: returns the first element of an array.
  • middle: returns the middle index of an array (or the middle two).
  • tail: returns everything after the first element of an array.
  • eqArrays: compares if two arrays are identical.
  • assertEqual: compares against provided boolean, and expected boolean values.

The following functions are implemented, but work in progress:

  • countLetters: Counts how many letters are in a string.
  • countOnly: Returns an object containing letter counts from an array containing strings.
  • assertObjectsEqual: checks if two objects keys/values are identical.
  • findKey: retreives a key/value pair of an object.
  • findKeyByValue: retreieves the key based on the value provided.
  • letterPositions: finds the index of where specific characters are located.
  • flatten: flattens multiple arrays within an array, into one array.
  • map: allows unique filter processing.
  • takeUntil: Takes an array and a function as params. Allows you to adjust an array up to a specified point.
  • without: Returns a new array excluding specified data without affecting the source array.