flatbuffers-addon
Advanced tools
Comparing version 0.0.7 to 0.1.0
20
index.js
@@ -30,6 +30,2 @@ const addon = require('bindings')('addon.node'); | ||
if (options.include_directories == null) { | ||
options.include_directories = []; | ||
} | ||
if (Buffer.isBuffer(options.conform) && options.conform_contents != null) { | ||
@@ -60,6 +56,16 @@ throw new TypeError("if conform option is a Buffer, conform_contents must be null or undefined"); | ||
if (options.conform_include_directories == null) { | ||
options.conform_include_directories = []; | ||
} | ||
[ "include_directories", "conform_include_directories" ].forEach(prop => { | ||
if (options[prop] == null) { | ||
options[prop] = []; | ||
} | ||
if (Array.isArray(options[prop])) { | ||
options[prop].forEach((str, i, arr) => { | ||
if (typeof str === "string") { | ||
arr[i] = Buffer.from(str); | ||
} | ||
}); | ||
} | ||
}); | ||
return options; | ||
@@ -66,0 +72,0 @@ } |
{ | ||
"name": "flatbuffers-addon", | ||
"version": "0.0.7", | ||
"version": "0.1.0", | ||
"description": "Node flatbuffers addon", | ||
@@ -17,3 +17,3 @@ "repository": { | ||
"scripts": { | ||
"test": "_mocha --full-trace --require tests/common.js \"tests/*-test.js\"", | ||
"test": "_mocha --full-trace \"tests/*-test.js\"", | ||
"prepublishOnly": "node scripts/clean.js && npm run install && npm run test", | ||
@@ -20,0 +20,0 @@ "download-prerequisites": "node scripts/download-prerequisites.js", |
121
README.md
@@ -82,2 +82,9 @@ # flatbuffers-addon | ||
### options.ignore\_null_scalar | ||
`type: bool` | ||
`default: false` | ||
Allow scalar fields to be null | ||
### options.allow\_non_utf8 | ||
@@ -102,2 +109,29 @@ | ||
### options.size_prefixed | ||
**NOT TESTED** | ||
`type: bool` | ||
`default: false` | ||
Input binaries are size prefixed buffers. | ||
### options.proto_mode | ||
**NOT TESTED** | ||
`type: bool` | ||
`default: false` | ||
Input is a .proto, translate to .fbs. | ||
### options.proto_oneof\_union | ||
**NOT TESTED** | ||
`type: bool` | ||
`default: false` | ||
Translate .proto oneofs to flatbuffer unions. | ||
### options.binary\_schema_comments | ||
@@ -112,2 +146,20 @@ | ||
### options.binary\_schema_builtins | ||
**NOT TESTED** | ||
`type: bool` | ||
`default: false` | ||
Add builtin attributes to the binary schema files. | ||
### options.force_defaults | ||
**NOT TESTED** | ||
`type: bool` | ||
`default: false` | ||
Emit default values in binary output from JSON. | ||
## Generate js | ||
@@ -120,10 +172,2 @@ | ||
### options.type | ||
**NOT TESTED** | ||
`type: String` | ||
`ts` to generate TypeScript code. | ||
### options.schema | ||
@@ -181,2 +225,36 @@ | ||
### options.type | ||
**NOT TESTED** | ||
`type: String` | ||
`ts` to generate TypeScript code. | ||
### options.allow\_non_utf8 | ||
**NOT TESTED** | ||
`type: bool` | ||
`default: false` | ||
Pass non-UTF-8 input through parser | ||
### options.mutable_buffer | ||
`type: bool` | ||
`default: false` | ||
Generate accessors that can mutate buffers in-place. | ||
### options.generate_all | ||
**NOT TESTED** | ||
`type: bool` | ||
`default: false` | ||
Generate not just code for the current schema files, but for all files it includes as well. | ||
If the language uses a single file for output (by default the case for C++ and JS), all code will end up in this one file. | ||
### options.skip\_js_exports | ||
@@ -200,2 +278,20 @@ | ||
### options.use\_ES6\_js\_export_format | ||
**NOT TESTED** | ||
`type: bool` | ||
`default: false` | ||
Uses ECMAScript 6 export style lines in JS. | ||
### options.keep\_include_path | ||
**NOT TESTED** | ||
`type: bool` | ||
`default: false` | ||
Keep original prefix of schema include statement. | ||
### options.skip\_flatbuffers_import | ||
@@ -219,2 +315,11 @@ | ||
### options.js\_ts\_short_names | ||
**NOT TESTED** | ||
`type: bool` | ||
`default: true` | ||
Use short function names for JS and TypeScript. | ||
## Examples | ||
@@ -221,0 +326,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
57326
575
383