@jsarnecki/lotide
v1.0.1
Published
A JS function library similar to that of Lodash, created for learning purposes
Downloads
6
Readme
Lotide
A mini clone of the Lodash library.
This library is incomplete - See the Documentation section at the bottom of this page to see the updated list of which functions have been properly tested with M & C.
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 @jsarnecki/lotide
Require it:
const _ = require('@jsarnecki/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(array)
: Returns the first element in a given array.tail(array)
: Returns all elements from an array, except for the first.middle(array)
: Returns the middle indexed element of an array if the length is odd, or the two middle indexed elements if the array is even length.eqArrays(arr1, arr2)
: Returns true if both arrays are the same, false if they do not match.assertEqual(a, b)
: Console logs true if a and b both match, or console logs false if they do not.assertArraysEqual(arr1, arr2)
: Returns true/false if both arrays do/do not match, as well as asserting via console log.letterPositions(string)
: Given a string, returns an object of keys of all the letters in the strings, with values of how many times they are each used in the string