alienese 0.4.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/README.md +181 -0
- package/alienese.js +415 -0
- package/package.json +14 -0
package/README.md
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
# Alienese.js
|
|
2
|
+
|
|
3
|
+
[English](#alienesejs) | [한국어](#alienesejs-한국어)
|
|
4
|
+
|
|
5
|
+
**Alienese.js** is an extreme alias library built on top of **Modernism.js**. It provides ultra-short, cryptic (Alienese-like) aliases for almost every common JavaScript keyword, type, and function defined in Modernism.
|
|
6
|
+
|
|
7
|
+
It is designed for developers who prefer **extreme brevity**, **implicitness**, or are participating in **code golf**. It serves as a form of "readable obfuscation" where code becomes incredibly dense but remains logically structured thanks to Modernism's foundation.
|
|
8
|
+
|
|
9
|
+
> **Dependency:** Installing `alienese` automatically installs and loads `modernism`.
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install alienese
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Features & Aliases
|
|
18
|
+
|
|
19
|
+
Alienese maps Modernism's verbose functions to 1-3 letter aliases.
|
|
20
|
+
|
|
21
|
+
### 1. Primitives & Constants
|
|
22
|
+
* `U` = `UNDEFINED` ("undefined") / `u` = `undefined`
|
|
23
|
+
* `N` = `NULL` ("null") / `n` = `null`
|
|
24
|
+
* `T` = `TRUE` ("true") / `t` = `true`
|
|
25
|
+
* `F` = `FALSE` ("false") / `f` = `false`
|
|
26
|
+
|
|
27
|
+
### 2. Types
|
|
28
|
+
* `FNC` = `FUNCTION` ("function")
|
|
29
|
+
* `STR` = `STRING` ("string")
|
|
30
|
+
* `NUM` = `NUMBER` ("number")
|
|
31
|
+
* `OBJ` = `OBJECT` ("object")
|
|
32
|
+
* `BLE` = `BOOLEAN` ("boolean")
|
|
33
|
+
|
|
34
|
+
### 3. Type Checking
|
|
35
|
+
* `to` = `typeOf`
|
|
36
|
+
* `io` = `isObject`
|
|
37
|
+
* `ia` = `isArray`
|
|
38
|
+
* `is` = `isString`
|
|
39
|
+
* `in` = `isNumber`
|
|
40
|
+
* `en` = `isNully` (Undefined/Null)
|
|
41
|
+
* `nn` = `isNotNully` (Not Undefined/Null)
|
|
42
|
+
|
|
43
|
+
### 4. Flow Control & Loops
|
|
44
|
+
* `ifx` = `executeIf`
|
|
45
|
+
* `dr` = `doAndReturn`
|
|
46
|
+
* `fi` = `forin`
|
|
47
|
+
* `fo` = `forof`
|
|
48
|
+
* `w` = `whileIn`
|
|
49
|
+
|
|
50
|
+
### 5. Object Methods
|
|
51
|
+
* `cp` = `copy`
|
|
52
|
+
* `pc` = `patch`
|
|
53
|
+
* `ok` = `keysOf`
|
|
54
|
+
* `ov` = `valuesOf`
|
|
55
|
+
* `oe` = `entriesOf`
|
|
56
|
+
|
|
57
|
+
### 6. Prototype Extensions (Shortcuts)
|
|
58
|
+
Objects inherit these short methods:
|
|
59
|
+
* `.cp()` = `.copy()`
|
|
60
|
+
* `.pc()` = `.patch()`
|
|
61
|
+
* `.rv()` = `.revert()`
|
|
62
|
+
* `.dr()` = `.doAndReturn()`
|
|
63
|
+
|
|
64
|
+
## Comparison
|
|
65
|
+
|
|
66
|
+
**Standard JavaScript / Modernism:**
|
|
67
|
+
```javascript
|
|
68
|
+
if (isObject(data) && isNotNully(data)) {
|
|
69
|
+
const copy = copy(data);
|
|
70
|
+
keysOf(copy).forEach(key => {
|
|
71
|
+
console.log(key);
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**Alienese:**
|
|
77
|
+
```javascript
|
|
78
|
+
require('alienese');
|
|
79
|
+
|
|
80
|
+
if (io(data) && nn(data)) {
|
|
81
|
+
const c = cp(data);
|
|
82
|
+
ok(c).forEach(k => {
|
|
83
|
+
console.log(k);
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## License
|
|
89
|
+
|
|
90
|
+
MIT License
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
# Alienese.js (한국어)
|
|
95
|
+
|
|
96
|
+
**Alienese.js**는 **Modernism.js**를 기반으로 구축된 극단적인 단축어(Alias) 라이브러리입니다. Modernism에 정의된 거의 모든 일반적인 자바스크립트 키워드, 타입, 함수들에 대해 외계어(Alienese)처럼 짧고 암호 같은 별칭을 제공합니다.
|
|
97
|
+
|
|
98
|
+
이 라이브러리는 **극도의 간결함**과 **함축성**을 선호하거나, **코드 골프(Code Golf)**를 즐기는 개발자를 위해 설계되었습니다. 코드가 믿을 수 없을 정도로 압축되어 "읽을 수 있는 난독화" 형태가 되지만, Modernism의 기반 덕분에 논리적인 구조는 유지됩니다.
|
|
99
|
+
|
|
100
|
+
> **의존성:** `alienese`를 설치하면 `modernism`이 자동으로 설치되고 로드됩니다.
|
|
101
|
+
|
|
102
|
+
## 설치
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
npm install alienese
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## 기능 및 별칭 (Aliases)
|
|
109
|
+
|
|
110
|
+
Alienese는 Modernism의 긴 함수 이름들을 1~3글자의 별칭으로 매핑합니다.
|
|
111
|
+
|
|
112
|
+
### 1. 원시값 및 상수
|
|
113
|
+
* `U` = `UNDEFINED` ("undefined") / `u` = `undefined`
|
|
114
|
+
* `N` = `NULL` ("null") / `n` = `null`
|
|
115
|
+
* `T` = `TRUE` ("true") / `t` = `true`
|
|
116
|
+
* `F` = `FALSE` ("false") / `f` = `false`
|
|
117
|
+
|
|
118
|
+
### 2. 타입
|
|
119
|
+
* `FNC` = `FUNCTION` ("function")
|
|
120
|
+
* `STR` = `STRING` ("string")
|
|
121
|
+
* `NUM` = `NUMBER` ("number")
|
|
122
|
+
* `OBJ` = `OBJECT` ("object")
|
|
123
|
+
* `BLE` = `BOOLEAN` ("boolean")
|
|
124
|
+
|
|
125
|
+
### 3. 타입 체크
|
|
126
|
+
* `to` = `typeOf`
|
|
127
|
+
* `io` = `isObject`
|
|
128
|
+
* `ia` = `isArray`
|
|
129
|
+
* `is` = `isString`
|
|
130
|
+
* `in` = `isNumber`
|
|
131
|
+
* `en` = `isNully` (Undefined나 Null)
|
|
132
|
+
* `nn` = `isNotNully` (Undefined나 Null 아님)
|
|
133
|
+
|
|
134
|
+
### 4. 흐름 제어 및 루프
|
|
135
|
+
* `ifx` = `executeIf`
|
|
136
|
+
* `dr` = `doAndReturn`
|
|
137
|
+
* `fi` = `forin`
|
|
138
|
+
* `fo` = `forof`
|
|
139
|
+
* `w` = `whileIn`
|
|
140
|
+
|
|
141
|
+
### 5. 객체 메서드
|
|
142
|
+
* `cp` = `copy`
|
|
143
|
+
* `pc` = `patch`
|
|
144
|
+
* `ok` = `keysOf`
|
|
145
|
+
* `ov` = `valuesOf`
|
|
146
|
+
* `oe` = `entriesOf`
|
|
147
|
+
|
|
148
|
+
### 6. 프로토타입 확장 (단축형)
|
|
149
|
+
모든 객체는 다음의 짧은 메서드들을 상속받습니다:
|
|
150
|
+
* `.cp()` = `.copy()`
|
|
151
|
+
* `.pc()` = `.patch()`
|
|
152
|
+
* `.rv()` = `.revert()`
|
|
153
|
+
* `.dr()` = `.doAndReturn()`
|
|
154
|
+
|
|
155
|
+
## 비교 예시
|
|
156
|
+
|
|
157
|
+
**표준 자바스크립트 / Modernism:**
|
|
158
|
+
```javascript
|
|
159
|
+
if (isObject(data) && isNotNully(data)) {
|
|
160
|
+
const copy = copy(data);
|
|
161
|
+
keysOf(copy).forEach(key => {
|
|
162
|
+
console.log(key);
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
**Alienese:**
|
|
168
|
+
```javascript
|
|
169
|
+
require('alienese');
|
|
170
|
+
|
|
171
|
+
if (io(data) && nn(data)) {
|
|
172
|
+
const c = cp(data);
|
|
173
|
+
ok(c).forEach(k => {
|
|
174
|
+
console.log(k);
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## 라이선스
|
|
180
|
+
|
|
181
|
+
MIT License
|
package/alienese.js
ADDED
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
/*
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Copyright (c) 2025 Estre Soliette (SoliEstre)
|
|
6
|
+
|
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
in the Software without restriction, including without limitation the rights
|
|
10
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
furnished to do so, subject to the following conditions:
|
|
13
|
+
|
|
14
|
+
The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
copies or substantial portions of the Software.
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25
|
+
SOFTWARE.
|
|
26
|
+
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
// Alienise.js - Estre javscript Alienese patch //
|
|
30
|
+
//
|
|
31
|
+
// A collection of aliases for shortening and simplifying JavaScript code.
|
|
32
|
+
// This patch aims to create smaller (quicker) and more concise (lighter) JavaScript code.
|
|
33
|
+
// It makes the code more implicit and serves as an alternative to obfuscation.
|
|
34
|
+
//
|
|
35
|
+
// v0.4.1 / release 2025.11.24
|
|
36
|
+
//
|
|
37
|
+
// * Must be loaded modernism.js before this script.
|
|
38
|
+
//
|
|
39
|
+
// Author: Estre Soliette
|
|
40
|
+
// Established: 2025.01.05 / Extracted: 2025.03.15
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
// primitive types alias constant
|
|
45
|
+
const _global = (typeof globalThis !== 'undefined') ? globalThis : (typeof window !== 'undefined' ? window : global);
|
|
46
|
+
const defineGlobal = (name, value) => {
|
|
47
|
+
Object.defineProperty(_global, name, {
|
|
48
|
+
value: value,
|
|
49
|
+
writable: false,
|
|
50
|
+
configurable: false,
|
|
51
|
+
enumerable: false
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
// Auto-load modernism in Node.js environment
|
|
56
|
+
if (typeof require !== 'undefined' && typeof module !== 'undefined') {
|
|
57
|
+
try { require("modernism"); } catch (e) { }
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
defineGlobal("U", UNDEFINED);
|
|
61
|
+
defineGlobal("N", NULL);
|
|
62
|
+
defineGlobal("T", TRUE);
|
|
63
|
+
defineGlobal("F", FALSE);
|
|
64
|
+
|
|
65
|
+
defineGlobal("u", _global.undefined);
|
|
66
|
+
defineGlobal("n", _global.null);
|
|
67
|
+
defineGlobal("t", _global.true);
|
|
68
|
+
defineGlobal("f", _global.false);
|
|
69
|
+
|
|
70
|
+
// end point assigner constant
|
|
71
|
+
defineGlobal("eoo", _global.u);
|
|
72
|
+
defineGlobal("eoa", _global.u);
|
|
73
|
+
|
|
74
|
+
// prototype of primitive types alias constant
|
|
75
|
+
defineGlobal("FNC", _global.FUNCTION);
|
|
76
|
+
defineGlobal("BLE", _global.BOOLEAN);
|
|
77
|
+
defineGlobal("STR", _global.STRING);
|
|
78
|
+
defineGlobal("SYM", _global.SYMBOL);
|
|
79
|
+
defineGlobal("NUM", _global.NUMBER);
|
|
80
|
+
defineGlobal("BIG", _global.BIGINT);
|
|
81
|
+
defineGlobal("OBJ", _global.OBJECT);
|
|
82
|
+
|
|
83
|
+
defineGlobal("fun", Function);
|
|
84
|
+
defineGlobal("ble", Boolean);
|
|
85
|
+
defineGlobal("str", String);
|
|
86
|
+
defineGlobal("sym", Symbol);
|
|
87
|
+
defineGlobal("num", Number);
|
|
88
|
+
defineGlobal("big", BigInt);
|
|
89
|
+
defineGlobal("obj", Object);
|
|
90
|
+
|
|
91
|
+
// class names of primitive types constant
|
|
92
|
+
defineGlobal("FN", _global._FUNCTION);
|
|
93
|
+
defineGlobal("BL", _global._BOOLEAN);
|
|
94
|
+
defineGlobal("ST", _global._STRING);
|
|
95
|
+
defineGlobal("SY", _global._SYMBOL);
|
|
96
|
+
defineGlobal("NO", _global._NUMBER);
|
|
97
|
+
defineGlobal("BI", _global._BIG_INT);
|
|
98
|
+
defineGlobal("OJ", _global._OBJECT);
|
|
99
|
+
|
|
100
|
+
defineGlobal("fn", Function);
|
|
101
|
+
defineGlobal("bl", Boolean);
|
|
102
|
+
defineGlobal("sg", String);
|
|
103
|
+
defineGlobal("sl", Symbol);
|
|
104
|
+
defineGlobal("no", Number);
|
|
105
|
+
defineGlobal("bi", BigInt);
|
|
106
|
+
defineGlobal("oj", Object);
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
// frequent object types alias constant
|
|
110
|
+
defineGlobal("DT", _global._DATE);
|
|
111
|
+
|
|
112
|
+
defineGlobal("RA", _global._ARRAY);
|
|
113
|
+
defineGlobal("SA", _global._SET);
|
|
114
|
+
defineGlobal("MA", _global._MAP);
|
|
115
|
+
|
|
116
|
+
defineGlobal("dt", Date);
|
|
117
|
+
|
|
118
|
+
defineGlobal("ra", Array);
|
|
119
|
+
defineGlobal("sa", Set);
|
|
120
|
+
defineGlobal("ma", Map);
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
// frequent assign types alias constant
|
|
124
|
+
defineGlobal("def", _global.DEFAULT);
|
|
125
|
+
defineGlobal("fin", _global.FINALLY);
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
// frequent object types empty object issuer alias constant
|
|
129
|
+
defineGlobal("x", {
|
|
130
|
+
get a() { return new Array(); },
|
|
131
|
+
get d() { return new Date(); },
|
|
132
|
+
get t() { return new Set(); },
|
|
133
|
+
get p() { return new Map(); },
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
// bypass constant
|
|
138
|
+
defineGlobal("ifx", _global.executeIf);
|
|
139
|
+
defineGlobal("itx", _global.executeWhen);
|
|
140
|
+
|
|
141
|
+
defineGlobal("ifr", _global.ifReturn);
|
|
142
|
+
|
|
143
|
+
defineGlobal("roen", _global.ifReturnOrEmptyNumber);
|
|
144
|
+
defineGlobal("roes", _global.ifReturnOrEmptyString);
|
|
145
|
+
defineGlobal("roea", _global.ifReturnOrEmptyArray);
|
|
146
|
+
defineGlobal("roeo", _global.ifReturnOrEmptyObject);
|
|
147
|
+
|
|
148
|
+
defineGlobal("val", _global.valet);
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
// common process shortcut constant
|
|
152
|
+
defineGlobal("f02b", _global.forZeroToBefore);
|
|
153
|
+
defineGlobal("f02r", _global.forZeroToReach);
|
|
154
|
+
|
|
155
|
+
defineGlobal("f20", _global.forToZeroFrom);
|
|
156
|
+
defineGlobal("f21", _global.forToPrimeFrom);
|
|
157
|
+
|
|
158
|
+
defineGlobal("ff", _global.forForward);
|
|
159
|
+
defineGlobal("fb", _global.forBackward);
|
|
160
|
+
|
|
161
|
+
defineGlobal("fi", _global.forin);
|
|
162
|
+
defineGlobal("fiv", _global.forinner);
|
|
163
|
+
|
|
164
|
+
defineGlobal("fo", _global.forof);
|
|
165
|
+
defineGlobal("fkv", _global.forkv);
|
|
166
|
+
|
|
167
|
+
defineGlobal("w", _global.whileIn);
|
|
168
|
+
defineGlobal("dw", _global.doWhileIn);
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
// meaning comparator constant
|
|
172
|
+
defineGlobal("to", _global.typeOf);
|
|
173
|
+
|
|
174
|
+
defineGlobal("tm", _global.typeMatch);
|
|
175
|
+
|
|
176
|
+
defineGlobal("tu", _global.typeUndefined);
|
|
177
|
+
defineGlobal("tf", _global.typeFunction);
|
|
178
|
+
defineGlobal("tb", _global.typeBoolean);
|
|
179
|
+
defineGlobal("ts", _global.typeString);
|
|
180
|
+
defineGlobal("ty", _global.typeSymbol);
|
|
181
|
+
defineGlobal("tn", _global.typeNumber);
|
|
182
|
+
defineGlobal("tg", _global.typeBigint);
|
|
183
|
+
defineGlobal("tj", _global.typeObject);
|
|
184
|
+
|
|
185
|
+
defineGlobal("im", _global.instanceMatch);
|
|
186
|
+
defineGlobal("io", _global.isObject);
|
|
187
|
+
defineGlobal("ia", _global.isArray);
|
|
188
|
+
defineGlobal("ioa", _global.isArray);
|
|
189
|
+
defineGlobal("ios", _global.isString);
|
|
190
|
+
defineGlobal("ion", _global.isNumber);
|
|
191
|
+
defineGlobal("iot", _global.isSet);
|
|
192
|
+
defineGlobal("iop", _global.isMap);
|
|
193
|
+
|
|
194
|
+
defineGlobal("xv", _global.exact);
|
|
195
|
+
defineGlobal("nxv", _global.notExact);
|
|
196
|
+
defineGlobal("xm", _global.exactMatches);
|
|
197
|
+
defineGlobal("nx", _global.notExactMatches);
|
|
198
|
+
|
|
199
|
+
defineGlobal("ev", _global.equals);
|
|
200
|
+
defineGlobal("nev", _global.notEquals);
|
|
201
|
+
defineGlobal("sm", _global.same);
|
|
202
|
+
defineGlobal("df", _global.diffrent);
|
|
203
|
+
|
|
204
|
+
defineGlobal("gtv", _global.getherThan);
|
|
205
|
+
defineGlobal("ltv", _global.lessThan);
|
|
206
|
+
defineGlobal("ngt", _global.notGetherThan);
|
|
207
|
+
defineGlobal("nlt", _global.notLessThan);
|
|
208
|
+
|
|
209
|
+
defineGlobal("gev", _global.getherOrEquals);
|
|
210
|
+
defineGlobal("lev", _global.lessOrEquels);
|
|
211
|
+
defineGlobal("nge", _global.notGetherAndEquals);
|
|
212
|
+
defineGlobal("nle", _global.notLessAndEquals);
|
|
213
|
+
|
|
214
|
+
defineGlobal("fc", _global.isFalseCase);
|
|
215
|
+
defineGlobal("nfc", _global.isTrueCase);
|
|
216
|
+
|
|
217
|
+
defineGlobal("xu", _global.isUndefined);
|
|
218
|
+
defineGlobal("xn", _global.isNull);
|
|
219
|
+
defineGlobal("xt", _global.isExactTrue);
|
|
220
|
+
defineGlobal("xf", _global.isExactFalse);
|
|
221
|
+
|
|
222
|
+
defineGlobal("nxu", _global.isNotUndefined);
|
|
223
|
+
defineGlobal("nxn", _global.isNotNull);
|
|
224
|
+
defineGlobal("nxt", _global.isNotTrue);
|
|
225
|
+
defineGlobal("nxf", _global.isNotFalse);
|
|
226
|
+
|
|
227
|
+
defineGlobal("en", _global.isNully);
|
|
228
|
+
defineGlobal("et", _global.isTruely);
|
|
229
|
+
defineGlobal("ef", _global.isFalsely);
|
|
230
|
+
defineGlobal("ee", _global.isEmpty);
|
|
231
|
+
|
|
232
|
+
defineGlobal("nn", _global.isNotNully);
|
|
233
|
+
defineGlobal("nt", _global.isNotTruely);
|
|
234
|
+
defineGlobal("nf", _global.isNotFalsely);
|
|
235
|
+
defineGlobal("ne", _global.isNotEmpty);
|
|
236
|
+
|
|
237
|
+
defineGlobal("noe", _global.isNullOrEmpty);
|
|
238
|
+
defineGlobal("nne", _global.isNotNullAndEmpty);
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
// quick execute by conditions constant
|
|
242
|
+
defineGlobal("inoe", _global.ifNullOrEmpty);
|
|
243
|
+
defineGlobal("inne", _global.ifNotNullAndEmpty);
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
// do and return inline double takes
|
|
247
|
+
defineGlobal("dr", _global.doAndReturn);
|
|
248
|
+
defineGlobal("drx", _global.doAndReturnByExecute);
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
// object method shortcut constant
|
|
252
|
+
defineGlobal("ok", _global.keysOf);
|
|
253
|
+
defineGlobal("ov", _global.valuesOf);
|
|
254
|
+
defineGlobal("oe", _global.entriesOf);
|
|
255
|
+
defineGlobal("oc", _global.countOf);
|
|
256
|
+
|
|
257
|
+
defineGlobal("occ", _global.checkCount);
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
// match case constant
|
|
261
|
+
defineGlobal("mc", _global.matchCase);
|
|
262
|
+
defineGlobal("ec", _global.equalCase);
|
|
263
|
+
defineGlobal("xc", _global.exactCase);
|
|
264
|
+
defineGlobal("tc", _global.typeCase);
|
|
265
|
+
defineGlobal("cc", _global.classCase);
|
|
266
|
+
defineGlobal("kc", _global.kindCase);
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
/** variable data copy */
|
|
270
|
+
defineGlobal("cp", _global.copy);
|
|
271
|
+
defineGlobal("mk", _global.mock);
|
|
272
|
+
defineGlobal("mm", _global.mimic);
|
|
273
|
+
defineGlobal("tw", _global.twin);
|
|
274
|
+
defineGlobal("cn", _global.clone);
|
|
275
|
+
|
|
276
|
+
defineGlobal("pc", _global.patch);
|
|
277
|
+
defineGlobal("ow", _global.overwrite);
|
|
278
|
+
defineGlobal("tk", _global.takeover);
|
|
279
|
+
defineGlobal("aq", _global.acquire);
|
|
280
|
+
defineGlobal("ih", _global.inherit);
|
|
281
|
+
|
|
282
|
+
defineGlobal("rv", _global.revert);
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
/** run handle */
|
|
286
|
+
defineGlobal("pq", _global.postQueue);
|
|
287
|
+
defineGlobal("pd", _global.postDelayed);
|
|
288
|
+
defineGlobal("pp", _global.postPromise);
|
|
289
|
+
defineGlobal("pb", _global.postBonded);
|
|
290
|
+
defineGlobal("ppq", _global.postPromiseQueue);
|
|
291
|
+
defineGlobal("paq", _global.postAsyncQueue);
|
|
292
|
+
defineGlobal("pwq", _global.postAwaitQueue);
|
|
293
|
+
defineGlobal("pfq", _global.postFrameQueue);
|
|
294
|
+
defineGlobal("pfp", _global.postFramePromise);
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
// Object function shortcut constants
|
|
298
|
+
defineGlobal("dsp", _global.defineStaticProperty);
|
|
299
|
+
defineGlobal("dp", _global.defineProperty);
|
|
300
|
+
defineGlobal("dpx", _global.definePropertyPlex);
|
|
301
|
+
defineGlobal("dspgs", _global.defineStaticGetterAndSetter);
|
|
302
|
+
defineGlobal("dpgs", _global.defineGetterAndSetter);
|
|
303
|
+
defineGlobal("dpgsx", _global.defineGetterAndSetterPlex);
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
// additional static function for classes
|
|
307
|
+
defineStaticGetterAndSetter(dt, "n", function () { return new Date(...arguments); });
|
|
308
|
+
defineStaticGetterAndSetter(dt, "t", function () { return this.now(); });
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
// additional global prototype functions
|
|
312
|
+
definePropertyPlex("mc", function () { return matchCase(this.it, ...arguments); });
|
|
313
|
+
definePropertyPlex("ec", function () { return equalCase(this.it, ...arguments); });
|
|
314
|
+
definePropertyPlex("xc", function () { return exactCase(this.it, ...arguments); });
|
|
315
|
+
definePropertyPlex("tc", function () { return typeCase(this.it, ...arguments); });
|
|
316
|
+
definePropertyPlex("cc", function () { return classCase(this.it, ...arguments); });
|
|
317
|
+
definePropertyPlex("kc", function () { return kindCase(this.it, ...arguments); });
|
|
318
|
+
|
|
319
|
+
definePropertyPlex("ee", function (process = it => it, ornot = it => it, numberEmptyMatch = 0) { return _global.isEmpty(this.it, numberEmptyMatch) ? process(this.it) : ornot(this.it); });
|
|
320
|
+
definePropertyPlex("ne", function (process = it => it, ornot = it => it, numberEmptyMatch = 0) { return _global.isNotEmpty(this.it, numberEmptyMatch) ? process(this.it) : ornot(this.it); });
|
|
321
|
+
|
|
322
|
+
definePropertyPlex("dr", function (does = (it, args) => { }, returns, args = []) { return _global.doAndReturn(does, returns, [this.it, ...args]); });
|
|
323
|
+
definePropertyPlex("drx", function (does = (it, args) => { }, forReturns, args = []) { return _global.doAndReturnByExecute(does, forReturns, [this.it, ...args]); });
|
|
324
|
+
|
|
325
|
+
defineGetterAndSetter(Object, "ok", function () { return _global.keysOf(this.it); });
|
|
326
|
+
defineGetterAndSetter(Object, "ov", function () { return _global.valuesOf(this.it); });
|
|
327
|
+
defineGetterAndSetter(Object, "oe", function () { return _global.entriesOf(this.it); });
|
|
328
|
+
defineGetterAndSetter(Object, "oc", function () { return _global.countOf(this.it); });
|
|
329
|
+
defineGetterAndSetter(Object, "occ", function () { return _global.checkCount(this.it, (k, v) => true); });
|
|
330
|
+
|
|
331
|
+
defineProperty(Object, "fk", function (work = key => { return false; }) { return _global.forof(this.it.ways, work); });
|
|
332
|
+
defineProperty(Object, "fv", function (work = value => { return false; }) { return _global.forof(this.it.looks, work); });
|
|
333
|
+
defineProperty(Object, "fe", function (work = (key, value) => { return false; }) { return _global.forkv(this.it.entire, work); });
|
|
334
|
+
defineProperty(Object, "fkv", function (work = (key, value) => { return false; }) { return _global.forkv(this.it.entire, work); });
|
|
335
|
+
|
|
336
|
+
defineProperty(Object, "cp", function (dataOnly = true, primitiveOnly = false, recusive = true) { return _global.copy(this, dataOnly, primitiveOnly, recusive); });
|
|
337
|
+
defineProperty(Object, "pc", function (from, dataOnly = true, primitiveOnly = false, recusive = true, append = false) { return _global.patch(this.it, from, dataOnly, primitiveOnly, recusive, append); });
|
|
338
|
+
defineProperty(Object, "rv", function (from, dataOnly = true, primitiveOnly = false, recusive = true, exceptNew = false) { return _global.revert(this.it, from, dataOnly, primitiveOnly, recusive, exceptNew); });
|
|
339
|
+
|
|
340
|
+
definePropertyPlex("ifeq", function (that, process = it => it, ornot = it => { }) { return this.let(it => _global.executeIf(it == that, process, [it], ornot)); });
|
|
341
|
+
definePropertyPlex("ifneq", function (that, process = it => it, ornot = it => { }) { return this.let(it => _global.executeIf(it != that, process, [it], ornot)); });
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
// Regex builder alias
|
|
346
|
+
defineGlobal("rx", (regex, flags) => new RegExp(regex, flags));
|
|
347
|
+
defineGlobal("reg", _global.rx);
|
|
348
|
+
defineGlobal("ri", regex => new RegExp(regex, "i"));
|
|
349
|
+
defineGlobal("rg", regex => new RegExp(regex, "g"));
|
|
350
|
+
defineGlobal("rm", regex => new RegExp(regex, "m"));
|
|
351
|
+
defineGlobal("rig", regex => new RegExp(regex, "ig"));
|
|
352
|
+
defineGlobal("rim", regex => new RegExp(regex, "im"));
|
|
353
|
+
defineGlobal("rgm", regex => new RegExp(regex, "gm"));
|
|
354
|
+
defineGlobal("rigm", regex => new RegExp(regex, "igm"));
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
// common extra characters constants
|
|
359
|
+
defineGlobal("lt", "<");
|
|
360
|
+
defineGlobal("gt", ">");
|
|
361
|
+
defineGlobal("ab", _global.lt + _global.gt);
|
|
362
|
+
defineGlobal("cb", _global.gt + _global.lt);
|
|
363
|
+
defineGlobal("ti", "~");
|
|
364
|
+
defineGlobal("ep", "!");
|
|
365
|
+
defineGlobal("em", _global.ep);
|
|
366
|
+
defineGlobal("at", "@");
|
|
367
|
+
defineGlobal("ds", "$");
|
|
368
|
+
defineGlobal("ms", "&");
|
|
369
|
+
defineGlobal("ps", "%");
|
|
370
|
+
defineGlobal("cf", "^");
|
|
371
|
+
defineGlobal("ak", "*");
|
|
372
|
+
defineGlobal("mp", _global.ak);
|
|
373
|
+
defineGlobal("ad", "+");
|
|
374
|
+
defineGlobal("add", _global.ad + _global.ad);
|
|
375
|
+
defineGlobal("hp", "-");
|
|
376
|
+
defineGlobal("sr", _global.hp);
|
|
377
|
+
defineGlobal("srr", _global.sr + _global.sr);
|
|
378
|
+
defineGlobal("us", "_");
|
|
379
|
+
defineGlobal("eq", "=");
|
|
380
|
+
defineGlobal("vl", "|");
|
|
381
|
+
defineGlobal("bs", "\\");
|
|
382
|
+
defineGlobal("ss", "/");
|
|
383
|
+
defineGlobal("dv", _global.ss);
|
|
384
|
+
defineGlobal("qm", "?");
|
|
385
|
+
defineGlobal("nl", _global.ep + _global.eq);
|
|
386
|
+
defineGlobal("le", _global.lt + _global.eq);
|
|
387
|
+
defineGlobal("ge", _global.gt + _global.eq);
|
|
388
|
+
defineGlobal("fa", _global.ad + _global.eq);
|
|
389
|
+
defineGlobal("fs", _global.sr + _global.eq);
|
|
390
|
+
defineGlobal("fm", _global.mp + _global.eq);
|
|
391
|
+
defineGlobal("fd", _global.dv + _global.eq);
|
|
392
|
+
defineGlobal("sq", "'");
|
|
393
|
+
defineGlobal("dq", '"');
|
|
394
|
+
defineGlobal("gv", '`');
|
|
395
|
+
defineGlobal("cl", ":");
|
|
396
|
+
defineGlobal("sc", ";");
|
|
397
|
+
defineGlobal("cm", ",");
|
|
398
|
+
defineGlobal("es", "");
|
|
399
|
+
defineGlobal("l", _global.cm);
|
|
400
|
+
defineGlobal("s", " ");
|
|
401
|
+
defineGlobal("i", "#");
|
|
402
|
+
defineGlobal("d", ".");
|
|
403
|
+
|
|
404
|
+
defineGlobal("cr", "\r");
|
|
405
|
+
defineGlobal("lf", "\n");
|
|
406
|
+
defineGlobal("crlf", _global.cr + _global.lf);
|
|
407
|
+
defineGlobal("lfcr", _global.lf + _global.cr);
|
|
408
|
+
defineGlobal("tab", "\t");
|
|
409
|
+
|
|
410
|
+
defineGlobal("ecr", "\\r");
|
|
411
|
+
defineGlobal("elf", "\\n");
|
|
412
|
+
defineGlobal("ecrlf", _global.ecr + _global.elf);
|
|
413
|
+
defineGlobal("elfcr", _global.elf + _global.ecr);
|
|
414
|
+
defineGlobal("etab", "\\t");
|
|
415
|
+
|
package/package.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "alienese",
|
|
3
|
+
"version": "0.4.1",
|
|
4
|
+
"description": "Alienise.js - Estre javscript Alienese patch",
|
|
5
|
+
"main": "alienese.js",
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"modernism": "^0.4.1"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
11
|
+
},
|
|
12
|
+
"author": "Estre Soliette",
|
|
13
|
+
"license": "MIT"
|
|
14
|
+
}
|