@valkyriestudios/utils 12.25.0 → 12.25.1
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.
- package/date/format.js +11 -9
- package/package.json +1 -1
package/date/format.js
CHANGED
|
@@ -171,7 +171,7 @@ function getSpecChain(spec) {
|
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
173
|
const chain_len = chain.length;
|
|
174
|
-
const result = chain_len ? { base, chain, chain_len, repl
|
|
174
|
+
const result = chain_len ? { base, chain, chain_len, repl } : null;
|
|
175
175
|
spec_cache[spec] = result;
|
|
176
176
|
return result;
|
|
177
177
|
}
|
|
@@ -190,15 +190,17 @@ function format(val, spec, locale = DEFAULT_LOCALE, zone = DEFAULT_TZ, sow = DEF
|
|
|
190
190
|
return n_val.toISOString();
|
|
191
191
|
const d = toZone(n_val, zone);
|
|
192
192
|
let base = n_spec.base;
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
const
|
|
193
|
+
const repl = [...n_spec.repl];
|
|
194
|
+
let repl_len = n_spec.repl.length;
|
|
195
|
+
for (let i = 0; i < n_spec.chain_len; i++) {
|
|
196
|
+
const el = n_spec.chain[i];
|
|
197
|
+
let pos = base.indexOf(el[0]);
|
|
198
|
+
const token_val = el[1](d, locale, sow);
|
|
197
199
|
while (pos !== -1) {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
pos = base.indexOf(
|
|
200
|
+
const key = '$' + repl_len++ + '$';
|
|
201
|
+
repl.push([key, token_val]);
|
|
202
|
+
base = base.slice(0, pos) + key + base.slice(pos + el[2]);
|
|
203
|
+
pos = base.indexOf(el[0], pos + el[2]);
|
|
202
204
|
}
|
|
203
205
|
}
|
|
204
206
|
for (let i = 0; i < repl_len; i++) {
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{ "name": "@valkyriestudios/utils", "version": "12.25.
|
|
1
|
+
{ "name": "@valkyriestudios/utils", "version": "12.25.1", "description": "A collection of single-function utilities for common tasks", "author": { "name": "Peter Vermeulen", "url": "https://www.linkedin.com/in/petervermeulen1/" }, "keywords": [ "utility", "library", "javascript", "js", "node", "bun" ], "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/ValkyrieStudios/utils.git" }, "bugs": { "url": "https://github.com/ValkyrieStudios/utils/issues" }, "homepage": "https://github.com/ValkyrieStudios/utils#readme", "types": "index.d.ts" }
|