Socket
Socket
Sign inDemoInstall

globalize

Package Overview
Dependencies
93
Maintainers
3
Versions
68
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.0-rc.3 to 1.1.0-rc.4

dist/globalize-runtime/unit.js

6

dist/globalize-runtime.js
/**
* Globalize Runtime v1.1.0-rc.3
* Globalize Runtime v1.1.0-rc.4
*

@@ -10,6 +10,6 @@ * http://github.com/jquery/globalize

*
* Date: 2015-10-02T16:26Z
* Date: 2015-10-20T16:52Z
*/
/*!
* Globalize Runtime v1.1.0-rc.3 2015-10-02T16:26Z Released under the MIT license
* Globalize Runtime v1.1.0-rc.4 2015-10-20T16:52Z Released under the MIT license
* http://git.io/TrdQbw

@@ -16,0 +16,0 @@ */

/**
* Globalize Runtime v1.1.0-rc.3
* Globalize Runtime v1.1.0-rc.4
*

@@ -10,6 +10,6 @@ * http://github.com/jquery/globalize

*
* Date: 2015-10-02T16:26Z
* Date: 2015-10-20T16:52Z
*/
/*!
* Globalize Runtime v1.1.0-rc.3 2015-10-02T16:26Z Released under the MIT license
* Globalize Runtime v1.1.0-rc.4 2015-10-20T16:52Z Released under the MIT license
* http://git.io/TrdQbw

@@ -16,0 +16,0 @@ */

/**
* Globalize Runtime v1.1.0-rc.3
* Globalize Runtime v1.1.0-rc.4
*

@@ -10,6 +10,6 @@ * http://github.com/jquery/globalize

*
* Date: 2015-10-02T16:26Z
* Date: 2015-10-20T16:52Z
*/
/*!
* Globalize Runtime v1.1.0-rc.3 2015-10-02T16:26Z Released under the MIT license
* Globalize Runtime v1.1.0-rc.4 2015-10-20T16:52Z Released under the MIT license
* http://git.io/TrdQbw

@@ -16,0 +16,0 @@ */

/**
* Globalize Runtime v1.1.0-rc.3
* Globalize Runtime v1.1.0-rc.4
*

@@ -10,6 +10,6 @@ * http://github.com/jquery/globalize

*
* Date: 2015-10-02T16:26Z
* Date: 2015-10-20T16:52Z
*/
/*!
* Globalize Runtime v1.1.0-rc.3 2015-10-02T16:26Z Released under the MIT license
* Globalize Runtime v1.1.0-rc.4 2015-10-20T16:52Z Released under the MIT license
* http://git.io/TrdQbw

@@ -16,0 +16,0 @@ */

/**
* Globalize Runtime v1.1.0-rc.3
* Globalize Runtime v1.1.0-rc.4
*

@@ -10,6 +10,6 @@ * http://github.com/jquery/globalize

*
* Date: 2015-10-02T16:26Z
* Date: 2015-10-20T16:52Z
*/
/*!
* Globalize Runtime v1.1.0-rc.3 2015-10-02T16:26Z Released under the MIT license
* Globalize Runtime v1.1.0-rc.4 2015-10-20T16:52Z Released under the MIT license
* http://git.io/TrdQbw

@@ -16,0 +16,0 @@ */

/**
* Globalize Runtime v1.1.0-rc.3
* Globalize Runtime v1.1.0-rc.4
*

@@ -10,6 +10,6 @@ * http://github.com/jquery/globalize

*
* Date: 2015-10-02T16:26Z
* Date: 2015-10-20T16:52Z
*/
/*!
* Globalize Runtime v1.1.0-rc.3 2015-10-02T16:26Z Released under the MIT license
* Globalize Runtime v1.1.0-rc.4 2015-10-20T16:52Z Released under the MIT license
* http://git.io/TrdQbw

@@ -16,0 +16,0 @@ */

/**
* Globalize Runtime v1.1.0-rc.3
* Globalize Runtime v1.1.0-rc.4
*

@@ -10,6 +10,6 @@ * http://github.com/jquery/globalize

*
* Date: 2015-10-02T16:26Z
* Date: 2015-10-20T16:52Z
*/
/*!
* Globalize Runtime v1.1.0-rc.3 2015-10-02T16:26Z Released under the MIT license
* Globalize Runtime v1.1.0-rc.4 2015-10-20T16:52Z Released under the MIT license
* http://git.io/TrdQbw

@@ -16,0 +16,0 @@ */

/**
* Globalize v1.1.0-rc.3
* Globalize v1.1.0-rc.4
*

@@ -10,6 +10,6 @@ * http://github.com/jquery/globalize

*
* Date: 2015-10-02T16:26Z
* Date: 2015-10-20T16:52Z
*/
/*!
* Globalize v1.1.0-rc.3 2015-10-02T16:26Z Released under the MIT license
* Globalize v1.1.0-rc.4 2015-10-20T16:52Z Released under the MIT license
* http://git.io/TrdQbw

@@ -16,0 +16,0 @@ */

/*!
* Globalize v1.1.0-rc.3
* Globalize v1.1.0-rc.4
*

@@ -10,3 +10,3 @@ * http://github.com/jquery/globalize

*
* Date: 2015-10-02T16:26Z
* Date: 2015-10-20T16:52Z
*/

@@ -13,0 +13,0 @@ (function( root, factory ) {

/**
* Globalize v1.1.0-rc.3
* Globalize v1.1.0-rc.4
*

@@ -10,6 +10,6 @@ * http://github.com/jquery/globalize

*
* Date: 2015-10-02T16:26Z
* Date: 2015-10-20T16:52Z
*/
/*!
* Globalize v1.1.0-rc.3 2015-10-02T16:26Z Released under the MIT license
* Globalize v1.1.0-rc.4 2015-10-20T16:52Z Released under the MIT license
* http://git.io/TrdQbw

@@ -16,0 +16,0 @@ */

/**
* Globalize v1.1.0-rc.3
* Globalize v1.1.0-rc.4
*

@@ -10,6 +10,6 @@ * http://github.com/jquery/globalize

*
* Date: 2015-10-02T16:26Z
* Date: 2015-10-20T16:52Z
*/
/*!
* Globalize v1.1.0-rc.3 2015-10-02T16:26Z Released under the MIT license
* Globalize v1.1.0-rc.4 2015-10-20T16:52Z Released under the MIT license
* http://git.io/TrdQbw

@@ -2052,3 +2052,4 @@ */

runtimeBind( args, cldr, returnFn, [ messageFormatterRuntimeBind( cldr, formatter ) ] );
runtimeBind( args, cldr, returnFn,
[ messageFormatterRuntimeBind( cldr, formatter ), pluralGenerator ] );

@@ -2055,0 +2056,0 @@ return returnFn;

/**
* Globalize v1.1.0-rc.3
* Globalize v1.1.0-rc.4
*

@@ -10,6 +10,6 @@ * http://github.com/jquery/globalize

*
* Date: 2015-10-02T16:26Z
* Date: 2015-10-20T16:52Z
*/
/*!
* Globalize v1.1.0-rc.3 2015-10-02T16:26Z Released under the MIT license
* Globalize v1.1.0-rc.4 2015-10-20T16:52Z Released under the MIT license
* http://git.io/TrdQbw

@@ -16,0 +16,0 @@ */

/**
* Globalize v1.1.0-rc.3
* Globalize v1.1.0-rc.4
*

@@ -10,6 +10,6 @@ * http://github.com/jquery/globalize

*
* Date: 2015-10-02T16:26Z
* Date: 2015-10-20T16:52Z
*/
/*!
* Globalize v1.1.0-rc.3 2015-10-02T16:26Z Released under the MIT license
* Globalize v1.1.0-rc.4 2015-10-20T16:52Z Released under the MIT license
* http://git.io/TrdQbw

@@ -16,0 +16,0 @@ */

/**
* Globalize v1.1.0-rc.3
* Globalize v1.1.0-rc.4
*

@@ -10,6 +10,6 @@ * http://github.com/jquery/globalize

*
* Date: 2015-10-02T16:26Z
* Date: 2015-10-20T16:52Z
*/
/*!
* Globalize v1.1.0-rc.3 2015-10-02T16:26Z Released under the MIT license
* Globalize v1.1.0-rc.4 2015-10-20T16:52Z Released under the MIT license
* http://git.io/TrdQbw

@@ -16,0 +16,0 @@ */

/*!
* Globalize v1.1.0-rc.3
* Globalize v1.1.0-rc.4
*

@@ -10,3 +10,3 @@ * http://github.com/jquery/globalize

*
* Date: 2015-10-02T16:26Z
* Date: 2015-10-20T16:52Z
*/

@@ -28,1 +28,2 @@

require( "./globalize/relative-time" );
require( "./globalize/unit" );

@@ -48,4 +48,6 @@ ## .numberFormatter( [options] ) ➜ function( value )

### Example
### Examples
#### Static Formatter
Prior to using any number methods, you must load

@@ -70,2 +72,4 @@ `cldr/main/{locale}/numbers.json` and `cldr/supplemental/numberingSystems.json`.

#### Instance Formatter
You can use the instance method `.numberFormatter()`, which uses the instance

@@ -89,4 +93,6 @@ locale.

Controlling digits by specifying integer and fraction digits counts:
#### Configuring decimal places
The number of decimal places can be decreased or increased using `minimumFractionDigits` and `maximumFractionDigits`.
```javascript

@@ -100,4 +106,6 @@ Globalize.numberFormatter({ maximumFractionDigits: 2 })( 3.141592 );

Controlling digits by specifying significant digits counts:
#### Configuring significant digits
The number of significant (non-zero) digits can be decreased or increased using `minimumSignificantDigits` and `maximumSignificantDigits`.
```javascript

@@ -129,5 +137,34 @@ var formatter = Globalize.numberFormatter({

Using different rounding functions example:
#### Formatting Percentages
Numbers can be formatted as percentages.
```javascript
var enFormatter = Globalize( "en" ).numberFormatter({
style: "percent",
minimumFractionDigits: 1,
maximumFractionDigits: 1
});
var frFormatter = Globalize( "fr" ).numberFormatter({
style: "percent",
minimumFractionDigits: 2,
maximumFractionDigits: 2
});
enFormatter( 0.0016 );
// > "0.2%"
enFormatter( 0.0014 );
// > "0.1%"
frFormatter( 0.0005 );
// > "0,05 %"
```
#### Configuring Rounding
Numbers with a decreased amount of decimal places can be rounded up, rounded down, rounded arithmetically, or truncated by setting the `round` option to `ceil`, `floor`, `round` (default), or `truncate`.
```javascript
var formatter = Globalize.numberFormatter({

@@ -142,5 +179,6 @@ maximumFractionDigits: 2,

For improved performance on iterations, first create the formatter. Then, reuse
it on each loop.
#### Performance Suggestions
For improved performance on iterations, the formatter should be created before the loop. Then, it can be reused in each iteration.
```javascript

@@ -147,0 +185,0 @@ var numbers = [ 1, 1, 2, 3, ... ];

{
"name": "globalize",
"version": "1.1.0-rc.3",
"version": "1.1.0-rc.4",
"description": "A JavaScript library for internationalization and localization that leverage the official Unicode CLDR JSON data.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -34,2 +34,3 @@ # Globalize

- [Relative time module](#relative-time-module)
- [Unit module](#unit-module)
- more to come...

@@ -152,2 +153,3 @@ - [Error reference](#error-reference)

| globalize/relative-time.js | 0.8KB | 0.6KB | [Relative time module](#relative-time-module) provides relative time formatting support |
| globalize/unit.js | 0.9KB | 0.5KB | [Unit module](#unit-module) provides unit formatting support |

@@ -218,4 +220,5 @@ ### Browser Support

| Relative time module | cldr/main/`locale`/dateFields.json<br>+CLDR JSON files from number and plural modules |
| Unit module | cldr/main/`locale`/units.json<br>+CLDR JSON files from number and plural module |
As an alternative to deducing this yourself, use this [online tool](http://johnnyreilly.github.io/globalize-so-what-cha-want/). The tool allows you to select the modules you're interested in using and tells you the Globalize files *and* CLDR JSON that you need.
As an alternative to deducing this yourself, use this [online tool](http://johnnyreilly.github.io/globalize-so-what-cha-want/). The tool allows you to select the modules you're interested in using and tells you the Globalize files *and* CLDR JSON that you need.

@@ -577,3 +580,26 @@ *(b) How am I supposed to get and load CLDR content?*

## Unit module
- **`.unitFormatter( unit, options )`**
Returns a function that formats a unit according to the given unit, options, and the
default/instance locale.
```javascript
.unitFormatter( "second" )( 10 )
// > "10 seconds"
.unitFormatter( "second", { form: "short" } )( 10 )
// > "10 secs"
.unitFormatter( "second", { form: "narrow" } )( 10 )
// > "10s"
```
[Read more...](doc/api/unit/unit-formatter.md)
- **`.formatUnit( value, unit, options )`**
Alias for `.unitFormatter( unit, options )( value )`.
## Error reference

@@ -670,2 +696,4 @@

│ ├── relative-time/ (relative time source code)
│ ├── unit.js (unit module)
│ ├── unit/ (unit source code)
│ └── util/ (basic JavaScript helpers polyfills, eg array.map)

@@ -735,2 +763,1 @@ └── test/ (unit and functional test files)

```
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc