mustache-js-rails 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of mustache-js-rails might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3efc59f2fbc6520360b21c37a205213dde47dc25
4
- data.tar.gz: dda31c41707ad5a12d80c760385d866a24cdff1d
3
+ metadata.gz: 3609b79020e2ea9f1a959a813b19de358553c6b0
4
+ data.tar.gz: 42013fc4762883b2ac589f91129960c535baedaa
5
5
  SHA512:
6
- metadata.gz: a8f72c19a95b1a00cfb4953bc79fcc5e7df4d7280424d5b19996e1558a242f8e37f23e5e188ea07ad1e709c2510a4f5c5c5f7267710fadde6027a9632bb4ab65
7
- data.tar.gz: 4ab84cfefbb4885678259d0ea97b28817ec7a0d5ff012ae89da717afaacaafe0be56ea71c8e5f9a84f5bf690e80dd087e734d87d0c113db281c7f35ae1096343
6
+ metadata.gz: 88e7fa28e5f472f88457fbf0af7306d051ab6021c709644c6f15fda7d408a5edc386f381bbba71daece690c1670fa5d5036d61c807058ef269f5e44d70dbb2c9
7
+ data.tar.gz: 6fd38eb734ffd21ea157a78c8c4bda34f62c9e6e1f3a54504edafb06f0a61c9b6826b146776899c4421ea5be1eb7669f15db1fd7bd8d0084bbe1dac7e0121881
data/README.md CHANGED
@@ -5,7 +5,7 @@ and [mustache jQuery integration](https://github.com/jonnyreeves/jquery-Mustache
5
5
 
6
6
  Integrated versions are:
7
7
 
8
- * mustache.js - <b id="mustache-js-version">2.0.0</b>
8
+ * mustache.js - <b id="mustache-js-version">2.1.2</b>
9
9
  * jQuery mustache - <b id="jquery-mustache-js-version">0.2.8</b>
10
10
 
11
11
  ### Installation
@@ -1,3 +1,3 @@
1
1
  module MustacheJsRails
2
- VERSION = "2.0.0"
2
+ VERSION = "2.0.1"
3
3
  end
@@ -3,7 +3,7 @@
3
3
  * http://github.com/janl/mustache.js
4
4
  */
5
5
 
6
- /*global define: false*/
6
+ /*global define: false Mustache: true*/
7
7
 
8
8
  (function defineMustache (global, factory) {
9
9
  if (typeof exports === 'object' && exports) {
@@ -11,7 +11,8 @@
11
11
  } else if (typeof define === 'function' && define.amd) {
12
12
  define(['exports'], factory); // AMD
13
13
  } else {
14
- factory(global.Mustache = {}); // <script>
14
+ global.Mustache = {};
15
+ factory(Mustache); // script, wsh, asp
15
16
  }
16
17
  }(this, function mustacheFactory (mustache) {
17
18
 
@@ -24,10 +25,26 @@
24
25
  return typeof object === 'function';
25
26
  }
26
27
 
28
+ /**
29
+ * More correct typeof string handling array
30
+ * which normally returns typeof 'object'
31
+ */
32
+ function typeStr (obj) {
33
+ return isArray(obj) ? 'array' : typeof obj;
34
+ }
35
+
27
36
  function escapeRegExp (string) {
28
37
  return string.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, '\\$&');
29
38
  }
30
39
 
40
+ /**
41
+ * Null safe way of checking whether or not an object,
42
+ * including its prototype, has a given property
43
+ */
44
+ function hasProperty (obj, propName) {
45
+ return obj != null && typeof obj === 'object' && (propName in obj);
46
+ }
47
+
31
48
  // Workaround for https://issues.apache.org/jira/browse/COUCHDB-577
32
49
  // See https://github.com/janl/mustache.js/issues/189
33
50
  var regExpTest = RegExp.prototype.test;
@@ -355,7 +372,7 @@
355
372
  var cache = this.cache;
356
373
 
357
374
  var value;
358
- if (name in cache) {
375
+ if (cache.hasOwnProperty(name)) {
359
376
  value = cache[name];
360
377
  } else {
361
378
  var context = this, names, index, lookupHit = false;
@@ -378,14 +395,14 @@
378
395
  * `undefined` and we want to avoid looking up parent contexts.
379
396
  **/
380
397
  while (value != null && index < names.length) {
381
- if (index === names.length - 1 && value != null)
382
- lookupHit = (typeof value === 'object') &&
383
- value.hasOwnProperty(names[index]);
398
+ if (index === names.length - 1)
399
+ lookupHit = hasProperty(value, names[index]);
400
+
384
401
  value = value[names[index++]];
385
402
  }
386
- } else if (context.view != null && typeof context.view === 'object') {
403
+ } else {
387
404
  value = context.view[name];
388
- lookupHit = context.view.hasOwnProperty(name);
405
+ lookupHit = hasProperty(context.view, name);
389
406
  }
390
407
 
391
408
  if (lookupHit)
@@ -548,7 +565,7 @@
548
565
  };
549
566
 
550
567
  mustache.name = 'mustache.js';
551
- mustache.version = '2.0.0';
568
+ mustache.version = '2.1.2';
552
569
  mustache.tags = [ '{{', '}}' ];
553
570
 
554
571
  // All high-level mustache.* functions use this writer.
@@ -575,6 +592,12 @@
575
592
  * default writer.
576
593
  */
577
594
  mustache.render = function render (template, view, partials) {
595
+ if (typeof template !== 'string') {
596
+ throw new TypeError('Invalid template! Template should be a "string" ' +
597
+ 'but "' + typeStr(template) + '" was given as the first ' +
598
+ 'argument for mustache#render(template, view, partials)');
599
+ }
600
+
578
601
  return defaultWriter.render(template, view, partials);
579
602
  };
580
603
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mustache-js-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Krzysztof Knapik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-13 00:00:00.000000000 Z
11
+ date: 2015-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -68,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
68
68
  version: '0'
69
69
  requirements: []
70
70
  rubyforge_project: mustache-js-rails
71
- rubygems_version: 2.4.3
71
+ rubygems_version: 2.4.6
72
72
  signing_key:
73
73
  specification_version: 4
74
74
  summary: mustache.js and jQuery.mustache.js for Rails 3.1+ asset pipeline