0.0.7 โ€ข Published 4 years ago

emj v0.0.7

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

Emojion

Emoji Object Notation

Build Status Dependencies Version License

{
  "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.

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.3

4 years ago

0.0.4

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago