GithubHelp home page GithubHelp logo

microdroid / convert Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jonahsnider/convert

0.0 1.0 0.0 387 KB

A small library for fully type-safe unit conversions in JavaScript & TypeScript.

Home Page: https://www.npmjs.com/package/convert

License: MIT License

TypeScript 95.87% JavaScript 4.13%

convert's Introduction

Convert

A small library for really easy, totally type-safe unit conversions in JavaScript & TypeScript.

bundlephobia

It's not ready for production release*, but all the groundwork for adding in new conversions is done.

* Some conversions are just totally wrong. Please don't use this (yet).

yarn add convert
# or
npm install convert

Features

  • Full build time and runtime checks of conversions
  • Treeshake-able builds available
  • 0 dependencies
  • Out of the box ES5 backwards-compatibility
  • Works in browsers and Node.js

Usage

import {convert} from 'convert';

// 360 seconds into minutes
convert(360)
	.from('seconds')
	.to('minutes'); // 6

Contributing

Below is a list of commands you will probably find useful.

yarn start

Runs the project in development/watch mode. Your project will be rebuilt upon changes. TSDX has a special logger for you convenience. Error messages are pretty printed and formatted for compatibility VS Code's Problems tab.

Your library will be rebuilt if you make edits.

yarn build

Bundles the package to the dist folder. The package is optimized and bundled with Rollup into multiple formats (CommonJS, UMD, and ES Module).

yarn test

Runs the test watcher (Jest) in an interactive mode. By default, runs tests related to files changed since the last commit.

Thanks

Big thanks to @Jdender, @TheAkio, @iCrawl, @p7g, @aequasi, and the TypeScript Discord server for their help in getting the typesafety working.

convert's People

Contributors

jonahsnider avatar renovate[bot] avatar

Watchers

 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.