Installation
Calculate is designed to be easily installed and used in your project. Just follow these simple steps below.
Prerequisites
-
Ensure you have the latest version of Node installed. We also recommend you install Yarn as well.
Node >= 8.x and Yarn >= 1.5.
-
Create a project, if none exists, and change your directory to this project's root.
Installing Calculate
This package is available through the npm registry. To install calculate, on the command line, run:
NPM
$ npm -i @princedev/calculate
Yarn
$ yarn add @princedev/calculate
This will create the node_modules
directory in your current directory (if one doesn’t exist yet) and will download the package to that directory.
If there is no
package.json
file in the local directory, the latest version of the package is installed. If there is apackage.json
file, npm installs the latest version that satisfies the semver rule declared inpackage.json
.
Import
Start using the library by importing it:
CommonJS
const calculate = require('@princedev/calculate');
ES6
import { sum, difference } from '@princedev/calculate';
By now, you should be able to use calculate.