Skip to content
This repository was archived by the owner on Jul 8, 2023. It is now read-only.

Commit 428cef4

Browse files
committed
Simplified example.
1 parent 6213f19 commit 428cef4

File tree

1 file changed

+5
-16
lines changed

1 file changed

+5
-16
lines changed

README.md

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -47,29 +47,17 @@ embedded code.
4747

4848
```js
4949
var couchdbBuilder = require('couchdb-builder');
50-
var fs = require('fs');
51-
var jsonStringify = require('json-stable-stringify');
5250

5351
couchdbBuilder.build(sourcePath).then(
5452
function (result) {
55-
fs.writeFile(
56-
targetPath,
57-
jsonStringify(result) + "\n",
58-
function (e) {
59-
console.error('Error writing file: ' + e);
60-
}
61-
);
53+
// handle result
6254
},
63-
function (e) {
64-
console.error('Error building document: ' + e);
55+
function (error) {
56+
// handle error
6557
}
6658
);
6759
```
6860

69-
Note that [json-stable-stringify] is used instead of [JSON.stringify] to ensure
70-
idempotent output, which helps reduce diff churn when the build product is
71-
committed to a version control repository.
72-
7361
[promise]: https://promisesaplus.com/
7462

7563
## Differences to [couchdb-compile]
@@ -150,6 +138,8 @@ meaningful way).
150138
*CouchDB builder* utilizes [json-stable-stringify] instead of [JSON.stringify],
151139
to ensure that its output is idempotent (always the same, given the same input).
152140

141+
[json-stable-stringify]: https://github.com/substack/json-stable-stringify
142+
153143
### Unsupported features
154144

155145
The following features of [couchdb-compile] are not currently supported. Please
@@ -164,5 +154,4 @@ open an issue if further discussion is warranted:
164154
<!-- References -->
165155

166156
[couchdb-compile]: https://github.com/jo/couchdb-compile
167-
[json-stable-stringify]: https://github.com/substack/json-stable-stringify
168157
[json.stringify]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify

0 commit comments

Comments
 (0)