Giter Club home page Giter Club logo

accounting-js's People

Contributors

ignocide avatar isogram avatar stah avatar teameh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

accounting-js's Issues

NPM error when trying to install

When I try to:

npm install accounting-js

I get the following error:

npm ERR! Cannot read property '0' of undefined

Really hope someone can help...

Unexpected token import

I am getting an unexpected token import on the following line in formatMoney.js

import objectAssign from 'object-assign';

My code:

import formatMoney from 'accounting-js/lib/formatMoney.js'

formatMoney(123123123)

Bower support

Is this project available to install via Bower? Doing bower accounting-js installs the original version. Thank you.

Incompatible api with accounting.js

Same as original accounting.js, but ..

Not 100%, The settings api is different.

The docs here say you could set this different defaults in accounting.settings.currency if you like. This is a bit confusing as the api for setting these defaults in this package is different.

Accounting.js:

accounting.settings = {
    currency: {
        symbol : "$",   // default currency symbol is '$'
        format: "%s%v", // controls output: %s = symbol, %v = value/number (can be object: see below)
        decimal : ".",  // decimal point separator
        thousand: ",",  // thousands separator
        precision : 2   // decimal places
    },
    number: {
        precision : 0,  // default precision on numbers is 0
        thousand: ",",
        decimal : "."
    }
}

vs this package:

accounting.settings = {
  symbol: '$',        // default currency symbol is '$'
  format: '%s%v',     // controls output: %s = symbol, %v = value (can be object, see docs)
  decimal: '.',       // decimal point separator
  thousand: ',',      // thousands separator
  precision: 2,       // decimal places
  grouping: 3,        // digit grouping (not implemented yet)
  stripZeros: false,  // strip insignificant zeros from decimal part
  fallback: 0         // value returned on unformat() failure
};

I've also found that setting the whole settings object at once does not work.. see #7

UglifyJS throws exception

When including the formatNumber function in a production optimized webpack build, UglifyJs throws an error.

// webpack.config.js

const CompressionPlugin = require("compression-webpack-plugin");
const webpack = require('webpack');

module.exports = {
  entry: [
    './node_modules/accounting-js/lib/formatNumber'
  ],
  output: {
    filename: '[name].js'
  },
  module: {
    rules: [
      {
        test: /\.js$/,
        loader: "babel-loader",
        exclude: /node_modules/
      }
    ]
  },
  plugins: [
    new CompressionPlugin({
      asset: "[path].gz[query]",
      algorithm: "gzip",
      test: /\.js$/
    })
  ]
};
> webpack -p --display verbose

Hash: 7b5a7e38df52dd5294ee
Version: webpack 3.0.0
Time: 126ms
     Asset     Size  Chunks             Chunk Names
   main.js  10.3 kB       0  [emitted]  main
main.js.gz  3.26 kB          [emitted]  
Entrypoint main = main.js
chunk    {0} main.js (main) 6.13 kB [entry] [rendered]
    > main [1] multi ./node_modules/accounting-js/lib/formatNumber 
    [0] ./node_modules/accounting-js/lib/settings.js 648 bytes {0} [depth 2] [built]
        [exports: default]
        [only some exports used: default]
        harmony import ./settings [2] ./node_modules/accounting-js/lib/formatNumber.js 4:0-34
        harmony import ./settings [5] ./node_modules/accounting-js/lib/toFixed.js 2:0-34
    [1] multi ./node_modules/accounting-js/lib/formatNumber 28 bytes {0} [depth 0] [built]
    [2] ./node_modules/accounting-js/lib/formatNumber.js 1.73 kB {0} [depth 1] [built]
        [exports: default]
        single entry ./node_modules/accounting-js/lib/formatNumber [1] multi ./node_modules/accounting-js/lib/formatNumber main:100000
    [3] ./node_modules/object-assign/index.js 2.11 kB {0} [depth 2] [built]
        [only some exports used: default]
        harmony import object-assign [2] ./node_modules/accounting-js/lib/formatNumber.js 1:0-41
    [4] ./node_modules/accounting-js/lib/internal/stripInsignificantZeros.js 322 bytes {0} [depth 2] [built]
        [exports: default]
        [only some exports used: default]
        harmony import ./internal/stripInsignificantZeros [2] ./node_modules/accounting-js/lib/formatNumber.js 3:0-74
    [5] ./node_modules/accounting-js/lib/toFixed.js 1.06 kB {0} [depth 2] [built]
        [exports: default]
        [only some exports used: default]
        harmony import ./toFixed [2] ./node_modules/accounting-js/lib/formatNumber.js 5:0-32
    [6] ./node_modules/accounting-js/lib/internal/checkPrecision.js 223 bytes {0} [depth 3] [built]
        [exports: default]
        [only some exports used: default]
        harmony import ./internal/checkPrecision [5] ./node_modules/accounting-js/lib/toFixed.js 1:0-56

ERROR in main.js from UglifyJs
Unexpected token operator «=», expected punc «,» [main.js:131,35]
npm ERR! code ELIFECYCLE
npm ERR! errno 2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.