@tecfu/is-multiple-of
v1.0.2
Published
Floating point modulus for javascript.
Downloads
2
Readme
is-multiple-of
Floating point modulus operator functionality for javascript. Accurate to 16 digits and 6 decimal places.
Rationale
- javascript can't divide floats accurately: i.e. 4.55 / .05 === 90.999999
4.55 % .05 === 0 // false
whereas:
multipleOf(4.55, .05) // true
Installation
- Node Module
$ npm install @tecfu/is-multiple-of
- Browser
import multipleOf from 'https://cdn.jsdelivr.net/gh/tecfu/is-multiple-of/dist/is-multiple-of.esm.js'
let multipleOf = require('is-multiple-of') // https://cdn.jsdelivr.net/gh/tecfu/is-multiple-of/dist/is-multiple-of.cjs.js
let multipleOf = IsMultipleOf; // https://cdn.jsdelivr.net/gh/tecfu/is-multiple-of/dist/is-multiple-of.umd.js
Version Compatibility
| Node Version | multipleOf Version | | -------------- | ------------------| | 8.0 | >= 1.0 |
Running tests
$ npm test
Pull Requests
Pull requests are encouraged!
- Please remember to add a unit test when necessary
- Please format your commit messages according to the "Conventional Commits" specification
If you aren't familiar with Conventional Commits, here's a good article on the topic
TL/DR:
- feat: a feature that is visible for end users.
- fix: a bugfix that is visible for end users.
- chore: a change that doesn't impact end users (e.g. chances to CI pipeline)
- docs: a change in the README or documentation
- refactor: a change in production code focused on readability, style and/or performance.
License
Copyright 2020, Tecfu.