Socket
Socket
Sign inDemoInstall

htmlbars

Package Overview
Dependencies
Maintainers
2
Versions
108
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

htmlbars - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1

dist/cjs/htmlbars-util/handlebars/safe-string.js

18

dist/amd/htmlbars-runtime.amd.js

@@ -126,8 +126,10 @@ define("htmlbars-runtime",

define("htmlbars-util",
["./htmlbars-util/safe-string","exports"],
function(__dependency1__, __exports__) {
["./htmlbars-util/safe-string","./htmlbars-util/handlebars/utils","exports"],
function(__dependency1__, __dependency2__, __exports__) {
"use strict";
var SafeString = __dependency1__["default"];
var escapeExpression = __dependency2__.escapeExpression;
__exports__.SafeString = SafeString;
__exports__.escapeExpression = escapeExpression;
});

@@ -204,13 +206,7 @@ define("htmlbars-util/array-utils",

define("htmlbars-util/safe-string",
["exports"],
function(__exports__) {
["./handlebars/safe-string","exports"],
function(__dependency1__, __exports__) {
"use strict";
function SafeString(string) {
this.string = string;
}
var SafeString = __dependency1__["default"];
SafeString.prototype.toString = function() {
return "" + this.string;
};
__exports__["default"] = SafeString;

@@ -217,0 +213,0 @@ });

define("htmlbars-util",
["./htmlbars-util/safe-string","exports"],
function(__dependency1__, __exports__) {
["./htmlbars-util/safe-string","./htmlbars-util/handlebars/utils","exports"],
function(__dependency1__, __dependency2__, __exports__) {
"use strict";
var SafeString = __dependency1__["default"];
var escapeExpression = __dependency2__.escapeExpression;
__exports__.SafeString = SafeString;
__exports__.escapeExpression = escapeExpression;
});

@@ -28,2 +30,109 @@ define("htmlbars-util/array-utils",

});
define("htmlbars-util/handlebars/safe-string",
["exports"],
function(__exports__) {
"use strict";
// Build out our basic SafeString type
function SafeString(string) {
this.string = string;
}
SafeString.prototype.toString = SafeString.prototype.toHTML = function() {
return "" + this.string;
};
__exports__["default"] = SafeString;
});
define("htmlbars-util/handlebars/utils",
["./safe-string","exports"],
function(__dependency1__, __exports__) {
"use strict";
/*jshint -W004 */
var SafeString = __dependency1__["default"];
var escape = {
"&": "&",
"<": "&lt;",
">": "&gt;",
'"': "&quot;",
"'": "&#x27;",
"`": "&#x60;"
};
var badChars = /[&<>"'`]/g;
var possible = /[&<>"'`]/;
function escapeChar(chr) {
return escape[chr];
}
function extend(obj /* , ...source */) {
for (var i = 1; i < arguments.length; i++) {
for (var key in arguments[i]) {
if (Object.prototype.hasOwnProperty.call(arguments[i], key)) {
obj[key] = arguments[i][key];
}
}
}
return obj;
}
__exports__.extend = extend;var toString = Object.prototype.toString;
__exports__.toString = toString;
// Sourced from lodash
// https://github.com/bestiejs/lodash/blob/master/LICENSE.txt
var isFunction = function(value) {
return typeof value === 'function';
};
// fallback for older versions of Chrome and Safari
/* istanbul ignore next */
if (isFunction(/x/)) {
isFunction = function(value) {
return typeof value === 'function' && toString.call(value) === '[object Function]';
};
}
var isFunction;
__exports__.isFunction = isFunction;
/* istanbul ignore next */
var isArray = Array.isArray || function(value) {
return (value && typeof value === 'object') ? toString.call(value) === '[object Array]' : false;
};
__exports__.isArray = isArray;
function escapeExpression(string) {
// don't escape SafeStrings, since they're already safe
if (string && string.toHTML) {
return string.toHTML();
} else if (string == null) {
return "";
} else if (!string) {
return string + '';
}
// Force a string conversion as this will be done by the append regardless and
// the regex test will do this transparently behind the scenes, causing issues if
// an object's to string has escaped characters in it.
string = "" + string;
if(!possible.test(string)) { return string; }
return string.replace(badChars, escapeChar);
}
__exports__.escapeExpression = escapeExpression;function isEmpty(value) {
if (!value && value !== 0) {
return true;
} else if (isArray(value) && value.length === 0) {
return true;
} else {
return false;
}
}
__exports__.isEmpty = isEmpty;function appendContextPath(contextPath, id) {
return (contextPath ? contextPath + '.' : '') + id;
}
__exports__.appendContextPath = appendContextPath;
});
define("htmlbars-util/object-utils",

@@ -80,14 +189,8 @@ ["exports"],

define("htmlbars-util/safe-string",
["exports"],
function(__exports__) {
["./handlebars/safe-string","exports"],
function(__dependency1__, __exports__) {
"use strict";
function SafeString(string) {
this.string = string;
}
var SafeString = __dependency1__["default"];
SafeString.prototype.toString = function() {
return "" + this.string;
};
__exports__["default"] = SafeString;
});
"use strict";
var SafeString = require("./htmlbars-util/safe-string")["default"];
var escapeExpression = require("./htmlbars-util/handlebars/utils").escapeExpression;
exports.SafeString = SafeString;
exports.SafeString = SafeString;
exports.escapeExpression = escapeExpression;
"use strict";
function SafeString(string) {
this.string = string;
}
var SafeString = require("./handlebars/safe-string")["default"];
SafeString.prototype.toString = function() {
return "" + this.string;
};
exports["default"] = SafeString;

@@ -7,3 +7,3 @@ "use strict";

* See https://raw.githubusercontent.com/tildeio/htmlbars/master/LICENSE
* @version 0.4.0
* @version 0.4.1
*/

@@ -10,0 +10,0 @@

import SafeString from './htmlbars-util/safe-string';
import { escapeExpression } from './htmlbars-util/handlebars/utils';
export {
SafeString
SafeString,
escapeExpression
};

@@ -1,10 +0,3 @@

function SafeString(string) {
this.string = string;
}
import SafeString from './handlebars/safe-string';
SafeString.prototype.toString = function() {
return "" + this.string;
};
export default SafeString;

@@ -6,3 +6,3 @@ /*

* See https://raw.githubusercontent.com/tildeio/htmlbars/master/LICENSE
* @version 0.4.0
* @version 0.4.1
*/

@@ -9,0 +9,0 @@

@@ -67,8 +67,10 @@ define("htmlbars-test-helpers",

define("htmlbars-util",
["./htmlbars-util/safe-string","exports"],
function(__dependency1__, __exports__) {
["./htmlbars-util/safe-string","./htmlbars-util/handlebars/utils","exports"],
function(__dependency1__, __dependency2__, __exports__) {
"use strict";
var SafeString = __dependency1__["default"];
var escapeExpression = __dependency2__.escapeExpression;
__exports__.SafeString = SafeString;
__exports__.escapeExpression = escapeExpression;
});

@@ -112,2 +114,127 @@ define("htmlbars-util.jshint",

});
define("htmlbars-util/handlebars/safe-string",
["exports"],
function(__exports__) {
"use strict";
// Build out our basic SafeString type
function SafeString(string) {
this.string = string;
}
SafeString.prototype.toString = SafeString.prototype.toHTML = function() {
return "" + this.string;
};
__exports__["default"] = SafeString;
});
define("htmlbars-util/handlebars/safe-string.jshint",
[],
function() {
"use strict";
module('JSHint - htmlbars-util/handlebars');
test('htmlbars-util/handlebars/safe-string.js should pass jshint', function() {
ok(true, 'htmlbars-util/handlebars/safe-string.js should pass jshint.');
});
});
define("htmlbars-util/handlebars/utils",
["./safe-string","exports"],
function(__dependency1__, __exports__) {
"use strict";
/*jshint -W004 */
var SafeString = __dependency1__["default"];
var escape = {
"&": "&amp;",
"<": "&lt;",
">": "&gt;",
'"': "&quot;",
"'": "&#x27;",
"`": "&#x60;"
};
var badChars = /[&<>"'`]/g;
var possible = /[&<>"'`]/;
function escapeChar(chr) {
return escape[chr];
}
function extend(obj /* , ...source */) {
for (var i = 1; i < arguments.length; i++) {
for (var key in arguments[i]) {
if (Object.prototype.hasOwnProperty.call(arguments[i], key)) {
obj[key] = arguments[i][key];
}
}
}
return obj;
}
__exports__.extend = extend;var toString = Object.prototype.toString;
__exports__.toString = toString;
// Sourced from lodash
// https://github.com/bestiejs/lodash/blob/master/LICENSE.txt
var isFunction = function(value) {
return typeof value === 'function';
};
// fallback for older versions of Chrome and Safari
/* istanbul ignore next */
if (isFunction(/x/)) {
isFunction = function(value) {
return typeof value === 'function' && toString.call(value) === '[object Function]';
};
}
var isFunction;
__exports__.isFunction = isFunction;
/* istanbul ignore next */
var isArray = Array.isArray || function(value) {
return (value && typeof value === 'object') ? toString.call(value) === '[object Array]' : false;
};
__exports__.isArray = isArray;
function escapeExpression(string) {
// don't escape SafeStrings, since they're already safe
if (string && string.toHTML) {
return string.toHTML();
} else if (string == null) {
return "";
} else if (!string) {
return string + '';
}
// Force a string conversion as this will be done by the append regardless and
// the regex test will do this transparently behind the scenes, causing issues if
// an object's to string has escaped characters in it.
string = "" + string;
if(!possible.test(string)) { return string; }
return string.replace(badChars, escapeChar);
}
__exports__.escapeExpression = escapeExpression;function isEmpty(value) {
if (!value && value !== 0) {
return true;
} else if (isArray(value) && value.length === 0) {
return true;
} else {
return false;
}
}
__exports__.isEmpty = isEmpty;function appendContextPath(contextPath, id) {
return (contextPath ? contextPath + '.' : '') + id;
}
__exports__.appendContextPath = appendContextPath;
});
define("htmlbars-util/handlebars/utils.jshint",
[],
function() {
"use strict";
module('JSHint - htmlbars-util/handlebars');
test('htmlbars-util/handlebars/utils.js should pass jshint', function() {
ok(false, 'htmlbars-util/handlebars/utils.js should pass jshint.\nhtmlbars-util/handlebars/utils.js: line 58, col 23, Expected \'===\' and instead saw \'==\'.\nhtmlbars-util/handlebars/utils.js: line 2, col 8, \'SafeString\' is defined but never used.\n\n2 errors');
});
});
define("htmlbars-util/object-utils",

@@ -182,13 +309,7 @@ ["exports"],

define("htmlbars-util/safe-string",
["exports"],
function(__exports__) {
["./handlebars/safe-string","exports"],
function(__dependency1__, __exports__) {
"use strict";
function SafeString(string) {
this.string = string;
}
var SafeString = __dependency1__["default"];
SafeString.prototype.toString = function() {
return "" + this.string;
};
__exports__["default"] = SafeString;

@@ -195,0 +316,0 @@ });

var packagesConfig = {
"version": "0.4.0",
"revision": "1060a73c4f5a76b674385c9516ad1fd59bd8a1d4",
"version": "0.4.1",
"revision": "0c4cd3124067bf4dc93681a7a534177acc765e7d",
"vendored": {},

@@ -9,3 +9,3 @@ "dependencies": {

"lib": [
"handlebars-inliner",
"syntax-handlebars-inliner",
"htmlbars-util",

@@ -22,3 +22,3 @@ "simple-html-tokenizer",

"lib": [
"handlebars-inliner",
"syntax-handlebars-inliner",
"htmlbars-util",

@@ -31,3 +31,3 @@ "simple-html-tokenizer"

"lib": [
"handlebars-inliner",
"syntax-handlebars-inliner",
"htmlbars-util",

@@ -51,2 +51,3 @@ "simple-html-tokenizer",

"test": [
"util-handlebars-inliner",
"htmlbars-util",

@@ -56,5 +57,9 @@ "htmlbars-test-helpers"

},
"htmlbars-util": {},
"htmlbars-util": {
"lib": [
"util-handlebars-inliner"
]
},
"htmlbars-test-helpers": {}
}
};
{
"name": "htmlbars",
"version": "0.4.0",
"version": "0.4.1",
"description": "HTMLBars compiles Handlebars templates into document fragments rather than string buffers",

@@ -5,0 +5,0 @@ "main": "dist/cjs/htmlbars.js",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc