@kcruz95/lotide

1.0.1 • Public • Published

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

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • head (array): returns the 1st element index of an array

  • tail (array): returns the body of an array sans the 1st element index

  • middle (array): returns the middle (two) element(s) of an array

  • assertArraysEqual (actual, expected): uses eqArrays to check if two arrays are equal

  • assertEqual (actual, expected): asserts if two values are equal

  • assertObjectsEqual actual, expected): asserts if two objects are equal

  • countLetters (str): counts each letter of a string

  • countOnly (allItems, itemsToCount): counts the keys of an inputted object and returns an object with a matching set of keys and values

  • eqArrays (arrayOne, arrayTwo): compares two arrays

  • eqObjects (objectOne, objectTwo): compare two objects

  • findKey (object, callback): scans the object and returns the 1st key with a truthy callback value

  • findKeyByValue (object, value): searches for an object key whose value matches a given value

  • letterPositions (sentence): returns all the indices of a string where each charcter is found

  • map (array, callback): returns a new array with the results of calling a function on every element in the array being called

  • takeUntil (array, callback): returns all items from an array until the callback returns a truthy value

  • without (source, itemsToRemove): returns an arry without items listed by the parameter: itemsToRemove

Readme

Keywords

none

Package Sidebar

Install

npm i @kcruz95/lotide

Weekly Downloads

2

Version

1.0.1

License

ISC

Unpacked Size

29.4 kB

Total Files

33

Last publish

Collaborators

  • kcruz95