Giter Site home page Giter Site logo

haystack-units's Introduction

GitHub Workflow Status GitHub

Haystack Unit Database

The unit database for haystack-core.

This project compiles a complete unit database that can be used an application to convert between different numerical units.

Since there are a lot of units (that an application may or may not use), the database is built into this separate library instead of haystack-core.

The database is compiled from Fantom's unit database file units which in turn is based on the unit database from oBIX.

When this module is built, the units database is parsed and compiled into TypeScript. Therefore every unit has its strongly typed with its own name.

In order for units to be successfully used with HNum either the whole unit database just the units the user is interested in must be imported.

Installation

npm install haystack-core haystack-units

APIs

Please click here for the API documentation.

Importing

To import the whole unit database into your application...

import 'haystack-units'

...or...

import units from 'haystack-units'

If you're developing an UI application that uses webpack, you may want to only import the particular units you're interested in. This will employ tree shaking to ensure only the units your application is using is built into your app...

import {second, millisecond} from 'haystack-units'

...
const msNum = secondsNum.convertTo(millisecond)

When using this approach remember to import the units you are intending to convert to (millisecond) and from (second).

Please see HNum and HUnit in haystack-core for more information.

haystack-units's People

Contributors

garethj2 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.