Skip to content

Commit ad7968a

Browse files
committed
fix various typos
1 parent 647c997 commit ad7968a

File tree

7 files changed

+79
-79
lines changed

7 files changed

+79
-79
lines changed

README.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
# SYNOPSIS
1+
# SYNOPSIS
22
[![NPM Package](https://img.shields.io/npm/v/wasm-json-toolkit.svg?style=flat-square)](https://www.npmjs.org/package/wasm-json-toolkit)
33
[![Build Status](https://img.shields.io/travis/ewasm/wasm-json-toolkit.svg?branch=master&style=flat-square)](https://travis-ci.org/ewasm/wasm-json-toolkit)
44
[![Coverage Status](https://img.shields.io/coveralls/ewasm/wasm-json-toolkit.svg?style=flat-square)](https://coveralls.io/r/ewasm/wasm-json-toolkit)
55

6-
[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)
6+
[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)
77

8-
A small toolkit for converting wasm binaries into json and back.
8+
A small toolkit for converting wasm binaries into json and back.
99

1010
# INSTALL
1111
`npm install wasm-json-toolkit`
@@ -24,8 +24,8 @@ console.log(JSON.stringify(json, null, 2))
2424
# CLI
2525
Install `-g` global for cli usage.
2626

27-
`wasm2json [FILE]` given a file containing a wasm module produces a json representation
28-
`json2wasm [FILE]` given a file containing a json representation produces a wasm module
27+
`wasm2json [FILE]` given a file containing a wasm module produces a json representation
28+
`json2wasm [FILE]` given a file containing a json representation produces a wasm module
2929

3030
# API
3131
# wasm2json
@@ -37,25 +37,25 @@ converts a wasm binary into a json representation
3737
- `Buffer` - The Webassembly Binary
3838
- `filter` - `Set` containing the name of sections to parse. If no filter is given all sections will be parsed
3939

40-
Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
40+
Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
4141

4242
# json2wasm
4343

4444
converts a json representation to a wasm binary
4545

4646
**Parameters**
4747

48-
- `Object`
48+
- `Object`
4949

50-
Returns **[Buffer](https://nodejs.org/api/buffer.html)**
50+
Returns **[Buffer](https://nodejs.org/api/buffer.html)**
5151

5252
# text2json
5353

5454
converts text to json. The only text accepted is a simple list of opcode name and immediates
5555

5656
**Parameters**
5757

58-
- `String`
58+
- `String`
5959

6060
**Examples**
6161

@@ -68,7 +68,7 @@ i64.add
6868
const json = text2json(codeStr)
6969
```
7070

71-
Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
71+
Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
7272

7373
# iterator
7474

@@ -92,7 +92,7 @@ for (const section of it) {
9292

9393
[iterator.js:26-32](https://github.com/ewasm/wasm-json-toolkit/blob/e9fdd9498451b39b84c1167e78dc4aad03b055bd/iterator.js#L26-L32 "Source code on GitHub")
9494

95-
if the orignal wasm module was modified then this will return the modified
95+
if the original wasm module was modified then this will return the modified
9696
wasm module
9797

9898
## iterator
@@ -107,14 +107,14 @@ return {Iterator.<Section>}
107107
[iterator.js:64-110](https://github.com/ewasm/wasm-json-toolkit/blob/e9fdd9498451b39b84c1167e78dc4aad03b055bd/iterator.js#L64-L110 "Source code on GitHub")
108108

109109
The section class is always internal created by the Module class. And return
110-
through the Module's iternator
110+
through the Module's iterator
111111

112112

113113
## toJSON
114114

115115
[iterator.js:83-85](https://github.com/ewasm/wasm-json-toolkit/blob/e9fdd9498451b39b84c1167e78dc4aad03b055bd/iterator.js#L83-L85 "Source code on GitHub")
116116

117-
Parses the section and return the JSON repesentation of it
117+
Parses the section and return the JSON representation of it
118118
returns {Object}
119119

120120
## appendEntries
@@ -126,10 +126,10 @@ parent wasm module.
126126

127127
**Parameters**
128128

129-
- `entries` **Arrayy&lt;[Buffer](https://nodejs.org/api/buffer.html)>**
129+
- `entries` **Array&lt;[Buffer](https://nodejs.org/api/buffer.html)>**
130130

131131

132-
## exammple json output
132+
## example json output
133133

134134
wast
135135
```
@@ -150,7 +150,7 @@ json
150150
```
151151
[
152152
{
153-
"name": "preramble",
153+
"name": "preamble",
154154
"magic": [0,97,115,109],
155155
"version": [13,0,0,0]
156156
},
@@ -186,11 +186,11 @@ json
186186
"code": [
187187
{
188188
"name": "get_local",
189-
"immediaties": "0"
189+
"immediates": "0"
190190
},
191191
{
192192
"name": "get_local",
193-
"immediaties": "1"
193+
"immediates": "1"
194194
},
195195
{
196196
"return_type": "i32",

example/out.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
0061736d0d00000001070160027f7f017f03020100070a010661646454776f00000a09010700200020016a0b
22
[
33
{
4-
"name": "preramble",
4+
"name": "preamble",
55
"magic": [
66
0,
77
97,
@@ -52,11 +52,11 @@
5252
"code": [
5353
{
5454
"name": "get_local",
55-
"immediaties": "0"
55+
"immediates": "0"
5656
},
5757
{
5858
"name": "get_local",
59-
"immediaties": "1"
59+
"immediates": "1"
6060
},
6161
{
6262
"return_type": "i32",

iterator.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module.exports = class ModuleIterator {
2121
}
2222

2323
/**
24-
* if the orignal wasm module was modified then this will return the modified
24+
* if the original wasm module was modified then this will return the modified
2525
* wasm module
2626
*/
2727
get wasm () {
@@ -60,7 +60,7 @@ module.exports = class ModuleIterator {
6060

6161
/**
6262
* The section class is always internal created by the Module class. And return
63-
* through the Module's iternator
63+
* through the Module's iterator
6464
*/
6565
class Section {
6666
constructor (sectionType, section, it, index) {
@@ -78,7 +78,7 @@ class Section {
7878
}
7979

8080
/**
81-
* Parses the section and return the JSON repesentation of it
81+
* Parses the section and return the JSON representation of it
8282
* returns {Object}
8383
*/
8484
toJSON () {
@@ -88,7 +88,7 @@ class Section {
8888
/**
8989
* Appends an array of entries to this section. NOTE: this will modify the
9090
* parent wasm module.
91-
* @param {Arrayy.<Buffer>} entries
91+
* @param {Array.<Buffer>} entries
9292
*/
9393
appendEntries (entries) {
9494
this.count += entries.length

json2wasm.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const LANGUAGE_TYPES = _exports.LANGUAGE_TYPES = {
1515
'i64': 0x7e,
1616
'f32': 0x7d,
1717
'f64': 0x7c,
18-
'anyFunc': 0x70,
18+
'anyfunc': 0x70,
1919
'func': 0x60,
2020
'block_type': 0x40
2121
}
@@ -241,7 +241,7 @@ _exports.typeGenerators = {
241241
*/
242242
memory: (json, stream) => {
243243
leb.unsigned.write(Number(json.maximum !== undefined), stream) // the flags
244-
leb.unsigned.write(json.intial, stream)
244+
leb.unsigned.write(json.initial, stream)
245245

246246
if (json.maximum !== undefined) {
247247
leb.unsigned.write(json.maximum, stream)
@@ -420,15 +420,15 @@ _exports.generateSection = function (json, stream = new Stream()) {
420420

421421
_exports.generate = (json, stream = new Stream()) => {
422422
const [ preamble, ...rest ] = json
423-
_exports.generatePreramble(preamble, stream)
423+
_exports.generatePreamble(preamble, stream)
424424
for (let item of rest) {
425425
_exports.generateSection(item, stream)
426426
}
427427

428428
return stream
429429
}
430430

431-
_exports.generatePreramble = (json, stream = new Stream()) => {
431+
_exports.generatePreamble = (json, stream = new Stream()) => {
432432
stream.write(json.magic)
433433
stream.write(json.version)
434434
return stream

0 commit comments

Comments
 (0)