Skip to content

Commit

Permalink
Use const where appropriate
Browse files Browse the repository at this point in the history
  • Loading branch information
MartijnCuppens authored Aug 23, 2019
1 parent 3db03f2 commit ae24505
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 ae24505

Please sign in to comment.