icu-minify 4.9.1 → 4.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -114,7 +114,7 @@ function compileDateTimeStyle(style) {
114
114
  return undefined;
115
115
  }
116
116
  function compileSelect(node) {
117
- const options = {};
117
+ const options = Object.create(null);
118
118
  for (const [key, option] of Object.entries(node.options)) {
119
119
  options[key] = compileNodesToNode(option.value);
120
120
  }
@@ -126,7 +126,7 @@ function compilePlural(node) {
126
126
  if (node.offset) {
127
127
  throw new Error('Plural offsets are not supported');
128
128
  }
129
- const options = {};
129
+ const options = Object.create(null);
130
130
  for (const [key, option] of Object.entries(node.options)) {
131
131
  options[key] = compileNodesToNode(option.value);
132
132
  }
@@ -1 +1 @@
1
- import{parse as t,TYPE as n}from"@formatjs/icu-messageformat-parser";import{T as e,a as r,b as s,c as o,d as u,e as i,f as c}from"./types-DqTLNw7x.js";function a(n){const e=f(t(n));return 0===e.length?"":1===e.length&&"string"==typeof e[0]?e[0]:e}function f(t){const n=[];for(const e of t){const t=p(e);"string"==typeof t&&n.length>0&&"string"==typeof n[n.length-1]?n[n.length-1]+=t:n.push(t)}return n}function l(t){const n=f(t);if(0===n.length)return"";if(1===n.length){const t=n[0];if("string"==typeof t||t===e)return t}return n}function p(t){switch(t.type){case n.literal:return t.value;case n.argument:return[t.value];case n.number:return function(t){const n=[t.value,r],e=function(t){if(!t)return;if("string"==typeof t)return t;if("parsedOptions"in t){const n=t.parsedOptions;return Object.keys(n).length>0?n:void 0}return}(t.style);void 0!==e&&n.push(e);return n}(t);case n.date:return function(t){const n=[t.value,s],e=g(t.style);void 0!==e&&n.push(e);return n}(t);case n.time:return function(t){const n=[t.value,o],e=g(t.style);void 0!==e&&n.push(e);return n}(t);case n.select:return function(t){const n={};for(const[e,r]of Object.entries(t.options))n[e]=l(r.value);return[t.value,u,n]}(t);case n.plural:return function(t){const n={};for(const[e,r]of Object.entries(t.options))n[e]=l(r.value);return[t.value,"ordinal"===t.pluralType?i:c,n]}(t);case n.pound:return e;case n.tag:return function(t){const n=f(t.children),e=[t.value];0===n.length?e.push(""):e.push(...n);return e}(t);default:throw new Error(`Unknown AST node type: ${t.type}`)}}function g(t){if(t){if("string"==typeof t)return t;if("parsedOptions"in t){const n=t.parsedOptions;return Object.keys(n).length>0?n:void 0}}}export{a as default};
1
+ import{parse as t,TYPE as e}from"@formatjs/icu-messageformat-parser";import{T as n,a as r,b as s,c as o,d as u,e as c,f as i}from"./types-DqTLNw7x.js";function a(e){const n=f(t(e));return 0===n.length?"":1===n.length&&"string"==typeof n[0]?n[0]:n}function f(t){const e=[];for(const n of t){const t=p(n);"string"==typeof t&&e.length>0&&"string"==typeof e[e.length-1]?e[e.length-1]+=t:e.push(t)}return e}function l(t){const e=f(t);if(0===e.length)return"";if(1===e.length){const t=e[0];if("string"==typeof t||t===n)return t}return e}function p(t){switch(t.type){case e.literal:return t.value;case e.argument:return[t.value];case e.number:return function(t){const e=[t.value,r],n=function(t){if(!t)return;if("string"==typeof t)return t;if("parsedOptions"in t){const e=t.parsedOptions;return Object.keys(e).length>0?e:void 0}return}(t.style);void 0!==n&&e.push(n);return e}(t);case e.date:return function(t){const e=[t.value,s],n=g(t.style);void 0!==n&&e.push(n);return e}(t);case e.time:return function(t){const e=[t.value,o],n=g(t.style);void 0!==n&&e.push(n);return e}(t);case e.select:return function(t){const e=Object.create(null);for(const[n,r]of Object.entries(t.options))e[n]=l(r.value);return[t.value,u,e]}(t);case e.plural:return function(t){const e=Object.create(null);for(const[n,r]of Object.entries(t.options))e[n]=l(r.value);return[t.value,"ordinal"===t.pluralType?c:i,e]}(t);case e.pound:return n;case e.tag:return function(t){const e=f(t.children),n=[t.value];0===e.length?n.push(""):n.push(...e);return n}(t);default:throw new Error(`Unknown AST node type: ${t.type}`)}}function g(t){if(t){if("string"==typeof t)return t;if("parsedOptions"in t){const e=t.parsedOptions;return Object.keys(e).length>0?e:void 0}}}export{a as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "icu-minify",
3
- "version": "4.9.1",
3
+ "version": "4.10.0",
4
4
  "sideEffects": false,
5
5
  "author": "Jan Amann <jan@amann.work>",
6
6
  "funding": [
@@ -55,5 +55,5 @@
55
55
  "dependencies": {
56
56
  "@formatjs/icu-messageformat-parser": "^3.4.0"
57
57
  },
58
- "gitHead": "b4aa5380c50ad59a80d1dfdbc229590a4e0133a3"
58
+ "gitHead": "d4648b884c609400b53da58ab0def5feb22ab654"
59
59
  }