alienese 0.6.0 → 0.7.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.
- package/alienese.js +49 -5
- package/package.json +2 -2
package/alienese.js
CHANGED
|
@@ -32,7 +32,7 @@ SOFTWARE.
|
|
|
32
32
|
// This patch aims to create smaller (quicker) and more concise (lighter) JavaScript code.
|
|
33
33
|
// It makes the code more implicit and serves as an alternative to obfuscation.
|
|
34
34
|
//
|
|
35
|
-
// v0.
|
|
35
|
+
// v0.7.0 / release 2026.02.06
|
|
36
36
|
//
|
|
37
37
|
// * Must be loaded modernism.js before this script.
|
|
38
38
|
//
|
|
@@ -239,12 +239,14 @@ const oj = Object;
|
|
|
239
239
|
|
|
240
240
|
// frequent object types alias constant
|
|
241
241
|
const DT = _DATE;
|
|
242
|
+
const TT = _TIME;
|
|
242
243
|
|
|
243
244
|
const RA = _ARRAY;
|
|
244
245
|
const SA = _SET;
|
|
245
246
|
const MA = _MAP;
|
|
246
247
|
|
|
247
248
|
const dt = Date;
|
|
249
|
+
const tt = Time;
|
|
248
250
|
|
|
249
251
|
const ra = Array;
|
|
250
252
|
const sa = Set;
|
|
@@ -252,6 +254,8 @@ const ma = Map;
|
|
|
252
254
|
|
|
253
255
|
|
|
254
256
|
// frequent assign types alias constant
|
|
257
|
+
const fnd = FORE_NOT_DEFAULT;
|
|
258
|
+
const mnd = MORE_NOT_DEFAULT;
|
|
255
259
|
const def = DEFAULT;
|
|
256
260
|
const fin = FINALLY;
|
|
257
261
|
|
|
@@ -260,6 +264,7 @@ const fin = FINALLY;
|
|
|
260
264
|
const x = {
|
|
261
265
|
get a() { return new Array(); },
|
|
262
266
|
get d() { return new Date(); },
|
|
267
|
+
get m() { return new Time(); },
|
|
263
268
|
get t() { return new Set(); },
|
|
264
269
|
get p() { return new Map(); },
|
|
265
270
|
};
|
|
@@ -450,11 +455,15 @@ const rigm = regex => new RegExp(regex, "igm");
|
|
|
450
455
|
|
|
451
456
|
|
|
452
457
|
// additional static function for classes
|
|
453
|
-
|
|
458
|
+
defineGetterAndSetter(fn, "n", function () { return new this(); });
|
|
459
|
+
defineProperty(fn, "w", function () { return new this(...arguments); });
|
|
460
|
+
|
|
454
461
|
defineStaticGetterAndSetter(dt, "t", function () { return this.now(); });
|
|
455
462
|
defineStaticGetterAndSetter(dt, "ms", function () { return dt.n.millis; });
|
|
456
463
|
defineStaticGetterAndSetter(dt, "msd", function () { return this.ms.string.padStart(3, "0"); });
|
|
457
464
|
|
|
465
|
+
defineStaticGetterAndSetter(tt, "t", function () { return this.now(); });
|
|
466
|
+
|
|
458
467
|
|
|
459
468
|
// additional global prototype functions
|
|
460
469
|
definePropertyPlex("mc", function () { return matchCase(this.it, ...arguments); });
|
|
@@ -504,6 +513,7 @@ definePropertyPlex("ifneq", function (that, process = it => it, ornot = it => {}
|
|
|
504
513
|
|
|
505
514
|
|
|
506
515
|
// additional primitive prototype functions
|
|
516
|
+
defineProperty(num, "div", function (by) { return this.it.divided(by); });
|
|
507
517
|
defineGetterAndSetter(num, "str", function () { return this.it.string; });
|
|
508
518
|
defineGetterAndSetter(num, "prc", function () { return this.it.pricision; });
|
|
509
519
|
defineGetterAndSetter(num, "prs", function () { return this.it.pricisionString; });
|
|
@@ -554,7 +564,7 @@ defineGetterAndSetter(dt, "H", function () { return this.it.hours; });
|
|
|
554
564
|
defineGetterAndSetter(dt, "HH", function () { return this.it.H.d00; });
|
|
555
565
|
defineGetterAndSetter(dt, "a", function () { return this.it.H < 12 ? _A : _P; });
|
|
556
566
|
defineGetterAndSetter(dt, "aa", function () { return this.it.a + _M; });
|
|
557
|
-
defineGetterAndSetter(dt, "h", function () { return
|
|
567
|
+
defineGetterAndSetter(dt, "h", function () { return this.it.hours12; });
|
|
558
568
|
defineGetterAndSetter(dt, "hh", function () { return this.it.h.d00; });
|
|
559
569
|
defineGetterAndSetter(dt, "m", function () { return this.it.minutes; });
|
|
560
570
|
defineGetterAndSetter(dt, "mm", function () { return this.it.m.d00; });
|
|
@@ -570,19 +580,52 @@ defineGetterAndSetter(dt, "Zm", function () { return this.it.zoneMinutes; });
|
|
|
570
580
|
defineGetterAndSetter(dt, "Zmm", function () { return this.it.Zm.d00; });
|
|
571
581
|
defineGetterAndSetter(dt, "Zh", function () { return this.it.Z.int; });
|
|
572
582
|
defineGetterAndSetter(dt, "Zhh", function () { return this.it.Zh.d00; });
|
|
573
|
-
defineGetterAndSetter(dt, "X", function () { return this.it.Zhh + cl +
|
|
583
|
+
defineGetterAndSetter(dt, "X", function () { return this.it.let(it => it.Zhh + cl + it.Zmm); });
|
|
574
584
|
defineGetterAndSetter(dt, "t", function () { return this.it.time; });
|
|
575
585
|
defineGetterAndSetter(dt, "ut", function () { return this.it.unix; });
|
|
576
|
-
defineGetterAndSetter(dt, "mo", function () { return this.it.y * 12 +
|
|
586
|
+
defineGetterAndSetter(dt, "mo", function () { return this.it.let(it => it.y * 12 + it.M0); });
|
|
577
587
|
defineGetterAndSetter(dt, "do", function () { return this.it.dateOffset; });
|
|
588
|
+
defineGetterAndSetter(dt, "ymia0", function () { return this.it.yearMonthIntArray0; });
|
|
589
|
+
defineGetterAndSetter(dt, "ymia", function () { return this.it.yearMonthIntArray; });
|
|
578
590
|
defineGetterAndSetter(dt, "yma", function () { return this.it.yearMonthArray; });
|
|
579
591
|
defineGetterAndSetter(dt, "ym", function () { return this.it.yearMonth; });
|
|
592
|
+
defineGetterAndSetter(dt, "da0", function () { return this.it.dateArray0; });
|
|
593
|
+
defineGetterAndSetter(dt, "da", function () { return this.it.dateArray; });
|
|
580
594
|
defineGetterAndSetter(dt, "ymda", function () { return this.it.dateStringArray; });
|
|
581
595
|
defineGetterAndSetter(dt, "ymd", function () { return this.it.dateString; });
|
|
596
|
+
defineGetterAndSetter(dt, "hmia", function () { return this.it.hourMinutesIntArray; });
|
|
582
597
|
defineGetterAndSetter(dt, "hma", function () { return this.it.hourMinutesArray; });
|
|
583
598
|
defineGetterAndSetter(dt, "hm", function () { return this.it.hourMinutes; });
|
|
599
|
+
defineGetterAndSetter(dt, "ta", function () { return this.it.timeArray; });
|
|
584
600
|
defineGetterAndSetter(dt, "hmsa", function () { return this.it.timeStringArray; });
|
|
585
601
|
defineGetterAndSetter(dt, "hms", function () { return this.it.timeString; });
|
|
602
|
+
defineGetterAndSetter(dt, "tp", function () { return this.it.timePart; });
|
|
603
|
+
defineGetterAndSetter(dt, "tt", function () { return this.it.asTime; });
|
|
604
|
+
defineProperty(dt, "sdt", function (time, m, s, ms) { return this.it.setDayTime(time, m, s, ms); });
|
|
605
|
+
defineProperty(dt, "at", function (time) { return this.it.addTime(time); });
|
|
606
|
+
|
|
607
|
+
|
|
608
|
+
defineGetterAndSetter(tt, "d", function () { return this.it.days; });
|
|
609
|
+
defineGetterAndSetter(tt, "dd", function () { return this.it.d.d00; });
|
|
610
|
+
defineGetterAndSetter(tt, "H", function () { return this.it.hours; });
|
|
611
|
+
defineGetterAndSetter(tt, "HH", function () { return this.it.H.d00; });
|
|
612
|
+
defineGetterAndSetter(tt, "a", function () { return this.it.H < 12 ? _A : _P; });
|
|
613
|
+
defineGetterAndSetter(tt, "aa", function () { return this.it.a + _M; });
|
|
614
|
+
defineGetterAndSetter(tt, "h", function () { return (this.it.H % 12).let(it => it == 0 ? 12 : it); });
|
|
615
|
+
defineGetterAndSetter(tt, "hh", function () { return this.it.h.d00; });
|
|
616
|
+
defineGetterAndSetter(tt, "m", function () { return this.it.minutes; });
|
|
617
|
+
defineGetterAndSetter(tt, "mm", function () { return this.it.m.d00; });
|
|
618
|
+
defineGetterAndSetter(tt, "s", function () { return this.it.seconds; });
|
|
619
|
+
defineGetterAndSetter(tt, "ss", function () { return this.it.s.d00; });
|
|
620
|
+
defineGetterAndSetter(tt, "ms", function () { return this.it.millis; });
|
|
621
|
+
defineGetterAndSetter(tt, "S", function () { return this.it.ms; });
|
|
622
|
+
defineGetterAndSetter(tt, "SSS", function () { return this.it.S.d000; });
|
|
623
|
+
defineGetterAndSetter(tt, "hmia", function () { return this.it.hourMinutesIntArray; });
|
|
624
|
+
defineGetterAndSetter(tt, "hma", function () { return this.it.hourMinutesArray; });
|
|
625
|
+
defineGetterAndSetter(tt, "hm", function () { return this.it.hourMinutes; });
|
|
626
|
+
defineGetterAndSetter(tt, "ta", function () { return this.it.timeArray; });
|
|
627
|
+
defineGetterAndSetter(tt, "hmsa", function () { return this.it.timeStringArray; });
|
|
628
|
+
defineGetterAndSetter(tt, "hms", function () { return this.it.timeString; });
|
|
586
629
|
|
|
587
630
|
|
|
588
631
|
// Bind to global when not a browser
|
|
@@ -770,6 +813,7 @@ if (typeof window === U) {
|
|
|
770
813
|
dfg("MA", MA);
|
|
771
814
|
|
|
772
815
|
dfg("dt", dt);
|
|
816
|
+
dfg("tt", tt);
|
|
773
817
|
|
|
774
818
|
dfg("ra", ra);
|
|
775
819
|
dfg("sa", sa);
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "alienese",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Alienise.js - Estre javscript Alienese patch",
|
|
5
5
|
"main": "alienese.js",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"modernism": "^0.
|
|
7
|
+
"modernism": "^0.7.0"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
10
|
"test": "echo \"Error: no test specified\" && exit 1"
|