1.0.0 • Published 3 years ago

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

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

head - copies index0 of an array and returns that value. tail - Removes index 0 of a given array and returns a new array minus index0 middle - Returns a new array with the value at the middle index. assertArraysEqual - Prints an assertion message stating if two varrays are demmed equal or not. assertEqual - Assert function which prints a message to the console if values are equal. assertObjectsEqual - Prints an assertion message stating if two objects are deemed equal or not. countLetters - Counts the occurences of a given letter in a string and returns an object with each letter value. countOnly - Counts the occurences of a given value against a variable and returns an object with the value as keys and number of occurences as values. eqArrays - Checks to see if 2 arrays have strict equal values at each index. eqObjects - Checks whether key value pairs of an object are equal. findKey - Scans an object and returns the first key for a given value using a callback function. findKeyByValue - Scans an objects values and returns the key for a matching inputted value. letterPositions - Loops an array an creates an object with the letters of that array as keys and their indeces as the values. map - Takes in an array and returns a new array of the values determined by a callback function takeUntil - Takes in an array and returns a new array until a given value of the original array is met without - Takes in an array and returns a new array of values excluding those specified.