Procházet zdrojové kódy

Optimize `Writer.prototype.escapedValue` for numbers (#754)

These changes optimizes the performance of escaping number
values, by not passing them through the ordinary HTML escaping
that is done on string values.
tags/v4.1.0
urain39 GitHub před 6 roky
rodič
revize
4dc00b8a9c
V databázi nebyl nalezen žádný známý klíč pro tento podpis ID GPG klíče: 4AEE18F83AFDEB23
3 změnil soubory, kde provedl 3 přidání a 3 odebrání
  1. +1
    -1
      mustache.js
  2. +1
    -1
      mustache.min.js
  3. +1
    -1
      mustache.mjs

+ 1
- 1
mustache.js Zobrazit soubor

@@ -657,7 +657,7 @@
Writer.prototype.escapedValue = function escapedValue (token, context) {
var value = context.lookup(token[1]);
if (value != null)
return mustache.escape(value);
return typeof value === 'number' ? String(value) : mustache.escape(value);
};

Writer.prototype.rawValue = function rawValue (token) {


+ 1
- 1
mustache.min.js
Diff nebyl zobrazen, protože je příliš veliký
Zobrazit soubor


+ 1
- 1
mustache.mjs Zobrazit soubor

@@ -650,7 +650,7 @@ Writer.prototype.unescapedValue = function unescapedValue (token, context) {
Writer.prototype.escapedValue = function escapedValue (token, context) {
var value = context.lookup(token[1]);
if (value != null)
return mustache.escape(value);
return typeof value === 'number' ? String(value) : mustache.escape(value);
};

Writer.prototype.rawValue = function rawValue (token) {


Načítá se…
Zrušit
Uložit