1.8.2 • Published 2 years ago

@sealink/money_beans v1.8.2

Weekly downloads
187
License
MIT
Repository
github
Last release
2 years ago

Money

Create JS money objects from strings, integers or floats

Build Status

Get started

Money = require('money')

new Money()
# returns => Object {cents: 0}

new Money('12.2')
# returns => Object {cents: 1220}

new Money(195)
# returns => Object {cents: 19500}

Render

Money = require('money')
price = new Money(10)

price.format()
# returns = '10.00'

price.render()
# returns => "<span class='money positive'>$10.00</span>"

Operations

Money = require('money')

## Multiply

productPrice = new Money('49.95')
quantity = 3
subTotal = productPrice.multiply(quantity)
# returns => Object {cents: 14985}

## Addition

shipping = new Money('20')
total = subTotal.add(shipping)
# returns => Object {cents: 16985}

## Subtraction

discount = new Money('10')
finalTotal = total.subtract(discount)
# returns => Object {cents: 15985}

Deployment

Build / Deployment is handled via travis CI. Package management is via NPM.

First create the release branch

git branch release/0.3.0

Second Update package.json and specify the version you are releasing

Next Tag and push to github

git tag v0.3.0
git push origin master --tags

Remember to merge changes back to the master branch

1.8.2

2 years ago

1.8.1

3 years ago

1.8.0

3 years ago

1.7.1

3 years ago

1.7.0

3 years ago

1.6.0

4 years ago

1.5.1

5 years ago

1.5.0

5 years ago

1.4.1

5 years ago

1.4.0

5 years ago

1.3.0

5 years ago

1.2.0

7 years ago

1.1.2

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago