Modernism.jsμ Alienese.jsλ JavaScript μ½λλ₯Ό λ κ°κ²°νκ³ ν¨μ¨μ μΌλ‘ μμ±ν μ μκ² λμμ£Όλ μ νΈλ¦¬ν° λΌμ΄λΈλ¬λ¦¬μ
λλ€.
2025λ
Estre Soliette(SoliEstre)μ μν΄ EstreUI.jsμ ꡬμ±μμλ‘μ μμ±λμμΌλ©° λμΌνκ² MIT λΌμ΄μΌμ€λ‘ μ 곡λ©λλ€.
Modernism.jsλ JavaScript μ½λ μμ± λ°©μμ νλννκ³ μΈλΌμΈ νλ‘μΈμ±μ μν λ€μν λ°μ΄ν¨μ€μ λͺ½ν€ ν¨μΉλ₯Ό μ 곡νλ λΌμ΄λΈλ¬λ¦¬μ
λλ€.
μ΄ λΌμ΄λΈλ¬λ¦¬λ JavaScript μ½λλ₯Ό λ κ°κ²°νκ³ ννλ ₯ μκ² μμ±νμ¬ μ½λκ° μ₯ν©ν΄μ§μ§ μλλ‘ λμμ€λλ€.
μ¬μ€ Kotlinμμ μ μ°λκ² μμ΄μ λ§λ€μμ΅λλ€.
- νμ
κ΄λ ¨ μμ: κΈ°λ³Έ νμ
μ λν λͺ
νν μμ μ μ (
undefined
,null
,function
λ±) - μ‘°κ±΄λΆ μ€ν μ νΈλ¦¬ν°:
executeIf
,ifReturn
λ± μ‘°κ±΄λΆ μ½λ μ€νμ κ°μν - λ°λ³΅λ¬Έ μ νΈλ¦¬ν°:
forZeroToBefore
,forBackward
,forin
λ± λ€μν 루ν ν¨ν΄ μ§μ - νμ
λΉκ΅ ν¨μ:
typeOf
,typeMatch
,isObject
λ± νμ κ²μ¬ κ°μν - μΌμ΄μ€ 맀μΉ:
matchCase
,equalCase
,typeCase
λ± λ€μν 쑰건 λΆκΈ° ν¨ν΄ - κ°μ²΄ μ‘°μ λꡬ:
copy
,patch
,revert
λ± κ°μ²΄ μ‘°μ μ νΈλ¦¬ν° - νλ‘ν νμ
νμ₯:
it
,let
,also
λ± λ©μλ 체μ΄λμ μν νλ‘ν νμ νμ₯
// μ‘°κ±΄λΆ μ€ν
let result = executeIf(hour > 10, () => {
console.log("10μκ° μ§λ¬μΌλ―λ‘ μλμ μ€νν©λλ€.");
return executeAlarm();
}, () => hour);
// λ©μλ 체μ΄λ
"Hello".let(it => it.toUpperCase()).let(it => it + "!"); // "HELLO!"
// νμ
μΌμ΄μ€ 맀μΉ
const result = value.typeCase({
[STRING]: v => `λ¬Έμμ΄: ${v}`,
[NUMBER]: v => `μ«μ: ${v}`,
[OBJECT]: v => `κ°μ²΄: ${JSON.stringify(v)}`,
[UNDEFINED]: _ => "μ μλμ§ μμ",
[NULL]: _ => "null κ°",
[DEFAULT]: v => `κΈ°ν: ${v}`
});
Alienese.jsλ Modernism.jsμ νμ₯ λΌμ΄λΈλ¬λ¦¬λ‘, Modernism JS μ½λλ₯Ό λ μ§§κ³ κ°κ²°νκ² μμ±ν μ μλλ‘ λ€μν λ³μΉ(alias)μ μ 곡ν©λλ€.
μ½λλ₯Ό λ μ묡μ μΌλ‘ λ§λ€μ΄ μ½λ ν¬κΈ°λ₯Ό μ€μ΄κ³ νμ΄νμ μμλλ μκ°μ μ€μ΄λ κ²μ΄ λͺ©νμ
λλ€.
μ½λ νμ΄ννλ μκ°λ μκΉμμ λ§λ€μμ΅λλ€. κΈν λ μΌλ¨ μ°κ³ λμ€μ Long nameμΌλ‘ λ°κΎΈμΈμ.
- κΈ°λ³Έ νμ
λ³μΉ:
u
(undefined),n
(null),t
(true),f
(false) λ± μ§§μ λ³μΉ - νλ‘ν νμ
λ³μΉ:
fnc
(Function),str
(String),num
(Number) λ± - ν΄λμ€λͺ
λ³μΉ:
ra
(Array),sa
(Set),ma
(Map) λ± - μμ£Ό μ¬μ©νλ κ°μ²΄ νμ
:
DT
(Date),RA
(Array),SA
(Set) λ± - λ°μ΄ν¨μ€ ν¨μ λ³μΉ:
ifx
(executeIf),val
(valet) λ± - 루ν ν¨μ λ³μΉ:
ff
(forForward),fb
(forBackward) λ± - μ κ·μ λΉλ:
rx
,reg
,ri
λ± μ κ·μ μμ± μ νΈλ¦¬ν° - νΉμλ¬Έμ μμ:
lt
(<),gt
(>),eq
(=) λ± νΉμλ¬Έμ μμ
// κΈ°λ³Έ νμ
λ³μΉ μ¬μ© (νμ
μμ)
if (x === u) return n;
// νμ
κ²μ¬ μμ
if (typeOf(value) === STR) {
console.log("λ¬Έμμ΄μ
λλ€");
}
// 루ν ν¨μ μ¬μ©
ff(array, (i, v) => {
console.log(i, v);
});
// μ κ·μ λΉλ μ¬μ©
const regex = ri(value + "pattern"); // new RegEx(value + pattern, "i")μ λμΌ
// κ°μ²΄ λ©μλ λ°λ‘κ°κΈ°
const keys = ok(myObject); // Object.keys(myObject)μ λμΌ
// λΉ λ₯Έ μ€ν ν λ°μ & λΉ λ₯Έ νμ¬ λ μ§/μκ° νλ
pq(time => runZeroDelayed(), dt.n);
// setTimeout(time => runZeroDelayed(), 0, new Date())μ λμΌ
- Modernism.jsμ Alienese.js(μ΅μ ) νμΌμ νλ‘μ νΈμ ν¬ν¨
- Modernism.jsλ₯Ό λ¨Όμ λ‘λν ν Alienese.jsλ₯Ό λ‘λ
- νμν ν¨μμ λ³μΉμ μ¬μ©νμ¬ μ½λ μμ±
- Alienese.js μ¬μ© μ λ°λμ Modernism.jsλ₯Ό λ¨Όμ λ‘λν΄μΌ ν©λλ€.
- κ°κ²°ν μ½λ μμ±μ μν λΌμ΄λΈλ¬λ¦¬μ΄λ―λ‘ ν λ΄μμ μ¬μ© μ μ½λ κ·μΉμ λͺ νν μ μνλ κ²μ΄ μ’μ΅λλ€.
- 짧μ λ³μΉλ€μ μ½λ κ°λ
μ±μ μν₯μ μ€ μ μμΌλ―λ‘ μ¬μ©μ μ£Όμκ° νμν©λλ€.
μ€ λλ ν μ©λμ κ΄μ¬μ΄ μκ±°λ 짧μ λ³μλͺ μ΄ μ μ λλ κ²μ μμΉ μλ κ²½μ°λ₯Ό κ³ λ €νμ¬ Modernism.jsλ§ μ¬μ©ν μ μλλ‘ λΆλ¦¬λμ΄ μμ΅λλ€.
MIT License (c) 2025 Estre Soliette (SoliEstre)
Modernism.js and Alienese.js are utility libraries that help write JavaScript code more concisely and efficiently.
They were created in 2025 by Estre Soliette (SoliEstre) as components of EstreUI.js and are also provided under the MIT license.
Modernism.js is a library that modernizes JavaScript code writing styles and provides various bypasses and monkey patches for inline processing.
This library helps write JavaScript code more concisely and expressively, preventing code from becoming verbose.
Actually, I created it because I missed features I used in Kotlin.
- Type-related constants: Clear constant definitions for basic types (
undefined
,null
,function
, etc.) - Conditional execution utilities: Simplifies conditional code execution with
executeIf
,ifReturn
, etc. - Loop utilities: Support for various loop patterns such as
forZeroToBefore
,forBackward
,forin
, etc. - Type comparison functions: Simplifies type checking with
typeOf
,typeMatch
,isObject
, etc. - Case matching: Various conditional branching patterns with
matchCase
,equalCase
,typeCase
, etc. - Object manipulation tools: Object manipulation utilities such as
copy
,patch
,revert
, etc. - Prototype extensions: Prototype extensions for method chaining such as
it
,let
,also
, etc.
// Conditional execution
let result = executeIf(hour > 10, () => {
console.log("It's past 10 o'clock, executing alarm.");
return executeAlarm();
}, () => hour);
// Method chaining
"Hello".let(it => it.toUpperCase()).let(it => it + "!"); // "HELLO!"
// Type case matching
const result = value.typeCase({
[STRING]: v => `String: ${v}`,
[NUMBER]: v => `Number: ${v}`,
[OBJECT]: v => `Object: ${JSON.stringify(v)}`,
[UNDEFINED]: _ => "Undefined",
[NULL]: _ => "Null value",
[DEFAULT]: v => `Other: ${v}`
});
Alienese.js is an extension library for Modernism.js that provides various aliases to write Modernism JS code more shortly and concisely.
Its goal is to make code more implicit, reducing code size and time spent on typing.
I made this because I didn't want to waste time typing code. Use it when you're in a hurry, then change to long names later.
- Basic type aliases: Short aliases like
u
(undefined),n
(null),t
(true),f
(false), etc. - Prototype aliases:
fnc
(Function),str
(String),num
(Number), etc. - Class name aliases:
ra
(Array),sa
(Set),ma
(Map), etc. - Commonly used object types:
DT
(Date),RA
(Array),SA
(Set), etc. - Bypass function aliases:
ifx
(executeIf),val
(valet), etc. - Loop function aliases:
ff
(forForward),fb
(forBackward), etc. - Regular expression builder: Regular expression creation utilities like
rx
,reg
,ri
, etc. - Special character constants: Special character constants like
lt
(<),gt
(>),eq
(=), etc.
// Basic type alias usage (type constants)
if (x === u) return n;
// Type checking example
if (typeOf(value) === STR) {
console.log("This is a string");
}
// Loop function usage
ff(array, (i, v) => {
console.log(i, v);
});
// Regular expression builder usage
const regex = ri(value + "pattern"); // Equivalent to new RegEx(value + pattern, "i")
// Object method shortcuts
const keys = ok(myObject); // Equivalent to Object.keys(myObject)
// Quick execution queue & fast current date/time acquisition
pq(time => runZeroDelayed(), dt.n);
// Equivalent to setTimeout(time => runZeroDelayed(), 0, new Date())
- Include Modernism.js and Alienese.js (optional) files in your project
- Load Modernism.js first, then Alienese.js
- Write code using the necessary functions and aliases
- When using Alienese.js, Modernism.js must be loaded first.
- As this is a library for concise code writing, it's advisable to clearly define code rules when used within a team.
- Short aliases can affect code readability, so caution is needed when using them.
The libraries are separated so that you can use only Modernism.js if you're not interested in semi-obfuscation purposes or don't want short variable names to be occupied.
MIT License (c) 2025 Estre Soliette (SoliEstre)