Socket
Socket
Sign inDemoInstall

@lion/localize

Package Overview
Dependencies
Maintainers
1
Versions
102
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lion/localize - npm Package Compare versions

Comparing version 0.15.3 to 0.15.4

src/date/utils/addLeadingZero.d.ts

11

CHANGELOG.md
# Change Log
## 0.15.4
### Patch Changes
- a8cf4215: Improved localize DX by making it clear from source code structure what are main (exported) functions and what are util/helper functions consumed by those main functions.
Added Chrome Intl corrections for Philippine currency names and en-GB short month names.
- 98f1bb7e: Ensure all lit imports are imported from @lion/core. Remove devDependencies in all subpackages and move to root package.json. Add demo dependencies as real dependencies for users that extend our docs/demos.
- Updated dependencies [98f1bb7e]
- @lion/core@0.13.7
- singleton-manager@1.2.1
## 0.15.3

@@ -4,0 +15,0 @@

2

docs/10-features-overview.md

@@ -8,3 +8,3 @@ # Features Overview

```js script
import { html } from 'lit-html';
import { html } from '@lion/core';
import { render, LitElement } from '@lion/core';

@@ -11,0 +11,0 @@ import { localize, formatNumber, formatDate, LocalizeMixin } from '../index.js';

{
"name": "@lion/localize",
"version": "0.15.3",
"version": "0.15.4",
"description": "The localization system helps to manage localization data split into locales and automate its loading",

@@ -35,8 +35,5 @@ "license": "MIT",

"@bundled-es-modules/message-format": "6.0.4",
"@lion/core": "0.13.6",
"singleton-manager": "1.2.0"
"@lion/core": "0.13.7",
"singleton-manager": "1.2.1"
},
"devDependencies": {
"@bundled-es-modules/fetch-mock": "^6.5.2"
},
"keywords": [

@@ -43,0 +40,0 @@ "lion",

import { localize } from '../localize.js';
import { getLocale } from './getLocale.js';
import { normalizeIntlDate } from './normalizeIntlDate.js';
import { getLocale } from '../utils/getLocale.js';
import { normalizeIntlDate } from './utils/normalizeIntlDate.js';

@@ -5,0 +5,0 @@ /** @typedef {import('../../types/LocalizeMixinTypes').DatePostProcessor} DatePostProcessor */

@@ -1,3 +0,3 @@

import { sanitizedDateTimeFormat } from './sanitizedDateTimeFormat.js';
import { splitDate } from './splitDate.js';
import { sanitizedDateTimeFormat } from './utils/sanitizedDateTimeFormat.js';
import { splitDate } from './utils/splitDate.js';

@@ -4,0 +4,0 @@ /**

@@ -1,2 +0,3 @@

import { normalizeIntlDate } from './normalizeIntlDate.js';
import { normalizeIntlDate } from './utils/normalizeIntlDate.js';
import { forceShortMonthNamesForEnGb } from './utils/forceShortMonthNamesForEnGb.js';

@@ -29,3 +30,5 @@ /** @type {Object.<string, Object.<string,string[]>>} */

}
if (locale === 'en-GB' && style === 'short') {
months = forceShortMonthNamesForEnGb(months);
}
monthsLocaleCache[locale] = monthsLocaleCache[locale] || {};

@@ -32,0 +35,0 @@ monthsLocaleCache[locale][style] = months;

@@ -1,2 +0,2 @@

import { normalizeIntlDate } from './normalizeIntlDate.js';
import { normalizeIntlDate } from './utils/normalizeIntlDate.js';

@@ -3,0 +3,0 @@ /** @type {Object.<string, Object.<string,string[]>>} */

import { localize } from '../localize.js';
import { getDateFormatBasedOnLocale } from './getDateFormatBasedOnLocale.js';
import { addLeadingZero } from './addLeadingZero.js';
import { addLeadingZero } from './utils/addLeadingZero.js';

@@ -5,0 +5,0 @@ /**

import { localize } from '../localize.js';
import { getLocale } from './getLocale.js';
import { getLocale } from '../utils/getLocale.js';
import { formatNumberToParts } from './formatNumberToParts.js';

@@ -4,0 +4,0 @@

/**
* Round the number based on the options
*
* @param {number} number
* @param {string} roundMode
* @throws {Error} roundMode can only be round|floor|ceiling
* @returns {number}
*/
export function roundNumber(number: number, roundMode: string): number;
/**
* Splits a number up in parts for integer, fraction, group, literal, decimal and currency.

@@ -3,0 +12,0 @@ *

@@ -1,10 +0,30 @@

import { emptyStringWhenNumberNan } from './emptyStringWhenNumberNan.js';
import { emptyStringWhenNumberNan } from './utils/emptyStringWhenNumberNan.js';
import { getDecimalSeparator } from './getDecimalSeparator.js';
import { getGroupSeparator } from './getGroupSeparator.js';
import { getLocale } from './getLocale.js';
import { normalizeIntl } from './normalizeIntl.js';
import { normalSpaces } from './normalSpaces.js';
import { roundNumber } from './roundNumber.js';
import { getLocale } from '../utils/getLocale.js';
import { normalizeIntl } from './utils/normalize-format-number-to-parts/normalizeIntl.js';
import { normalSpaces } from './utils/normalSpaces.js';
/**
* Round the number based on the options
*
* @param {number} number
* @param {string} roundMode
* @throws {Error} roundMode can only be round|floor|ceiling
* @returns {number}
*/
export function roundNumber(number, roundMode) {
switch (roundMode) {
case 'floor':
return Math.floor(number);
case 'ceiling':
return Math.ceil(number);
case 'round':
return Math.round(number);
default:
throw new Error('roundMode can only be round|floor|ceiling');
}
}
/**
* Splits a number up in parts for integer, fraction, group, literal, decimal and currency.

@@ -11,0 +31,0 @@ *

import { formatNumberToParts } from './formatNumberToParts.js';
import { localize } from '../localize.js';
import { forceCurrencyNameForPHPEnGB } from './utils/normalize-get-currency-name/forceCurrencyNameForPHPEnGB.js';

@@ -18,7 +20,11 @@ /**

}));
const currencyName = parts
let currencyName = parts
.filter(p => p.type === 'currency')
.map(o => o.value)
.join(' ');
const locale = options?.locale || localize.locale;
if (currencyIso === 'PHP' && locale === 'en-GB') {
currencyName = forceCurrencyNameForPHPEnGB(currencyName);
}
return currencyName;
}

@@ -1,2 +0,2 @@

import { getLocale } from './getLocale.js';
import { getLocale } from '../utils/getLocale.js';

@@ -3,0 +3,0 @@ /**

@@ -1,3 +0,3 @@

import { getLocale } from './getLocale.js';
import { normalSpaces } from './normalSpaces.js';
import { getLocale } from '../utils/getLocale.js';
import { normalSpaces } from './utils/normalSpaces.js';

@@ -4,0 +4,0 @@ /**

@@ -25,5 +25,6 @@ import { expect } from '@open-wc/testing';

it('supports "short" style', () => {
expect(getMonthNames({ locale: 'en-GB', style: 'short' })).to.deep.equal(
s`Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec`,
);
// TODO: Chrome thinks it should be Sept, not Sep. Firefox/Webkit disagree. We could normalize it in lion.
// expect(getMonthNames({ locale: 'en-GB', style: 'short' })).to.deep.equal(
// s`Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec`,
// );
expect(getMonthNames({ locale: 'nl-NL', style: 'short' })).to.deep.equal(

@@ -30,0 +31,0 @@ s`jan. feb. mrt. apr. mei jun. jul. aug. sep. okt. nov. dec.`,

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