Coder Social home page Coder Social logo

hibar's Introduction

hibar

JavaScript's missing functions.

Install

yarn add hibar

There are three ways of using it:

Magically

Hibar supports the magic lodash-styled syntax:

const _ = require('hibar')
console.log(_.clamp(0, 1, 2))

This will automagically call the right function. See Performance if that's a concern.

Manually

If you'd prefer not to override the base JavaScript classes, you can import and invoke these methods manually:

const { array } = require('hibar')
console.log(array.equals([1], [1]))

Polyfill

require('hibar/polyfill')
console.log(Math.clamp(0, 1, 2))

This will monkey-patch the base JavaScript classes. To see the full list of them see ./lib/polyfill.js.

Note: This approach is not reccommended because 1) it makes your code harder To read and 2) it makes your code rely on the polyfill being called before any of your other code is run.

Performance

Note when using the magic _ function, there is a slight performance hit for using functions with colliding names in the library (e.g. compact is both an array and an object function).

If you're doing some intense computation, you should manually import and invoke the method directly (as described in the Manually section).

Development

To publish a new version of the package, install np then run:

np

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.