Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
regevbr committed Nov 13, 2017
1 parent fc93d1c commit c41f667
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ Which will output:
The layout:

```js
const util = require('util');

let processName = path.basename(process.argv[1]);
processName = processName.substring(0, processName.length - 3);

Expand Down Expand Up @@ -158,6 +160,32 @@ const jsonLayout = {
}
}
};

function wrapErrorsWithInspect(items) {
return items.map(function (item) {
if ((item instanceof Error) && item.stack) {
return {
inspect: function () {
return util.format(item) + '\n' + item.stack;
}
};
} else {
return item;
}
});
}

function escapedStringify(json) {
return json
.replace(/[\\]/g, '\\\\')
.replace(/[\"]/g, '\\\"')
.replace(/[\/]/g, '\\/')
.replace(/[\b]/g, '\\b')
.replace(/[\f]/g, '\\f')
.replace(/[\n]/g, '\\n')
.replace(/[\r]/g, '\\r')
.replace(/[\t]/g, '\\t');
}
```

## Contributing
Expand Down

0 comments on commit c41f667

Please sign in to comment.