New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@ordergroove/smi-precompile

Package Overview
Dependencies
Maintainers
33
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ordergroove/smi-precompile - npm Package Compare versions

Comparing version 1.1.4 to 1.1.5

34

__tests__/precompile.spec.js

@@ -182,2 +182,36 @@ /* eslint-disable no-template-curly-in-string */

});
test('should compile currency filter with default values if empty currency settings are set', () => {
const newLocal = ` {{ 123456.789 | currency }} `;
const result = precompile(newLocal, {}, [
{
locale: 'it',
translations: {
currency_code: '',
currency_display: ''
}
}
]);
expect(result).toContain('function template_it(');
expect(result).toContain('"it": template_it');
expect(result).toContain('${_F.currency(123456.789, undefined, undefined)}');
});
test('should compile currency filter with default values if invalid currency settings are set', () => {
const newLocal = ` {{ 123456.789 | currency }} `;
const result = precompile(newLocal, {}, [
{
locale: 'it',
translations: {
currency_code: 'NOTREAL',
currency_display: 'NOTREAL'
}
}
]);
expect(result).toContain('function template_it(');
expect(result).toContain('"it": template_it');
expect(result).toContain('${_F.currency(123456.789, undefined, undefined)}');
});
});

@@ -184,0 +218,0 @@

@@ -6,2 +6,13 @@ # Change Log

## [1.1.5](https://github.com/ordergroove/plush-toys/compare/@ordergroove/smi-precompile@1.1.4...@ordergroove/smi-precompile@1.1.5) (2021-05-03)
### Bug Fixes
* if an invalid currency code or currency display is given, use undefined instead ([2a97791](https://github.com/ordergroove/plush-toys/commit/2a97791709fef51531fe2bfe7995df473276c33a))
## [1.1.4](https://github.com/ordergroove/plush-toys/compare/@ordergroove/smi-precompile@1.1.3...@ordergroove/smi-precompile@1.1.4) (2021-04-30)

@@ -8,0 +19,0 @@

4

package.json
{
"name": "@ordergroove/smi-precompile",
"version": "1.1.4",
"version": "1.1.5",
"description": "Prcompilers for smi-core",

@@ -31,3 +31,3 @@ "author": "Brian Lewis <brian.lewis@ordergroove.com>",

},
"gitHead": "5162b3dcf5e212b7a3b5fa4e055a6060557a5f93"
"gitHead": "b17826c74ac8e1cc84f1564fa47672ff234e8cfe"
}

@@ -12,2 +12,3 @@ /* eslint-disable no-shadow */

const replaceLiteralValuesInTemplate = require('./optimize');
const i18nCurrency = require('../i18n-data/i18n_currency_data.json');

@@ -76,2 +77,4 @@ const filenameWithoutExt = (content, file) => {

const localizedTeamplates = [];
const validCurrencies = new Set(Object.values(i18nCurrency));
const validCurrencyDisplays = new Set(['symbol', 'narrowSymbol', 'code', 'name']);

@@ -122,6 +125,10 @@ if (!locales.length) {

path.node.arguments.push(
'currency_code' in locales ? t.stringLiteral(locales['currency_code']) : t.identifier('undefined')
validCurrencies.has(locales['currency_code'])
? t.stringLiteral(locales['currency_code'])
: t.identifier('undefined')
);
path.node.arguments.push(
'currency_display' in locales ? t.stringLiteral(locales['currency_display']) : t.identifier('undefined')
validCurrencyDisplays.has(locales['currency_display'])
? t.stringLiteral(locales['currency_display'])
: t.identifier('undefined')
);

@@ -128,0 +135,0 @@ }

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