Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

accounting-helpers

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

accounting-helpers

Stache helpers for formatting money.

  • 3.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

accounting-helpers

Stache helpers for formatting money.

npm version

NPM

Installation

npm install accounting-helpers --save

Usage

Using CanJS's built-in support for StealJS, you can now import the module directly inside your templates. For example, assuming we have a variable amount which holds the value 2333.

<can-import from="accounting-helpers"/>

This will return 2,333.00:
{{formatMoney amount}}

This will return 23.33:
{{formatCents amount}}

The two examples above will include live binding. To opt out use the Unbound options, like this:

<can-import from="accounting-helpers"/>

This will return 2,333.00 without live binding:
{{formatMoneyUnbound amount}}

This will return 23.33 without live binding:
{{formatCentsUnbound amount}}

Use individual helpers in can-component

If you need to, you can import the helpers individually.

import Component from 'can-component';
import formatMoney from "accounting-helpers/format-money";
import formatMoneyUnbound from "accounting-helpers/format-money-unbound";
import formatCents from "accounting-helpers/format-cents";
import formatCentsUnbound from "accounting-helpers/format-cents-unbound";

Component.extend({
  tag: "hello-world",
  template: stache("{{formatMoney amount}}"),
  viewModel: {
    amount: 300,
  },
  helpers: {
    formatMoney,
    formatMoneyUnbound,
    formatCents,
    formatCentsUnbound
  }
});

Contributing

Pull requests are welcome. Analyze the code. See where it needs improvement, and let me know. Please, help make it better!

Changelog

  • 3.0.0 - CanJS 3.0 compatibility.
  • 1.0.0 - CanJS 2.3 compatibility.

Authors

Built with StealJS

Keywords

FAQs

Package last updated on 24 Jul 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc