Skip to content

Commit b22715b

Browse files
committed
Fix empty strings variables substitution in templates
1 parent 9fb8e94 commit b22715b

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,14 @@ var chalk = require("chalk"),
1515

1616
function readGrammarFile(filename) {
1717
function read(filename, vars) {
18-
var yamlSource = fs.readFileSync(filename, 'utf8');
18+
var yamlSource = fs.readFileSync(filename, 'utf8'),
19+
hop = Object.prototype.hasOwnProperty;
1920

2021
if (vars) {
2122
yamlSource = yamlSource.replace(
2223
/\$\{(\w+)\}/g,
2324
function(all, name) {
24-
if (name && vars[name]) {
25+
if (name && hop.call(vars, name)) {
2526
return vars[name];
2627
} else {
2728
return all;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "syntaxdev",
3-
"version": "0.0.7",
3+
"version": "0.0.8",
44
"description": "Unit testing framework for TextMate/Sublime/Atom syntaxes.",
55
"main": "index.js",
66
"author": "Yury Selivanov <yury@magic.io>",

0 commit comments

Comments
 (0)