icu-minify 4.9.0 → 4.9.2
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
|
|
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.
|
|
3
|
+
"version": "4.9.2",
|
|
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": "
|
|
58
|
+
"gitHead": "e1b18258075017216165735212568c8f795e1660"
|
|
59
59
|
}
|