usd

1.0.3 • Public • Published

USD

AMD/CommonJS Stampit factory for creating models to handle USD logic

Install

npm install usd

Usage

var usd = require('usd');
var $price = usd().pennies(150);
 
console.log( $price.dollars() ); // => 1.50

Docs

Methods

.pennies() -> Number

Returns the value in pennies

.pennies( val ) -> this

Sets the value via pennies

.dollars() -> String

Returns the value in dollars

.dollars( val ) -> this

Sets the value via dollars

Static

.decimalAdjust( type, value, exp ) -> Number

Decimal adjustment of a number

Arguments

  • type - The type of adjustment
  • value - The value
  • exp - The exponent (the 10 logarithm of the adjustment base)

License

MIT

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.3
    2
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.3
    2
  • 1.0.2
    1
  • 1.0.1
    1

Package Sidebar

Install

npm i usd

Weekly Downloads

4

Version

1.0.3

License

ISC

Last publish

Collaborators

  • johndotawesome