2.0.0 • Published 4 years ago

@juliannalim/lotide v2.0.0

Weekly downloads
1
License
ISC
Repository
github
Last release
4 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 @juliannalim/lotide

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • head : inputs array. returns the first element of the array
  • tail : inputs array. returns the last element of the array
  • middle : inputs array. returns array with the middle index element. If it is even number, it will return two elements. An odd number array will return one element
  • assertEqual : checks if two peices of data are the same.
  • assertArraysEqual (arrayOne, arrayTwo) : checks if 2 arrays are same. Console.log an appropriate message based on whether they are equal.
  • eqArrays : checks if two arrays are the same. returns false or true
  • countLetters : checks input, and counts the amount of letters or letters in the string. Does not include spaces. Returns individual letters/key of the value, and how many time it has been repeated
  • countOnly : checks the amount of the same data has been inputtted in the array. Returns the number of times the data has been repeated
  • findKeyByValue : checks the first value that matches the inputted data. Returns the key.
  • eqObjects(objectOne, objectTwo): checks if 2 objects are same. Returns True or False.
  • findKey(object, callback): checks for first value which matches callback criteria. Returns that key.
  • letterPositions(data): inputs some data (string, number, etc). returns an object with each character as keys. the value of the keys is an array with each index that character occurs.
  • without(array, data): inputs an array and data. Returns array with any elements of the array === inputted data removed.
  • takeUntil(array, callback): inputs an array and callback criteria. returns same array until the element that the callback criteria is met.