emj v0.0.7
Emojion
Emoji Object Notation
{
"name": "Emojion",
"keywords": ["emoji", "notation"],
"created": 2019,
"isAbsurd": true,
"fileExtension": "๐"
}
๐๐ถ๐ ๐ค๐ณ๐ก๐๐๐ฆ๐ฆ๐๐ฆ๐ฆ๐๐ณ๐คฉ๐๐ฎ๐ญ๐คค
๐ข๐ค๐๐๐ฆ๐ฆ๐๐ค๐ฆ๐ฆ๐ข๐๐ข๐๐ฆ๐ฆ๐ค๐๐ญ๐ณ
๐ ๐๐ณ๐คค๐๐๐๐๐ค๐ข๐ ๐ ๐ฅบ๐ข๐๐ญ๐คค๐๐๐ค
๐ฅฐ๐ณ๐ ๐ณ๐ต๐๐ณ๐ถ๐ข๐ค๐ฎ๐ถ๐บ๐๐๐๐๐โ
Use
Call parse()
to turn Emojion into a JavaScript object, and call generate()
to go the other way.
import { generate, parse } from 'emj';
const object = parse('๐๐ถ๐ ๐ค๐ณ๐ก๐๐๐ฆ๐ฆ๐๐ฆ๐ฆโ');
// { name: "Emojion" }
const emojion = generate({ created: 2019 });
// ๐๐๐ญ๐ณ๐ ๐๐ณ๐คค๐๐๐๐โ
Syntax
Every Emojion document begins with ๐
โ because as soon as you start typing
Emojion, you're a winner in this author's eyes. Emojion documents end with โ
โ because... stop.
Objects are enclosed by ๐
and ๐
, arrays are enclosed by ๐ค
and ๐ค
, and
array items are separated by ๐ค
.
Keys are encoded with face emoji, such as ๐
, ๐ฅบ
, ๐
, ๐บ
, ๐ธ
, and ๐ฝ
(a
, b
, c
, 1
, 2
, 3
). Capital letters are prefixed with ๐
. ๐
represents an empty key.
Strings are encoded with animals and plants, such as ๐
, ๐
, ๐
, ๐น
,
๐ฑ
, and ๐ต
(a
, b
, c
, 1
, 2
, 3
). Capital letters are prefixed
with ๐ก
. ๐งต
represents an empty string.
Numbers are encoded with with clocks, such as ๐
, ๐
, and ๐
(0
, 1
,
2
). Decimal points are encoded with โณ๏ธ
and negative numbers are prefixed
with โฐ
(because alarms are annoying).
๐
is true
, ๐
is false
, and ๐ณ
is null
.
In keys, Unicode characters can be encoded using ๐
followed by fruit, such as
๐๐๐๐๐
for U+0398
(which is ฮ
). In values, Unicode characters are
encoded using ๐บ
followed by office supplies, such as ๐บ๐๐๐งท๐
for U+0394
(which is ฮ
).
See characters.ts
for the full character map.
Design Goals
- Unique syntax โ Emojion should be its own format, not a trivial character substitution of a different object notation language like JSON.
- Borderline legibility โ It should be possible, though likely slow, for a human to read an Emojion document, after some amount of memorization.
- Sense of humor โ Object notation is boring. Emojion should be less so.
Questions
Wait... but why?
No good reason.
No, but actually?
Well... Emojion is an exploration of emoji as first-class units of information storage. Although emoji have become utterly prevalent in modern communication, they typically either play an auxiliary role or convey only trivial information. Emojion uses solely emoji to encode complete thoughts (or, at least, valid data documents), thus exploring their ability to stand on their own.
When should I use this?
When your coworker tells you YAML is "too hard to read".
Tech
Emojion is built with the excellent Moo lexer and Nearley parser engines.