spell 0.3.0 → 0.8.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.
Files changed (54) hide show
  1. package/README.md +38 -145
  2. package/package.json +24 -21
  3. package/.npmignore +0 -4
  4. package/.travis.yml +0 -6
  5. package/LICENSE +0 -14
  6. package/spell.js +0 -347
  7. package/test/css/mocha.css +0 -110
  8. package/test/index.html +0 -34
  9. package/test/lib/JSONStream/.npmignore +0 -3
  10. package/test/lib/JSONStream/bench.js +0 -35
  11. package/test/lib/JSONStream/examples/all_docs.js +0 -13
  12. package/test/lib/JSONStream/index.js +0 -118
  13. package/test/lib/JSONStream/package.json +0 -13
  14. package/test/lib/JSONStream/readme.markdown +0 -120
  15. package/test/lib/JSONStream/test/fixtures/all_docs_include.json +0 -4245
  16. package/test/lib/JSONStream/test/fixtures/all_npm.json +0 -4030
  17. package/test/lib/JSONStream/test/parsejson.js +0 -25
  18. package/test/lib/JSONStream/test/stringify.js +0 -41
  19. package/test/lib/JSONStream/test/test.js +0 -35
  20. package/test/lib/JSONStream/test/test2.js +0 -29
  21. package/test/lib/JSONStream/test/two-ways.js +0 -41
  22. package/test/lib/jquery-1.7.1.min.js +0 -4
  23. package/test/lib/json2.js +0 -487
  24. package/test/lib/mocha-0.3.6.js +0 -2672
  25. package/test/lib/request/LICENSE +0 -55
  26. package/test/lib/request/README.md +0 -285
  27. package/test/lib/request/main.js +0 -618
  28. package/test/lib/request/mimetypes.js +0 -146
  29. package/test/lib/request/oauth.js +0 -34
  30. package/test/lib/request/package.json +0 -15
  31. package/test/lib/request/tests/googledoodle.png +0 -0
  32. package/test/lib/request/tests/run.sh +0 -6
  33. package/test/lib/request/tests/server.js +0 -57
  34. package/test/lib/request/tests/test-body.js +0 -90
  35. package/test/lib/request/tests/test-cookie.js +0 -29
  36. package/test/lib/request/tests/test-cookiejar.js +0 -90
  37. package/test/lib/request/tests/test-errors.js +0 -30
  38. package/test/lib/request/tests/test-oauth.js +0 -109
  39. package/test/lib/request/tests/test-pipes.js +0 -167
  40. package/test/lib/request/tests/test-proxy.js +0 -39
  41. package/test/lib/request/tests/test-timeout.js +0 -87
  42. package/test/lib/request/uuid.js +0 -19
  43. package/test/lib/request/vendor/cookie/index.js +0 -55
  44. package/test/lib/request/vendor/cookie/jar.js +0 -72
  45. package/test/perf.js +0 -44
  46. package/test/resources/big.js +0 -9
  47. package/test/resources/big.json +0 -29159
  48. package/test/resources/big.txt +0 -128457
  49. package/test/resources/big_browser.js +0 -29159
  50. package/test/resources/npm.js +0 -26
  51. package/test/resources/npm.json +0 -84701
  52. package/test/resources/perf1.js +0 -144
  53. package/test/resources/perf2.js +0 -366
  54. package/test/spell.js +0 -295
package/README.md CHANGED
@@ -1,166 +1,59 @@
1
- # spell
1
+ # Spell
2
2
 
3
- `spell` is a dictionary module for `node.js`. for an explanation of the algorithm, performance, expectations, and techniques used please read [this article][norvig]
3
+ **Programs you can read out loud.**
4
4
 
5
- # installation
5
+ ![A playing card, in Spell: a "card" is a view, with its suit, color, rank, and whether it is a face card](images/card-example.png)
6
6
 
7
- ## node.js
7
+ You just read a program.
8
+ Nobody taught you its syntax, and you could explain it to a friend.
8
9
 
9
- 1. install [npm]
10
- 2. `npm install spell`
11
- 3. `var spell = require('spell');`
10
+ It isn't pseudo-code, and it isn't an AI prompt:
11
+ - a rule-based parser reads Spell the same way every time
12
+ - it compiles to optimized, readable code you can run right on the web.
12
13
 
13
- ## browser
14
+ ## Solitaire in Spell
14
15
 
15
- 1. minimize spell.js
16
- 2. load it into your webpage
16
+ ![Solitaire in the Spell editor, a card selected in the Inspector](images/solitaire.png)
17
17
 
18
- # usage
18
+ <p align="center"><em>Solitaire in Spell -- animated, drag-and-drop, fully playable.</em></p>
19
19
 
20
- ## basics
20
+ ## ¡El mismo juego, en español!
21
21
 
22
- ``` js
23
- // instantiate a new dictionary
24
- var dict = spell();
25
- // load text into dictionary so we can train the dictionary to know
26
- // which words exists and which ones are more frequent than others
27
- dict.load("I am going to the park with Theo today. It's going to be the bomb");
28
- console.log(dict.suggest('thew'));
29
- ```
22
+ ![Solitaire in Spanish, its code and the Spell editor both in Spanish](images/solitario.png)
30
23
 
31
- normally you would generate the dictionary once and then use it to this code is unlikely and serves for demonstration purposes only. this should log:
24
+ <p align="center"><em>The same game, code and interface in Spanish, with automatic translation.</em></p>
32
25
 
33
- ``` js
34
- [{"word": "the", "score": 2}, {"word": "theo", "score": 1}]
35
- ```
36
26
 
37
- as there are two occurrences of the word `the` and one of the word `theo`
27
+ ## All magic, no fuss!
38
28
 
39
- feeling lucky?
29
+ ![One parser, several languages in, several targets out](images/languages-and-targets.svg)
40
30
 
41
- ``` js
42
- dict.lucky('thew');
43
- ```
31
+ - **A language** that reads like **English** (and **Spanish**): types, properties and actions are sentences.
32
+ - **A compiler** to **JavaScript**, **TypeScript** and **Python**, so what you write runs where you need it.
33
+ - **An editor** where the program, the running app and its output sit side by side.
44
34
 
45
- returns:
35
+ ## Spell UI
46
36
 
47
- ``` js
48
- "the"
49
- ```
37
+ A full set of beautifully themed web components (`<ui-button>`, `<ui-theme-editor>` ...)
38
+ that work in any page, with or without the rest of Spell.
50
39
 
51
- you can also `add` and `remove` words from the dictionary:
40
+ ![Spell UI's button page on a phone, a tablet and a laptop, on the Fruity theme](images/spell-ui.png)
52
41
 
53
- ``` js
54
- dict.remove_word('park');
55
- dict.add_word('nuno');
56
- ```
42
+ ## Status
57
43
 
58
- and you can `reset` the dictionary, making it empty:
44
+ Working now:
45
+ - **Spell**, the language: **English** and **Spanish**, in sentences or an outline.
46
+ - Output to web apps in **JavaScript**, **TypeScript** and **Python**.
47
+ - **Spell Editor**: interactively write, run, and test a program in one window.
48
+ - **Spell UI**: powerful, friendly, fully-themed web components for any page.
49
+ - **VS Code** extension: syntax colouring, errors and help as you type.
50
+ - The `spell` command line: compile, run, test and translate projects.
51
+ - AI-written spells in VSCode, via Claude Code.
59
52
 
60
- ``` js
61
- dict.reset();
62
- ```
53
+ Coming soon:
54
+ - More human input languages.
55
+ - More programming output languages.
56
+ - Publish your Spell site on the web.
57
+ - Use AI to write a spell on your computer, tablet or phone.
63
58
 
64
- if you want to export the dictionary:
65
-
66
- ``` js
67
- dict.export();
68
- ```
69
-
70
- ## advanced
71
-
72
- when loading you can provide a compiled dictionary instead of free form text
73
-
74
- ``` js
75
- dict.load(
76
- { corpus:
77
- { "I" : 1
78
- , "am" : 1
79
- , "going" : 1
80
- , "to" : 2
81
- , "the" : 1
82
- , "park" : 1
83
- }
84
- }
85
- );
86
- ```
87
-
88
- you can also provide options:
89
-
90
- * `reset`, defaults to true, meaning it will reset the dictionary before running load
91
- * `store`, defaults to true, meaning it will store the dictionary after running load
92
- * `after_store`, defaults to empty function, the callback function to run after `store` is done
93
-
94
- e.g. to add text to an existing `dict` you could do:
95
-
96
- ``` js
97
- dict.load("Better yet, chocolate", { reset: false } );
98
- ```
99
-
100
- finally when adding words you can optionally give it a score:
101
-
102
- ``` js
103
- dict.add_word('beer', {score: 100});
104
- ```
105
-
106
- if you are working with words that include punctuation in your dictionary you might need to override the alphabet that is being used. e.g. you might want to add `.` & `@` if you have a dictionary of email address. you can do that by:
107
-
108
- ``` js
109
- // instantiate a new dictionary
110
- var dict = spell();
111
- // load text into dictionary so we can train the dictionary to know
112
- // which words exists and which ones are more frequent than others
113
- dict.load("nuno@dino.saur pedro@space.ship");
114
- console.log(dict.suggest('nuno@dino.sau',
115
- "abcdefghijklmnopqrstuvwxyz.@".split("")
116
- ));
117
- ```
118
-
119
- ## storage
120
-
121
- by default `dict` is stored in process (memory) for each dictionary instance you create. however if you feel like storing the dictionary externally, or use a shared dictionary, you can:
122
-
123
- an example using `localStorage`:
124
-
125
- ``` js
126
- var dict = spell(
127
- { "get" : function () {
128
- JSON.parse(window.localStorage.getItem('dict'));
129
- }
130
- , "store" : function (dict,after_store) {
131
- window.localStorage.setItem('dict', JSON.stringify(dict));
132
- }
133
- }
134
- );
135
- ```
136
-
137
- # roadmap
138
-
139
- check [issues]
140
-
141
- # contribute
142
-
143
- everyone is welcome to contribute. patches, bug-fixes, new features
144
-
145
- 1. create an [issue][issues] so the community can comment on your idea
146
- 2. fork `spell`
147
- 3. create a new branch `git checkout -b my_branch`
148
- 4. create tests for the changes you made
149
- 5. make sure you pass both existing and newly inserted tests
150
- 6. commit your changes
151
- 7. push to your branch `git push origin my_branch`
152
- 8. create an pull request
153
-
154
- # meta
155
-
156
- * code: `git clone git://github.com/dscape/spell.git`
157
- * home: <http://github.com/dscape/spell>
158
- * bugs: <http://github.com/dscape/spell/issues>
159
- * build: [![build status](https://secure.travis-ci.org/dscape/spell.png)](http://travis-ci.org/dscape/spell)
160
-
161
- `(oO)--',-` in [caos]
162
-
163
- [npm]: http://npmjs.org
164
- [issues]: http://github.com/dscape/spell/issues
165
- [caos]: http://caos.di.uminho.pt/
166
- [norvig]: http://norvig.com/spell-correct.html
59
+ The first release is on its way, targeting **December 2026**.
package/package.json CHANGED
@@ -1,22 +1,25 @@
1
- { "name" : "spell"
2
- , "description" : "javascript dictionary module for node.js, and the browser"
3
- , "homepage" : "http://github.com/dscape/spell"
4
- , "repository" : "git://github.com/dscape/spell"
5
- , "version" : "0.3.0"
6
- , "author" : "Nuno Job <nunojobpinto@gmail.com> (http://nunojob.com)"
7
- , "contributors" :
8
- [ "Pedro Teixeira <pedro.teixeira@gmail.com> (http://metaduck.com)" ]
9
- , "keywords" :
10
- ["spell", "speller", "dictionary", "nlp", "dict", "spell check"]
11
- , "devDependencies" : { "mocha": "0.3.6", "should": "0.3.2" }
12
- , "main" : "./spell.js"
13
- , "scripts" :
14
- { "test" :
15
- "./node_modules/mocha/bin/mocha --globals _test_spell -r should test/spell.js"
16
- , "perf1" :
17
- "node --prof --trace-opt --trace-bailout --trace-deopt test/perf.js 1"
18
- , "perf2" :
19
- "node --prof --trace-opt --trace-bailout --trace-deopt test/perf.js 2"
1
+ {
2
+ "name": "spell",
3
+ "version": "0.8.1",
4
+ "description": "Spell: write programs in plain English that compile, run and draw. Coming soon.",
5
+ "keywords": [
6
+ "spell",
7
+ "language",
8
+ "compiler",
9
+ "english",
10
+ "web-components",
11
+ "ui"
12
+ ],
13
+ "homepage": "https://github.com/spell-app/spell",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/spell-app/spell.git"
17
+ },
18
+ "license": "MIT",
19
+ "files": [
20
+ "README.md"
21
+ ],
22
+ "bugs": {
23
+ "url": "https://github.com/spell-app/spell/issues"
20
24
  }
21
- , "engines" : { "node": ">=0.3.6" }
22
- }
25
+ }
package/.npmignore DELETED
@@ -1,4 +0,0 @@
1
- .DS_Store
2
- node_modules/
3
- *tmp.*
4
- *.log
package/.travis.yml DELETED
@@ -1,6 +0,0 @@
1
- language: "node_js"
2
- node_js:
3
- - 0.6
4
- branches:
5
- only:
6
- - master
package/LICENSE DELETED
@@ -1,14 +0,0 @@
1
- copyright 2011 nuno job <nunojob.com> (oO)--',--
2
- & pedro teixeira <metaduck.com>
3
-
4
- licensed under the apache license, version 2.0 (the "license");
5
- you may not use this file except in compliance with the license.
6
- you may obtain a copy of the license at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- unless required by applicable law or agreed to in writing, software
11
- distributed under the license is distributed on an "as is" basis,
12
- without warranties or conditions of any kind, either express or implied.
13
- see the license for the specific language governing permissions and
14
- limitations under the license.
package/spell.js DELETED
@@ -1,347 +0,0 @@
1
- /* javascript spell checker based on
2
- * http://norvig.com/spell-correct.html
3
- *
4
- * copyright 2011 nuno job <nunojob.com> (oO)--',--
5
- * pedro teixeira <metaduck.com>
6
- *
7
- * licensed under the apache license, version 2.0 (the "license");
8
- * you may not use this file except in compliance with the license.
9
- * you may obtain a copy of the license at
10
- *
11
- * http://www.apache.org/licenses/LICENSE-2.0
12
- *
13
- * unless required by applicable law or agreed to in writing, software
14
- * distributed under the license is distributed on an "as is" basis,
15
- * without warranties or conditions of any kind, either express or implied.
16
- * see the license for the specific language governing permissions and
17
- * limitations under the license.
18
- */
19
- (function () {
20
- var root = this
21
- , previous_spell = root.spell
22
- ;
23
-
24
- /*
25
- * dictionary
26
- *
27
- * creates a dictionary given a place to store
28
- *
29
- * @param {dict_store:object:required}
30
- * object that implements two functions
31
- * `get` to retrieve a stored dictionary from disk/memory
32
- * `store` to store a dictionary from disk/memory
33
- *
34
- * @return {object} a dictionary module
35
- */
36
- var spell = function dictionary(dict_store) {
37
- var dict =
38
- dict_store && typeof dict_store.get === 'function' ? dict_store.get() : {}
39
- , noop = function(){}
40
- , alphabet = "abcdefghijklmnopqrstuvwxyz".split("")
41
- ;
42
-
43
- function spell_store(cb) {
44
- if (dict_store && typeof dict_store.store === 'function') {
45
- dict_store.store(dict, cb);
46
- }
47
- }
48
-
49
- function spell_train(corpus,regex) {
50
- var match, word;
51
- regex = regex || /[a-z]+/g;
52
- corpus = corpus.toLowerCase();
53
- while ((match = regex.exec(corpus))) {
54
- word = match[0];
55
- spell_add_word(word, 1);
56
- }
57
- }
58
-
59
- function spell_edits(word, alphabetOverride) {
60
- var edits = []
61
- , thisAlphabet = alphabetOverride ? alphabetOverride : alphabet
62
- , i
63
- , j
64
- ;
65
- for (i=0; i < word.length; i++) { // deletion
66
- edits.push(word.slice(0, i) + word.slice(i+1));
67
- }
68
- for (i=0; i < word.length-1; i++) { // transposition
69
- edits.push( word.slice(0, i) + word.slice(i+1, i+2) +
70
- word.slice(i, i+1) + word.slice(i+2));
71
- }
72
- for (i=0; i < word.length; i++) { // alteration
73
- for(j in thisAlphabet) {
74
- edits.push(word.slice(0, i) + thisAlphabet[j] + word.slice(i+1));
75
- }
76
- }
77
- for (i=0; i <= word.length; i++) { // insertion
78
- for(j in thisAlphabet) {
79
- edits.push(word.slice(0, i) + thisAlphabet[j] + word.slice(i));
80
- }
81
- }
82
- return edits;
83
- }
84
-
85
- function is_empty(obj) {
86
- for (var key in obj) { if (obj.hasOwnProperty(key)) return false; }
87
- return true;
88
- }
89
-
90
- function spell_order(candidates, min, max) {
91
- var ordered_candidates = []
92
- , current
93
- , i
94
- , w
95
- ;
96
- for(i=max; i>=min; i--) {
97
- if(candidates.hasOwnProperty(i)) {
98
- current = candidates[i];
99
- for (w in current) {
100
- if(current.hasOwnProperty(w)) {
101
- ordered_candidates.push({"word": w, "score": i});
102
- }
103
- }
104
- }
105
- }
106
- return ordered_candidates;
107
- }
108
-
109
- /*
110
- * reset
111
- *
112
- * resets the dictionary.
113
- *
114
- * e.g.
115
- * spell.reset();
116
- *
117
- * @return void
118
- */
119
- function spell_reset() { return spell_load({reset: true}); }
120
-
121
- /*
122
- * load
123
- *
124
- * loads a free form corpus dictionary.
125
- *
126
- * e.g.
127
- * spell.load({'dog': 1, 'cat': 2});
128
- * spell.load('dog cat cat');
129
- *
130
- * @param {opts.corpus:string|object:optional}
131
- * corpus string to initialize to
132
- * @param {opts.reset:boolean:optional}
133
- * whether you want to reset the existing dictionary or just append
134
- * to what already exists
135
- * @param {opts.store:boolean:optional}
136
- * decide if you want to use storage
137
- * @param {opts.after_store:function:optional}
138
- * function to call back when store is done
139
- *
140
- * @return void
141
- */
142
- function spell_load(corpus, opts) {
143
- if ('object' === typeof corpus) { opts = corpus; }
144
- if ('string' === typeof corpus) {
145
- if('object' === typeof opts) {
146
- opts.corpus = corpus;
147
- } else {
148
- opts = {corpus: corpus };
149
- }
150
- }
151
- if ('string' === typeof opts) { opts = {corpus: opts }; }
152
- opts = 'object' === typeof opts ? opts : {};
153
- opts.reset = (opts.reset !== false);
154
- opts.store = (opts.score !== false);
155
- opts.after_store = opts.after_store || noop;
156
- opts.corpus = opts.corpus || '';
157
- if(opts.reset) { dict = {}; }
158
- if('object' === typeof opts.corpus) {
159
- for(var key in opts.corpus) {
160
- spell_add_word(key, {score: opts.corpus[key]});
161
- }
162
- } else { spell_train(opts.corpus); }
163
- if(opts.store) { spell_store(opts.after_store); }
164
- }
165
-
166
- /*
167
- * add word
168
- *
169
- * loads a word into the dictionary
170
- *
171
- * e.g.
172
- * spell.insert_word('dog', 5);
173
- *
174
- * @param {word:string:required}
175
- * the word you want to add
176
- * @param {opts.count:int:optional}
177
- * the number of times the word appears in a text, defaults to one
178
- * @param {opts.store:boolean:optional}
179
- * decide if you want to use storage
180
- * @param {opts.done:function:optional}
181
- * function to call back when store is done
182
- *
183
- * @return void
184
- */
185
- function spell_add_word(word, opts) {
186
- if ('string' === typeof opts || 'number' === typeof opts) {
187
- opts = { score: parseInt(opts, 10) };
188
- }
189
- opts = 'object' === typeof opts ? opts : {};
190
- opts.score = opts.score || 1;
191
- opts.store = opts.store || true;
192
- opts.done = opts.done || noop;
193
- word = word.toLowerCase();
194
- dict[word] =
195
- dict.hasOwnProperty(word) ? dict[word] + opts.score : opts.score;
196
- if(opts.store) { spell_store(opts.done); }
197
- }
198
-
199
- /*
200
- * remove word
201
- *
202
- * removes word from the dictionary
203
- *
204
- * e.g.
205
- * spell.remove_word('dog');
206
- *
207
- * @param {word:string:required}
208
- * the word you want to add
209
- * @param {opts.store:boolean:optional}
210
- * decide if you want to use storage
211
- * @param {opts.done:function:optional}
212
- * function to call back when store is done
213
- *
214
- * @return void
215
- */
216
- function spell_remove_word(word,opts) {
217
- opts = 'object' === typeof opts ? opts : {};
218
- opts.store = (opts.score !== false);
219
- opts.done = opts.done || noop;
220
- if (dict.hasOwnProperty(word)) { delete dict[word]; }
221
- if(opts.store) { spell_store(opts.done); }
222
- }
223
-
224
- /*
225
- * suggest
226
- *
227
- * returns spelling sugestions for a given word
228
- *
229
- * e.g.
230
- * spell.suggest('speling');
231
- *
232
- * @param {word:string:required}
233
- * the word you want to spell check
234
- * @param {alphabet:array:optional}
235
- * if you need to override checking for just words you can set this
236
- * and it will enable you to make suggestions that include punctiation
237
- * etc
238
- *
239
- * @return {array} ordered array containing json objects such as
240
- * [{"word": "spelling", "score": 10}]
241
- */
242
- function spell_suggest(word, alphabet) {
243
- if (dict.hasOwnProperty(word)) {
244
- return [{"word":word, "score": dict[word]}];
245
- }
246
- var edits1 = spell_edits(word, alphabet)
247
- , candidates = {}
248
- , min
249
- , max
250
- , current_count
251
- ;
252
- function get_candidates(word) {
253
- if(dict.hasOwnProperty(word)) {
254
- current_count = dict[word];
255
- if (candidates.hasOwnProperty(current_count)) {
256
- candidates[current_count][word] = true;
257
- } else {
258
- candidates[current_count] = {};
259
- candidates[current_count][word] = true;
260
- }
261
- max = max ? (max < current_count ? current_count : max) : current_count;
262
- min = min ? (min > current_count ? current_count : min) : current_count;
263
- }
264
- }
265
- edits1.forEach(get_candidates);
266
- if(!is_empty(candidates)) { return spell_order(candidates,min,max); }
267
- edits1.forEach(function(edit1){
268
- spell_edits(edit1, alphabet).forEach(get_candidates);
269
- });
270
- if(!is_empty(candidates)) { return spell_order(candidates,min,max); }
271
- return []; // no suggestions
272
- }
273
-
274
- /*
275
- * feeling lucky
276
- *
277
- * returns the first spelling correction for a word
278
- *
279
- * e.g.
280
- * spell.lucky('speling');
281
- *
282
- * @param {word:string:required}
283
- * the word you want to spell check
284
- * @param {alphabet:array:optional}
285
- * if you need to override checking for just words you can set this
286
- * and it will enable you to make suggestions that include punctiation
287
- * etc
288
- *
289
- * @return {string} the most likely match
290
- */
291
- function spell_lucky(word, alphabet) {
292
- var suggest = spell_suggest(word, alphabet)[0];
293
- if(suggest && suggest.hasOwnProperty("word")) {
294
- return suggest.word;
295
- }
296
- return;
297
- }
298
-
299
- /*
300
- * export
301
- *
302
- * exports the dictionary
303
- *
304
- * e.g.
305
- * spell.export();
306
- *
307
- * @return {json} dictionary
308
- */
309
- function spell_export(word) {
310
- return {corpus: dict};
311
- }
312
-
313
- return { reset : spell_reset
314
- , load : spell_load
315
- , "export" : spell_export
316
- , save : spell_export // alias
317
- , add_word : spell_add_word
318
- , addWord : spell_add_word // alias
319
- , remove_word : spell_remove_word
320
- , removeWord : spell_remove_word // alias
321
- , suggest : spell_suggest
322
- , lucky : spell_lucky
323
- };
324
- };
325
-
326
- spell._previous = previous_spell;
327
- if (typeof exports !== 'undefined') { // nodejs
328
- spell.platform = { name: "node.js", version: process.version };
329
- spell.version = JSON.parse(
330
- require('fs').readFileSync(__dirname + "/package.json")).version;
331
- spell.path = __dirname;
332
- if (typeof module !== 'undefined' && module.exports) {
333
- exports = module.exports = spell;
334
- }
335
- exports.spell = spell;
336
- } else { // browser
337
- // browser detection is possible in the future
338
- spell.platform = { name: "browser" };
339
- spell.version = "0.0.3";
340
- if (typeof define === 'function' && define.amd) {
341
- define('spell', function() { return spell; });
342
- }
343
- else {
344
- root.spell = spell;
345
- }
346
- }
347
- })();