Skip to content

Commit

Permalink
Merge pull request #513 from MartijnCuppens/patch-1
Browse files Browse the repository at this point in the history
Use `const` where appropriate in README
  • Loading branch information
Vitaly Puzrin authored Aug 23, 2019
2 parents 3db03f2 + ae24505 commit 54074ae
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ your own tags), see [wiki](https://github.com/nodeca/js-yaml/wiki) and
info.

``` javascript
yaml = require('js-yaml');
fs = require('fs');
const yaml = require('js-yaml');
const fs = require('fs');

// Get document, or throw exception on error
try {
var doc = yaml.safeLoad(fs.readFileSync('/home/ixti/example.yml', 'utf8'));
const doc = yaml.safeLoad(fs.readFileSync('/home/ixti/example.yml', 'utf8'));
console.log(doc);
} catch (e) {
console.log(e);
Expand Down Expand Up @@ -135,7 +135,7 @@ The core schema also has no such restrictions. It allows binary notation for int
must additionally validate object structure to avoid injections:

``` javascript
var untrusted_code = '"toString": !<tag:yaml.org,2002:js/function> "function (){very_evil_thing();}"';
const untrusted_code = '"toString": !<tag:yaml.org,2002:js/function> "function (){very_evil_thing();}"';

// I'm just converting that string, what could possibly go wrong?
require('js-yaml').load(untrusted_code) + ''
Expand All @@ -148,7 +148,7 @@ Same as `safeLoad()`, but understands multi-document sources. Applies
`iterator` to each document if specified, or returns array of documents.

``` javascript
var yaml = require('js-yaml');
const yaml = require('js-yaml');

yaml.safeLoadAll(data, function (doc) {
console.log(doc);
Expand Down

0 comments on commit 54074ae

Please sign in to comment.