@victorcwyu/lotide

A clone of the lodash JavaScript library to practice creating various types of functions using JS.

Usage no npm install needed!

<script type="module">
  import victorcwyuLotide from 'https://cdn.skypack.dev/@victorcwyu/lotide';
</script>

README

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

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • assertArraysEqual : asserts that two arrays are equal
  • assertEqual : asserts that two elements are equal
  • assertObjectsEqual : asserts that two objects are equal
  • countLetters : counts the letters in a sentence
  • countOnly : counts specific items in a collection
  • eqArrays : determines if two arrays are equal, returning true or false
  • eqObjects : determines if two objects are equal, returning true or false
  • findKey :takes in an object and a callback. It should scan the object and return the first key for which the callback returns a truthy value.
  • findKeyByValue : takes in an object and a value. It should scan the object and return the first key which contains the given value.
  • flatten : flattens a nested array into a single-level array
  • head : removes the first element from an array
  • letterPositions :
  • map : creates a new array populated with the results of calling a provided function on every element in the calling array
  • middle : outputs the middle value(s) of an array
  • tail : removes the head of an array
  • takeUntil : will keep collecting items from a provided array until the callback provided returns a truthy value.
  • without : filters data of unwanted items