Skip to content

Commit 26e8ebe

Browse files
committed
Replace tabs with 2 spaces.
1 parent 8285a3e commit 26e8ebe

File tree

2 files changed

+43
-43
lines changed

2 files changed

+43
-43
lines changed

examples/dot_notation.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
var dot_notation = {
2-
name: "A Book",
3-
authors: ["John Power", "Jamie Walsh"],
4-
price:{
5-
value: 200,
6-
vat: function() {
7-
return this.value * 0.2;
8-
},
9-
currency: {
10-
symbol: '€',
11-
name: 'Euro'
12-
}
13-
},
14-
availability:{
15-
status: true,
16-
text: "In Stock"
17-
}
18-
};
2+
name: "A Book",
3+
authors: ["John Power", "Jamie Walsh"],
4+
price:{
5+
value: 200,
6+
vat: function() {
7+
return this.value * 0.2;
8+
},
9+
currency: {
10+
symbol: '€',
11+
name: 'Euro'
12+
}
13+
},
14+
availability:{
15+
status: true,
16+
text: "In Stock"
17+
}
18+
};

mustache.js

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -269,18 +269,18 @@ var Mustache = function() {
269269
}
270270

271271
var value;
272-
273-
// check for dot notation eg. foo.bar
274-
if(name.match(/([a-z_]+)\./ig)){
275-
value = is_kinda_truthy(this.walk_context(name, context));
276-
}
277-
else{
278-
if(is_kinda_truthy(context[name])) {
279-
value = context[name];
280-
} else if(is_kinda_truthy(this.context[name])) {
281-
value = this.context[name];
282-
}
283-
}
272+
273+
// check for dot notation eg. foo.bar
274+
if(name.match(/([a-z_]+)\./ig)){
275+
value = is_kinda_truthy(this.walk_context(name, context));
276+
}
277+
else{
278+
if(is_kinda_truthy(context[name])) {
279+
value = context[name];
280+
} else if(is_kinda_truthy(this.context[name])) {
281+
value = this.context[name];
282+
}
283+
}
284284

285285
if(typeof value === "function") {
286286
return value.apply(context);
@@ -292,21 +292,21 @@ var Mustache = function() {
292292
return "";
293293
},
294294

295-
walk_context: function(name, context){
296-
var path = name.split('.');
297-
// if the var doesn't exist in current context, check the top level context
298-
var value_context = (context[path[0]] != undefined) ? context : this.context;
299-
var value = value_context[path.shift()];
300-
while(value != undefined && path.length > 0){
301-
value_context = value;
302-
value = value[path.shift()];
303-
}
304-
// if the value is a function, call it, binding the correct context
305-
if(typeof value === "function") {
295+
walk_context: function(name, context){
296+
var path = name.split('.');
297+
// if the var doesn't exist in current context, check the top level context
298+
var value_context = (context[path[0]] != undefined) ? context : this.context;
299+
var value = value_context[path.shift()];
300+
while(value != undefined && path.length > 0){
301+
value_context = value;
302+
value = value[path.shift()];
303+
}
304+
// if the value is a function, call it, binding the correct context
305+
if(typeof value === "function") {
306306
return value.apply(value_context);
307307
}
308-
return value;
309-
},
308+
return value;
309+
},
310310

311311
// Utility methods
312312

@@ -416,4 +416,4 @@ var Mustache = function() {
416416
}
417417
}
418418
});
419-
}();
419+
}();

0 commit comments

Comments
 (0)