mustache-js-rails 3.1.0.1 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 56f86fdf18b2a6e8b4ccc8b5359b728f08ad3ced8994ae94f3ea848ee1bfe916
4
- data.tar.gz: f18e12833bec29d7038dee1ef9cb18b2266cc7a159b48d1455ee528888462a58
3
+ metadata.gz: 395673337daaed970f219b3d086caeaa53ebecc8e2f4c65d32a96954601517d4
4
+ data.tar.gz: 984772069e481c77cb285343756243af471848173ac69f5b23ec225151699ea4
5
5
  SHA512:
6
- metadata.gz: 6de4c7590a0006dfc225a73f93165a719fb3f1e2d15b720b431b894dc7b2d809be53225318f9613be74f3e8caae9029fd6aaa0fae37c8750beac14e271dcc108
7
- data.tar.gz: 1eae1338c921d4fd78c9663d6f1b9c84685d2e5b75231297279e3aa3669767fc5b0b784cdab3bd79b2a50b5087c4dc5a956ef5e4e3aac5005bdcb2ed1e16eb47
6
+ metadata.gz: 9d2800c3786b8a6dca1be59ad35b43321bde450c795fc579d329c0a0815724bb9695c04c7526036c754bfe9503941aede5c0d9b2ce95a915338c9b77df354122
7
+ data.tar.gz: 57b04c5a074d5f9d99e03e182937ae0a94f4dcd991b89a5d0710cfb9bc641c65dae69acc53dede40425738168b08291022389c319b3a4587ffe16544668dd4cf
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">3.1.0</b>
8
+ * mustache.js - <b id="mustache-js-version">4.0.0</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 = "3.1.0.1"
2
+ VERSION = "4.0.0"
3
3
  end
@@ -1,20 +1,14 @@
1
- /*!
2
- * mustache.js - Logic-less {{mustache}} templates with JavaScript
3
- * http://github.com/janl/mustache.js
4
- */
5
-
6
- /*global define: false Mustache: true*/
7
-
8
- (function defineMustache (global, factory) {
9
- if (typeof exports === 'object' && exports && typeof exports.nodeName !== 'string') {
10
- factory(exports); // CommonJS
11
- } else if (typeof define === 'function' && define.amd) {
12
- define(['exports'], factory); // AMD
13
- } else {
14
- global.Mustache = {};
15
- factory(global.Mustache); // script, wsh, asp
16
- }
17
- }(this, function mustacheFactory (mustache) {
1
+ // This file has been generated from mustache.mjs
2
+ (function (global, factory) {
3
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
4
+ typeof define === 'function' && define.amd ? define(factory) :
5
+ (global = global || self, global.Mustache = factory());
6
+ }(this, (function () { 'use strict';
7
+
8
+ /*!
9
+ * mustache.js - Logic-less {{mustache}} templates with JavaScript
10
+ * http://github.com/janl/mustache.js
11
+ */
18
12
 
19
13
  var objectToString = Object.prototype.toString;
20
14
  var isArray = Array.isArray || function isArrayPolyfill (object) {
@@ -492,14 +486,27 @@
492
486
  * avoid the need to parse the same template twice.
493
487
  */
494
488
  function Writer () {
495
- this.cache = {};
489
+ this.templateCache = {
490
+ _cache: {},
491
+ set: function set (key, value) {
492
+ this._cache[key] = value;
493
+ },
494
+ get: function get (key) {
495
+ return this._cache[key];
496
+ },
497
+ clear: function clear () {
498
+ this._cache = {};
499
+ }
500
+ };
496
501
  }
497
502
 
498
503
  /**
499
504
  * Clears all cached templates in this writer.
500
505
  */
501
506
  Writer.prototype.clearCache = function clearCache () {
502
- this.cache = {};
507
+ if (typeof this.templateCache !== 'undefined') {
508
+ this.templateCache.clear();
509
+ }
503
510
  };
504
511
 
505
512
  /**
@@ -508,13 +515,15 @@
508
515
  * that is generated from the parse.
509
516
  */
510
517
  Writer.prototype.parse = function parse (template, tags) {
511
- var cache = this.cache;
518
+ var cache = this.templateCache;
512
519
  var cacheKey = template + ':' + (tags || mustache.tags).join(':');
513
- var tokens = cache[cacheKey];
514
-
515
- if (tokens == null)
516
- tokens = cache[cacheKey] = parseTemplate(template, tags);
520
+ var isCacheEnabled = typeof cache !== 'undefined';
521
+ var tokens = isCacheEnabled ? cache.get(cacheKey) : undefined;
517
522
 
523
+ if (tokens == undefined) {
524
+ tokens = parseTemplate(template, tags);
525
+ isCacheEnabled && cache.set(cacheKey, tokens);
526
+ }
518
527
  return tokens;
519
528
  };
520
529
 
@@ -533,7 +542,7 @@
533
542
  */
534
543
  Writer.prototype.render = function render (template, view, partials, tags) {
535
544
  var tokens = this.parse(template, tags);
536
- var context = (view instanceof Context) ? view : new Context(view);
545
+ var context = (view instanceof Context) ? view : new Context(view, undefined);
537
546
  return this.renderTokens(tokens, context, partials, template, tags);
538
547
  };
539
548
 
@@ -655,9 +664,32 @@
655
664
  return token[1];
656
665
  };
657
666
 
658
- mustache.name = 'mustache.js';
659
- mustache.version = '3.1.0';
660
- mustache.tags = [ '{{', '}}' ];
667
+ var mustache = {
668
+ name: 'mustache.js',
669
+ version: '4.0.0',
670
+ tags: [ '{{', '}}' ],
671
+ clearCache: undefined,
672
+ escape: undefined,
673
+ parse: undefined,
674
+ render: undefined,
675
+ Scanner: undefined,
676
+ Context: undefined,
677
+ Writer: undefined,
678
+ /**
679
+ * Allows a user to override the default caching strategy, by providing an
680
+ * object with set, get and clear methods. This can also be used to disable
681
+ * the cache by setting it to the literal `undefined`.
682
+ */
683
+ set templateCache (cache) {
684
+ defaultWriter.templateCache = cache;
685
+ },
686
+ /**
687
+ * Gets the default or overridden caching object from the default writer.
688
+ */
689
+ get templateCache () {
690
+ return defaultWriter.templateCache;
691
+ }
692
+ };
661
693
 
662
694
  // All high-level mustache.* functions use this writer.
663
695
  var defaultWriter = new Writer();
@@ -694,20 +726,6 @@
694
726
  return defaultWriter.render(template, view, partials, tags);
695
727
  };
696
728
 
697
- // This is here for backwards compatibility with 0.4.x.,
698
- /*eslint-disable */ // eslint wants camel cased function name
699
- mustache.to_html = function to_html (template, view, partials, send) {
700
- /*eslint-enable*/
701
-
702
- var result = mustache.render(template, view, partials);
703
-
704
- if (isFunction(send)) {
705
- send(result);
706
- } else {
707
- return result;
708
- }
709
- };
710
-
711
729
  // Export the escaping function so that the user may override it.
712
730
  // See https://github.com/janl/mustache.js/issues/244
713
731
  mustache.escape = escapeHtml;
@@ -718,4 +736,5 @@
718
736
  mustache.Writer = Writer;
719
737
 
720
738
  return mustache;
721
- }));
739
+
740
+ })));
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: 3.1.0.1
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Krzysztof Knapik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-19 00:00:00.000000000 Z
11
+ date: 2020-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties