@gooddata/numberjs

JavaScript numbers formatting library using Excel-like formatting strings

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
@gooddata/numberjs
4.0.32 months ago6 years agoMinified + gzip package size for @gooddata/numberjs in KB

Readme

GoodData Number.js
It is a Flexible JS Formatting Library based on the MIT licensed https://code.google.com/p/flexible-js-formatting/ lib of Baron Schwartz.
It is collection of functions for formatting numbers using Excel-like formatting strings.

Usage

var number = require('@gooddata/numberjs');

number.numberFormat(value, format, undefined, this.get('locale').separators);
number.colors2Object(number.numberFormat(value, format, undefined, this.locale.separators));
number.FormatTranslator.translate2default(newFormat, this.separators);
number.FormatTranslator.translate2custom(format, this.COMPONENT.locale.separators);
number.containsNullConditionalFormat(this._getMetricFormat());

Development

Install Node.js and Yarn (for versions, see config).
To bootstrap the environment run the following the repository root:
$ yarn install --frozen-lockfile

Tests are executed using:
$ yarn test

Versioning

NPM package.json version number and RPM package version number are independent. NPM package.json version should reflect changes in code and RPM package version is supplied by build pipeline (gdcversion macro) to ensure smooth integration in GDC build flow.
For bower repository the bower.json version string is to be adjusted to always match the package.json.

RPM build

To build the gdc-numberjs RPM package, execute
$ ./build.sh
LICENCE
Copyright (C) 2007-2014, GoodData(R) Corporation. All rights reserved. Changes by GoodData are not covered by the below license
Copyright (C) 2006 Baron Schwartz
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.