Skip to content

Commit 3428d6a

Browse files
author
jona
authored
Merge pull request #793 from nodejs/gh-788
Make the event-geo script work on Windows
2 parents 2a90690 + 4bbdd07 commit 3428d6a

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

scripts/event-geo.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
'use strict'
2+
3+
const htmlToText = require('html-to-text')
24
const yaml = require('js-yaml')
35
const fs = require('fs')
46
const path = require('path')
5-
let p = path.join(__dirname, '..', 'locale', 'en', 'get-involved', 'events.md')
6-
let htmlToText = require('html-to-text')
77

8-
function load () {
9-
let buf = fs.readFileSync(p)
10-
let lines = buf.toString().split('\n')
11-
let str = lines.slice(lines.indexOf('---') + 1, lines.indexOf('---', lines.indexOf('---') + 1)).join('\n')
12-
let store = yaml.safeLoad(str)
8+
const p = path.join(__dirname, '..', 'locale', 'en', 'get-involved', 'events.md')
139

14-
return store
10+
function load () {
11+
// Slice the file contents to get the YAML source code.
12+
const contents = fs.readFileSync(p, { encoding: 'utf8' }).trim().slice(3, -3)
13+
return yaml.safeLoad(contents)
1514
}
1615

1716
// { type: 'Feature',

0 commit comments

Comments
 (0)