nashdot / accounting-js Goto Github PK
View Code? Open in Web Editor NEWNumber, money and currency formatting library
Home Page: https://nashdot.github.io/accounting-js
Number, money and currency formatting library
Home Page: https://nashdot.github.io/accounting-js
Not really responsibility of this lib to maintain them
i am upgrading my vue 2 project to vue3. But it gives error in Money.vue.
ERROR "default" is not exported by "node_modules/accounting-js/dist/accounting.es6.js", imported by "node_modules/@enso-ui/money/src/Money.vue".
can anyone gives me solution
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...
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)
Is this project available to install via Bower? Doing bower accounting-js
installs the original version. Thank you.
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
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.