95
async-math
source link: https://www.npmjs.com/package/async-math
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
async-math
Promises based async math operations.
Introduction
Stop writing archaic, boring code.
Why use native operators when you can use an npm package?
Why do synchronous arithmetic when you can do so asynchronously?
Why get guaranteed results when you can get the promise of one?
Usage
Adding two numbers
const { add } = require("async-math")
add(8, 4).then(function(sum) { console.log(sum) })
Console output should be 12
Subtracting a number from another
const { subtract } = require("async-math")
subtract(8, 4).then(function(difference) { console.log(difference) })
Console output should be 4
Multiplying two numbers
const { multiply } = require("async-math")
multiply(8, 4).then(function(product) { console.log(product) })
Console output should be 32
Divide a number from another
const { divide } = require("async-math")
divide(8, 4).then(function(quotient) { console.log(quotient) })
Console output should be 2
License
async-math
is released under the MIT License
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK