Giter Club home page Giter Club logo

lotide's Introduction

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

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

✔️ assertArraysEqual (arr1, arr2) | console.log assertion that two arrays are deep equals.

✔️ assertEqual (actual, expected) | console.log assertion that two arrays are deep equals.

✔️ assertObjectsEqual (obj1, obj2) | console.log assertion that key-value pairs in an object are deep equals

✔️ countLetters (string) | count the number of times each letter of a string occurs

✔️ countOnly (array, obj{key: true, key: true, etc.}) | receive an array and an object. It will return an object containing counts of everything that the input object listed.

✔️ eqArrays (arr1, arr2) | check that two arrays are deep equals. return true/false

✔️ eqObjects (obj1, obj2) | check that key-value pairs in an object are deep equals. return true/false

✔️ findKey (object, callback) | scan an object and return the first key for which the provided callback returns a truthy value. If no key is found, then it should return undefined.

✔️ findKeyByValue (object, value) | can the object and return the first key which contains the given value. If no key with that given value is found, then it should return undefined.

✔️ head (array) | return the first item of an array

✔️ letterPositions (string) | return all the indices (zero-based positions) in the string where each character is found.

✔️ map (array, callback) | return new array mutated by callback function

✔️ middle (array) | take in an array and return the middle-most element(s) of the given array.

✔️ tail (array) | take in an array and return exluding first value

✔️ takeUntil (array, callback) | receive array and return copy of array based on callback

✔️ without (array, callback) | return a subset of a given array, removing unwanted elements.

lotide's People

Contributors

afairlie avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.