JSPM

  • Created
  • Published
  • Downloads 44662
  • Score
    100M100P100Q133258F
  • License MIT

Package Exports

  • convert

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (convert) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Convert

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

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

Features

  • Full build time and runtime checks of conversions
  • Treeshake-able builds available
  • Out of the box ES3 backwards-compatibility
  • 0 dependencies

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 @TheAkio, @iCrawl, @p7g, and @aequasi for their help in getting the typesafety working.