Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
  __tests__
  dist
  src
  dist
  Makefile
  README.md
  package.json
  tsconfig.json
  tsconfig.test.json
  tsconfig.typings.json
  tslint.json
Size: Mime:
  README.md

Money

DDD (Domain Driven Design) Entity

one way to handle all types of $ min, max, diff, string, number, array, object, precisions, formatting, types

TODO

  • lowest sale
  • highest reg
  • when it does .find - should find all since there can be maximum 3 (min, max, normal)

Example

// @example concept toString

Money {
  currency: '$',
  type: 'sale',
  digits: 2,
  value: 40.00,
  difference = $ => Math.difference(toNumber(this), toNumber($))
}

Entity.Moneys {
  differenceInPercent = ($1, $2) => $1.difference($2).toPercent()

  // two money Entities
  list = [Money, Money]

  //=> ['Sale', 'Reg']
  types = () => keys(this.prices)

  //=> [Money]
  getPrice = 'sale' => this.find({type: 'sale'})
}