emj 0.0.11 → 0.2.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/README.md CHANGED
@@ -25,21 +25,115 @@ _Emoji Object Notation_
25
25
 
26
26
  ## Use
27
27
 
28
- Call `parse()` to turn Emojion into its original JSON text string, and call
29
- `generate()` to turn JSON text into Emojion.
28
+ ```sh
29
+ npm install emj
30
+ ```
31
+
32
+ `emj` works like the built-in `JSON` object. `parse()` turns Emojion into a
33
+ JavaScript value, and `stringify()` turns a value into Emojion.
34
+
35
+ ```ts
36
+ import { parse, stringify } from 'emj';
37
+
38
+ const value = parse('🙌😶😠🤑😳👡🐘🐁🦉🦒🐖🦉🦏✋');
39
+ // { name: 'Emojion' }
40
+
41
+ const emojion = stringify({ created: 2019 });
42
+ // '🙌😖😭😳😠😛😳🤤🕑🕛🕐🕘✋'
43
+
44
+ parse(stringify({ when: new Date(0), list: [1, undefined] }));
45
+ // { when: '1970-01-01T00:00:00.000Z', list: [1, null] }
46
+ ```
47
+
48
+ It works in Node 10 and later, from CommonJS (`require('emj')`) or ESM.
49
+
50
+ ### `parse(emojion)`
51
+
52
+ Reads an Emojion document and returns the value it holds: an object, array,
53
+ string, number, boolean or `null`, built the same way `JSON.parse()` would build
54
+ it.
55
+
56
+ - Objects are plain objects and arrays are plain arrays.
57
+ - A `__proto__` key becomes an ordinary own property; it never sets the
58
+ prototype. The same goes for any other key that `Object.prototype` has, such
59
+ as `toString`.
60
+ - When a key repeats, the last value wins.
61
+ - Numbers are converted the way `JSON.parse()` converts them, so `⏰🕛` is `-0`
62
+ and digits beyond double precision are rounded.
63
+
64
+ ### `stringify(value)`
65
+
66
+ Writes a value as an Emojion document, following the rules of
67
+ `JSON.stringify()`:
68
+
69
+ - It calls a value's `toJSON()` method, so a `Date` becomes its ISO string.
70
+ - It unwraps `new Number()`, `new String()` and `new Boolean()`.
71
+ - It writes `NaN`, `Infinity` and `-Infinity` as `null`, and `-0` as `0`.
72
+ - In objects, it skips properties whose value is `undefined`, a function or a
73
+ symbol. In arrays, it writes them, and holes, as `null`.
74
+ - It writes only own enumerable string keys, so symbol keys are skipped, and a
75
+ `Map`, `Set` or class instance becomes an object of its own properties.
76
+
77
+ `stringify()` has no `replacer` or `space` argument, and `parse()` has no
78
+ `reviver`.
79
+
80
+ ### Errors and limits
81
+
82
+ - `parse()` throws a `SyntaxError` for input that is not valid Emojion. The
83
+ message names the unexpected emoji and its position.
84
+ - `stringify()` throws a `TypeError` for a `BigInt` (unless `BigInt.prototype`
85
+ has a `toJSON()`) and for a circular structure.
86
+ - `stringify()` also throws a `TypeError` for a value Emojion cannot hold at
87
+ all: `undefined`, a function or a symbol on its own, or a `toJSON()` that
88
+ returns one. `JSON.stringify()` returns `undefined` in those cases, but every
89
+ Emojion document holds a value.
90
+ - Arrays and objects can be nested up to 512 levels deep. A top-level object
91
+ doesn't count, because it has no `👉👈`. Past that, `parse()` throws a
92
+ `SyntaxError` and `stringify()` throws a `RangeError`.
93
+
94
+ ### TypeScript
95
+
96
+ The package ships type definitions. `parse()` returns the exported `Json` type:
30
97
 
31
98
  ```ts
32
- import { generate, parse } from 'emj';
99
+ import type { Json } from 'emj';
100
+ // string | number | boolean | null | Json[] | { [key: string]: Json }
101
+ ```
102
+
103
+ `stringify()` accepts `unknown`, as `JSON.stringify()` accepts any value.
33
104
 
34
- const json = parse('🙌😶😠🤑😳👡🐘🐁🦉🦒🐖🦉🦏✋');
35
- // '{"name":"Emojion"}'
105
+ ### JSON text
36
106
 
37
- const emojion = generate(JSON.stringify({ created: 2019 }));
38
- // 🙌😖😭😳😠😛😳🤤🕑🕛🕐🕘✋
107
+ To convert between Emojion and JSON text, combine the two with `JSON`:
108
+
109
+ ```ts
110
+ const toJson = (emojion: string) => JSON.stringify(parse(emojion));
111
+ const fromJson = (json: string) => stringify(JSON.parse(json));
39
112
  ```
40
113
 
41
- Both functions use JSON text so every valid JSON value can round-trip without
42
- losing type information.
114
+ ### Migrating from 0.1
115
+
116
+ In 0.1, both functions worked with JSON text. In 0.2 they work with values.
117
+
118
+ | 0.1 | 0.2 |
119
+ | --------------------------------- | -------------------------------- |
120
+ | `JSON.parse(parse(emojion))` | `parse(emojion)` |
121
+ | `parse(emojion)` | `JSON.stringify(parse(emojion))` |
122
+ | `generate(json)` | `stringify(JSON.parse(json))` |
123
+ | `generate(JSON.stringify(value))` | `stringify(value)` |
124
+
125
+ - `generate()` is gone. Use `stringify()`, which takes a value, not JSON text.
126
+ Passing JSON text to `stringify()` writes it as a string, so make sure every
127
+ old `generate(json)` call becomes `stringify(JSON.parse(json))`.
128
+ - `parse()` returns a value, not a string. If you kept the 0.1 JSON text without
129
+ parsing it, note that a repeated key was in the text twice; now only the last
130
+ value is kept, as `JSON.parse()` would have done.
131
+ - `stringify()` applies the `JSON.stringify()` rules above itself. A `BigInt`, a
132
+ circular structure, or a top-level `undefined`, function or symbol throws a
133
+ `TypeError` from `stringify()` rather than from your own `JSON.stringify()`
134
+ call (or, for a top-level `undefined`, rather than passing `undefined` on).
135
+ - The `RangeError` for deep nesting now says "Value nesting exceeds 512 levels"
136
+ instead of "JSON nesting exceeds 512 levels".
43
137
 
44
138
  ## Syntax
45
139
 
@@ -48,7 +142,8 @@ Emojion, you're a winner in this author's eyes. Emojion documents end with `✋`
48
142
  — because... stop.
49
143
 
50
144
  Objects are enclosed by `👉` and `👈`, arrays are enclosed by `🤜` and `🤛`, and
51
- array items are separated by `🤝`.
145
+ array items are separated by `🤝`. A top-level object has no `👉` and `👈`. A
146
+ document can also hold one array, string, number, boolean, or `null`.
52
147
 
53
148
  Keys are encoded with face emoji, such as `😠`, `🥺`, `😖`, `😺`, `😸`, and `😽`
54
149
  (`a`, `b`, `c`, `1`, `2`, `3` ). Capital letters are prefixed with `👠`. `🗝`
@@ -58,16 +153,20 @@ Strings are encoded with animals and plants, such as `🐜`, `🐝`, `🐄`, `
58
153
  `🌱`, and `🌵` (`a`, `b`, `c`, `1`, `2`, `3` ). Capital letters are prefixed
59
154
  with `👡`. `🧵` represents an empty string.
60
155
 
61
- Numbers are encoded with with clocks, such as `🕛`, `🕐`, and `🕑` (`0`, `1`,
62
- `2`). Decimal points are encoded with `⛳️` and negative numbers are prefixed
63
- with `⏰` (because alarms are annoying).
156
+ Numbers are encoded with clocks, such as `🕛`, `🕐`, and `🕑` (`0`, `1`, `2`).
157
+ Decimal points are encoded with `⛳️` and negative numbers are prefixed with `⏰`
158
+ (because alarms are annoying). Exponents are prefixed with `🚀` (because they
159
+ make numbers take off), so `1e-7` is `🕐🚀⏰🕖`.
64
160
 
65
161
  `💚` is `true`, `💔` is `false`, and `🕳` is `null`.
66
162
 
67
163
  In keys, Unicode characters can be encoded using `🌎` followed by fruit, such as
68
164
  `🌎🍏🍊🍈🍓` for `U+0398` (which is `Θ`). In values, Unicode characters are
69
165
  encoded using `🗺` followed by office supplies, such as `🗺🖋🖊🧷🔎` for `U+0394`
70
- (which is `Δ`).
166
+ (which is `Δ`). An encoded character can use up to six of these digits.
167
+
168
+ Whitespace and emoji variation selectors are ignored. Arrays and objects can be
169
+ nested up to 512 levels deep.
71
170
 
72
171
  See [`characters.ts`](./src/characters.ts) for the full character map.
73
172
 
@@ -99,35 +198,9 @@ When your coworker tells you YAML is "too hard to read".
99
198
 
100
199
  ## Tech
101
200
 
102
- Emojion is built with the excellent
103
- [Moo lexer](https://www.npmjs.com/package/moo) and
104
- [Nearley parser](https://nearley.js.org) engines.
105
-
106
- ## Publishing
107
-
108
- Emojion is a maintained joke package: its premise is intentionally absurd, but
109
- its runtime dependencies and published security posture are maintained like any
110
- other library. Garden keeps development tooling and compatible lockfile
111
- resolutions current while runtime-range changes remain deliberate.
112
-
113
- Garden dispatches [`Prepare Release`](./.github/workflows/prepare-release.yml)
114
- with an exact semantic version. The tag is the release source of truth; the
115
- publisher checks out that immutable tag and stamps the package manifest only in
116
- its packaging worktree before publishing to npm and creating the matching GitHub
117
- Release. Routine releases are batched to at most one per week.
118
-
119
- Publishing uses npm Trusted Publishing.
120
-
121
- Configure the `emj` package on npm with this trusted publisher:
122
-
123
- - Provider: GitHub Actions
124
- - Organization or user: `agorischek`
125
- - Repository: `emojion`
126
- - Workflow filename: `publish.yml`
127
- - Environment name: leave blank
128
-
129
- You can also configure it from an authenticated npm CLI:
130
-
131
- ```sh
132
- npx npm@latest trust github emj --repo agorischek/emojion --file publish.yml
133
- ```
201
+ Emojion has no runtime dependencies. `parse()` reads each document in a single
202
+ pass with a hand-written parser that builds values as it goes, and `stringify()`
203
+ walks the value directly; neither goes through JSON text. Run `npm run bench` to
204
+ measure their speed next to `JSON.parse()` and `JSON.stringify()`, or
205
+ `npm run bench:ab -- <ref> <ref>` to compare two versions. See
206
+ [`bench/RESULTS.md`](./bench/RESULTS.md) for measurements.
@@ -0,0 +1,165 @@
1
+ export declare const characters: {
2
+ document: {
3
+ arrayClose: string;
4
+ arrayDelimit: string;
5
+ arrayOpen: string;
6
+ end: string;
7
+ indent: string;
8
+ outdent: string;
9
+ start: string;
10
+ };
11
+ keys: {
12
+ letters: {
13
+ a: string;
14
+ b: string;
15
+ c: string;
16
+ d: string;
17
+ e: string;
18
+ f: string;
19
+ g: string;
20
+ h: string;
21
+ i: string;
22
+ j: string;
23
+ k: string;
24
+ l: string;
25
+ m: string;
26
+ n: string;
27
+ o: string;
28
+ p: string;
29
+ q: string;
30
+ r: string;
31
+ s: string;
32
+ t: string;
33
+ u: string;
34
+ v: string;
35
+ w: string;
36
+ x: string;
37
+ y: string;
38
+ z: string;
39
+ };
40
+ modifiers: {
41
+ unicode: string;
42
+ upperCase: string;
43
+ };
44
+ numerals: {
45
+ 0: string;
46
+ 1: string;
47
+ 2: string;
48
+ 3: string;
49
+ 4: string;
50
+ 5: string;
51
+ 6: string;
52
+ 7: string;
53
+ 8: string;
54
+ 9: string;
55
+ };
56
+ other: {
57
+ empty: string;
58
+ };
59
+ unicode: {
60
+ 0: string;
61
+ 1: string;
62
+ 2: string;
63
+ 3: string;
64
+ 4: string;
65
+ 5: string;
66
+ 6: string;
67
+ 7: string;
68
+ 8: string;
69
+ 9: string;
70
+ a: string;
71
+ b: string;
72
+ c: string;
73
+ d: string;
74
+ e: string;
75
+ f: string;
76
+ };
77
+ };
78
+ values: {
79
+ booleans: {
80
+ false: string;
81
+ true: string;
82
+ };
83
+ letters: {
84
+ a: string;
85
+ b: string;
86
+ c: string;
87
+ d: string;
88
+ e: string;
89
+ f: string;
90
+ g: string;
91
+ h: string;
92
+ i: string;
93
+ j: string;
94
+ k: string;
95
+ l: string;
96
+ m: string;
97
+ n: string;
98
+ o: string;
99
+ p: string;
100
+ q: string;
101
+ r: string;
102
+ s: string;
103
+ t: string;
104
+ u: string;
105
+ v: string;
106
+ w: string;
107
+ x: string;
108
+ y: string;
109
+ z: string;
110
+ };
111
+ modifiers: {
112
+ unicode: string;
113
+ upperCase: string;
114
+ negative: string;
115
+ };
116
+ numbers: {
117
+ 0: string;
118
+ 1: string;
119
+ 2: string;
120
+ 3: string;
121
+ 4: string;
122
+ 5: string;
123
+ 6: string;
124
+ 7: string;
125
+ 8: string;
126
+ 9: string;
127
+ '.': string;
128
+ e: string;
129
+ };
130
+ numerals: {
131
+ 0: string;
132
+ 1: string;
133
+ 2: string;
134
+ 3: string;
135
+ 4: string;
136
+ 5: string;
137
+ 6: string;
138
+ 7: string;
139
+ 8: string;
140
+ 9: string;
141
+ };
142
+ other: {
143
+ null: string;
144
+ emptyString: string;
145
+ };
146
+ unicode: {
147
+ 0: string;
148
+ 1: string;
149
+ 2: string;
150
+ 3: string;
151
+ 4: string;
152
+ 5: string;
153
+ 6: string;
154
+ 7: string;
155
+ 8: string;
156
+ 9: string;
157
+ a: string;
158
+ b: string;
159
+ c: string;
160
+ d: string;
161
+ e: string;
162
+ f: string;
163
+ };
164
+ };
165
+ };
@@ -0,0 +1,169 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.characters = void 0;
4
+ exports.characters = {
5
+ document: {
6
+ arrayClose: '🤛',
7
+ arrayDelimit: '🤝',
8
+ arrayOpen: '🤜',
9
+ end: '✋',
10
+ indent: '👉',
11
+ outdent: '👈',
12
+ start: '🙌',
13
+ },
14
+ keys: {
15
+ letters: {
16
+ a: '😠',
17
+ b: '🥺',
18
+ c: '😖',
19
+ d: '🤤',
20
+ e: '😳',
21
+ f: '🙁',
22
+ g: '🤪',
23
+ h: '😃',
24
+ i: '🤔',
25
+ j: '😂',
26
+ k: '😚',
27
+ l: '🥰',
28
+ m: '🤑',
29
+ n: '😶',
30
+ o: '😮',
31
+ p: '🥳',
32
+ q: '🤫',
33
+ r: '😭',
34
+ s: '😢',
35
+ t: '😛',
36
+ u: '🙃',
37
+ v: '😁',
38
+ w: '😉',
39
+ x: '😵',
40
+ y: '🤩',
41
+ z: '🤐',
42
+ },
43
+ modifiers: {
44
+ unicode: '🌎',
45
+ upperCase: '👠',
46
+ },
47
+ numerals: {
48
+ 0: '🐱',
49
+ 1: '😺',
50
+ 2: '😸',
51
+ 3: '😽',
52
+ 4: '😻',
53
+ 5: '😹',
54
+ 6: '😿',
55
+ 7: '😾',
56
+ 8: '😼',
57
+ 9: '🙀',
58
+ },
59
+ other: {
60
+ empty: '🗝',
61
+ },
62
+ unicode: {
63
+ 0: '🍏',
64
+ 1: '🍎',
65
+ 2: '🍐',
66
+ 3: '🍊',
67
+ 4: '🍋',
68
+ 5: '🍌',
69
+ 6: '🍉',
70
+ 7: '🍇',
71
+ 8: '🍓',
72
+ 9: '🍈',
73
+ a: '🍒',
74
+ b: '🍑',
75
+ c: '🥭',
76
+ d: '🍍',
77
+ e: '🥥',
78
+ f: '🥝',
79
+ },
80
+ },
81
+ values: {
82
+ booleans: {
83
+ false: '💔',
84
+ true: '💚',
85
+ },
86
+ letters: {
87
+ a: '🐜',
88
+ b: '🐝',
89
+ c: '🐄',
90
+ d: '🐬',
91
+ e: '🐘',
92
+ f: '🐟',
93
+ g: '🐐',
94
+ h: '🦔',
95
+ i: '🐖',
96
+ j: '🦒',
97
+ k: '🦘',
98
+ l: '🦞',
99
+ m: '🐁',
100
+ n: '🦏',
101
+ o: '🦉',
102
+ p: '🦚',
103
+ q: '🦑',
104
+ r: '🦝',
105
+ s: '🐌',
106
+ t: '🐢',
107
+ u: '🦋',
108
+ v: '🕊',
109
+ w: '🐋',
110
+ x: '🐂',
111
+ y: '🦃',
112
+ z: '🦓',
113
+ },
114
+ modifiers: {
115
+ unicode: '🗺',
116
+ upperCase: '👡',
117
+ negative: '⏰',
118
+ },
119
+ numbers: {
120
+ 0: '🕛',
121
+ 1: '🕐',
122
+ 2: '🕑',
123
+ 3: '🕒',
124
+ 4: '🕓',
125
+ 5: '🕔',
126
+ 6: '🕕',
127
+ 7: '🕖',
128
+ 8: '🕗',
129
+ 9: '🕘',
130
+ '.': '⛳️',
131
+ e: '🚀',
132
+ },
133
+ numerals: {
134
+ 0: '🌻',
135
+ 1: '🌷',
136
+ 2: '🌱',
137
+ 3: '🌵',
138
+ 4: '🍀',
139
+ 5: '🌺',
140
+ 6: '🌾',
141
+ 7: '🌿',
142
+ 8: '🌼',
143
+ 9: '🌹',
144
+ },
145
+ other: {
146
+ null: '🕳',
147
+ emptyString: '🧵',
148
+ },
149
+ unicode: {
150
+ 0: '🖋',
151
+ 1: '🖌',
152
+ 2: '🖍',
153
+ 3: '🖊',
154
+ 4: '🔎',
155
+ 5: '📐',
156
+ 6: '📏',
157
+ 7: '📍',
158
+ 8: '📌',
159
+ 9: '🧷',
160
+ a: '📎',
161
+ b: '📁',
162
+ c: '📓',
163
+ d: '📒',
164
+ e: '📕',
165
+ f: '📋',
166
+ },
167
+ },
168
+ };
169
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hhcmFjdGVycy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9jaGFyYWN0ZXJzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFhLFFBQUEsVUF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LknLFxuICAgICAgNjogJ/CfmL8nLFxuICAgICAgNzogJ/CfmL4nLFxuICAgICAgODogJ/CfmLwnLFxuICAgICAgOTogJ/CfmYAnLFxuICAgIH0sXG4gICAgb3RoZXI6IHtcbiAgICAgIGVtcHR5OiAn8J+XnScsXG4gICAgfSxcbiAgICB1bmljb2RlOiB7XG4gICAgICAwOiAn8J+NjycsXG4gICAgICAxOiAn8J+NjicsXG4gICAgICAyOiAn8J+NkCcsXG4gICAgICAzOiAn8J+NiicsXG4gICAgICA0OiAn8J+NiycsXG4gICAgICA1OiAn8J+NjCcsXG4gICAgICA2OiAn8J+NiScsXG4gICAgICA3OiAn8J+NhycsXG4gICAgICA4OiAn8J+NkycsXG4gICAgICA5OiAn8J+NiCcsXG4gICAgICBhOiAn8J+NkicsXG4gICAgICBiOiAn8J+NkScsXG4gICAgICBjOiAn8J+lrScsXG4gICAgICBkOiAn8J+NjScsXG4gICAgICBlOiAn8J+lpScsXG4gICAgICBmOiAn8J+lnScsXG4gICAgfSxcbiAgfSxcbiAgdmFsdWVzOiB7XG4gICAgYm9vbGVhbnM6IHtcbiAgICAgIGZhbHNlOiAn8J+SlCcsXG4gICAgICB0cnVlOiAn8J+SmicsXG4gICAgfSxcbiAgICBsZXR0ZXJzOiB7XG4gICAgICBhOiAn8J+QnCcsXG4gICAgICBiOiAn8J+QnScsXG4gICAgICBjOiAn8J+QhCcsXG4gICAgICBkOiAn8J+QrCcsXG4gICAgICBlOiAn8J+QmCcsXG4gICAgICBmOiAn8J+QnycsXG4gICAgICBnOiAn8J+QkCcsXG4gICAgICBoOiAn8J+mlCcsXG4gICAgICBpOiAn8J+QlicsXG4gICAgICBqOiAn8J+mkicsXG4gICAgICBrOiAn8J+mmCcsXG4gICAgICBsOiAn8J+mnicsXG4gICAgICBtOiAn8J+QgScsXG4gICAgICBuOiAn8J+mjycsXG4gICAgICBvOiAn8J+miScsXG4gICAgICBwOiAn8J+mmicsXG4gICAgICBxOiAn8J+mkScsXG4gICAgICByOiAn8J+mnScsXG4gICAgICBzOiAn8J+QjCcsXG4gICAgICB0OiAn8J+QoicsXG4gICAgICB1OiAn8J+miycsXG4gICAgICB2OiAn8J+ViicsXG4gICAgICB3OiAn8J+QiycsXG4gICAgICB4OiAn8J+QgicsXG4gICAgICB5OiAn8J+mgycsXG4gICAgICB6OiAn8J+mkycsXG4gICAgfSxcbiAgICBtb2RpZmllcnM6IHtcbiAgICAgIHVuaWNvZGU6ICfwn5e6JyxcbiAgICAgIHVwcGVyQ2FzZTogJ/CfkaEnLFxuICAgICAgbmVnYXRpdmU6ICfij7AnLFxuICAgIH0sXG4gICAgbnVtYmVyczoge1xuICAgICAgMDogJ/CflZsnLFxuICAgICAgMTogJ/CflZAnLFxuICAgICAgMjogJ/CflZEnLFxuICAgICAgMzogJ/CflZInLFxuICAgICAgNDogJ/CflZMnLFxuICAgICAgNTogJ/CflZQnLFxuICAgICAgNjogJ/CflZUnLFxuICAgICAgNzogJ/CflZYnLFxuICAgICAgODogJ/CflZcnLFxuICAgICAgOTogJ/CflZgnLFxuICAgICAgJy4nOiAn4puz77iPJyxcbiAgICAgIGU6ICfwn5qAJyxcbiAgICB9LFxuICAgIG51bWVyYWxzOiB7XG4gICAgICAwOiAn8J+MuycsXG4gICAgICAxOiAn8J+MtycsXG4gICAgICAyOiAn8J+MsScsXG4gICAgICAzOiAn8J+MtScsXG4gICAgICA0OiAn8J+NgCcsXG4gICAgICA1OiAn8J+MuicsXG4gICAgICA2OiAn8J+MvicsXG4gICAgICA3OiAn8J+MvycsXG4gICAgICA4OiAn8J+MvCcsXG4gICAgICA5OiAn8J+MuScsXG4gICAgfSxcbiAgICBvdGhlcjoge1xuICAgICAgbnVsbDogJ/CflbMnLFxuICAgICAgZW1wdHlTdHJpbmc6ICfwn6e1JyxcbiAgICB9LFxuICAgIHVuaWNvZGU6IHtcbiAgICAgIDA6ICfwn5aLJyxcbiAgICAgIDE6ICfwn5aMJyxcbiAgICAgIDI6ICfwn5aNJyxcbiAgICAgIDM6ICfwn5aKJyxcbiAgICAgIDQ6ICfwn5SOJyxcbiAgICAgIDU6ICfwn5OQJyxcbiAgICAgIDY6ICfwn5OPJyxcbiAgICAgIDc6ICfwn5ONJyxcbiAgICAgIDg6ICfwn5OMJyxcbiAgICAgIDk6ICfwn6e3JyxcbiAgICAgIGE6ICfwn5OOJyxcbiAgICAgIGI6ICfwn5OBJyxcbiAgICAgIGM6ICfwn5OTJyxcbiAgICAgIGQ6ICfwn5OSJyxcbiAgICAgIGU6ICfwn5OVJyxcbiAgICAgIGY6ICfwn5OLJyxcbiAgICB9LFxuICB9LFxufTtcbiJdfQ==
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Write a value as an Emojion document, as `JSON.stringify()` writes JSON
3
+ * text, following the same rules:
4
+ *
5
+ * - It calls a value's `toJSON(key)` method, so a `Date` becomes its ISO
6
+ * string.
7
+ * - It unwraps `new Number()`, `new String()` and `new Boolean()`.
8
+ * - It writes `NaN`, `Infinity` and `-Infinity` as `null`, and `-0` as `0`.
9
+ * - It skips `undefined`, functions and symbols in objects, and writes them
10
+ * (and array holes) as `null` in arrays.
11
+ * - It writes only own enumerable string keys.
12
+ *
13
+ * @param value - The value to write.
14
+ * @returns The Emojion document, from `🙌` to `✋`.
15
+ * @throws {TypeError} For a BigInt (unless `BigInt.prototype.toJSON` is
16
+ * defined), for a circular structure, and for a value Emojion cannot hold at
17
+ * all: `undefined`, a function or a symbol on its own. (`JSON.stringify()`
18
+ * returns `undefined` for those; every Emojion document holds a value.)
19
+ * @throws {RangeError} If arrays and objects nest more than 512 levels deep.
20
+ *
21
+ * @example
22
+ * stringify({ created: 2019 });
23
+ * //=> '🙌😖😭😳😠😛😳🤤🕑🕛🕐🕘✋'
24
+ *
25
+ * @example
26
+ * stringify([1, undefined, new Date(0)]);
27
+ * //=> the same document as stringify([1, null, '1970-01-01T00:00:00.000Z'])
28
+ */
29
+ export declare const stringify: (value: unknown) => string;