Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

add . support

  • Loading branch information...
commit b8d16770b763f01a904c18d10b4a92e82e8c694a 1 parent c0711bd
TJ Holowaychuk authored
2  lib/minstache.js
@@ -44,7 +44,7 @@ function compile(str) {
44 44
     if (i % 2 == 0) {
45 45
       js.push('"' + tok + '"');
46 46
     } else {
47  
-      if (!tok.match(/^\w+$/)) throw new Error('invalid property "' + tok + '"');
  47
+      if (!tok.match(/^[\w.]+$/)) throw new Error('invalid property "' + tok + '"');
48 48
       js.push(' + escape(obj.' + tok + ') + ');
49 49
     }
50 50
   }
5  test/index.js
@@ -16,6 +16,11 @@ describe('{{id}}', function(){
16 16
     mm('hi {{name}}.', user).should.equal('hi <script>.');
17 17
   })
18 18
 
  19
+  it('should support nested props', function(){
  20
+    var user = { name: { first: 'tobi', last: 'ferret' }};
  21
+    mm('hi {{name.first}} {{name.last}}.', user).should.equal('hi tobi ferret.');
  22
+  })
  23
+
19 24
   it('should only match words', function(done){
20 25
     try {
21 26
       mm('hi {{name)}}.');

0 notes on commit b8d1677

Please sign in to comment.
Something went wrong with that request. Please try again.