Pārlūkot izejas kodu

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 pirms 6 gadiem
vecāks
revīzija
4dc00b8a9c
Šim parakstam datu bāzē netika atrasta zināma atslēga GPG atslēgas ID: 4AEE18F83AFDEB23
3 mainītis faili ar 3 papildinājumiem un 3 dzēšanām
  1. +1
    -1
      mustache.js
  2. +1
    -1
      mustache.min.js
  3. +1
    -1
      mustache.mjs

+ 1
- 1
mustache.js Parādīt failu

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


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


+ 1
- 1
mustache.min.js
Failā izmaiņas netiks attēlotas, jo tās ir par lielu
Parādīt failu


+ 1
- 1
mustache.mjs Parādīt failu

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


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


Notiek ielāde…
Atcelt
Saglabāt