Skip to content

Instantly share code, notes, and snippets.

@enzoaeneas
enzoaeneas / String.prototype.template.js
Created December 29, 2015 05:18 — forked from WebReflection/String.prototype.template.js
ES6 Template like strings in ES3 compatible syntax.
// accepts optional transformer
// now transformers are compatible with ES6
String.prototype.template = function (fn, object) {'use strict';
// Andrea Giammarchi - WTFPL License
var
hasTransformer = typeof fn === 'function',
stringify = JSON.stringify,
re = /\$\{([\S\s]*?)\}/g,
strings = [],
values = hasTransformer ? [] : strings,
@enzoaeneas
enzoaeneas / ko.utils.3.4.0rc.signatures.js
Created December 30, 2015 21:48 — forked from hyle/ko.utils.3.4.0.signatures.js
KnockoutJS 3.4.0rc utils (ko.utils) signatures
// knockout 3.4.0rc
ko.utils.addOrRemoveItem = function (array, value, included) { /* .. */ }
ko.utils.anyDomNodeIsAttachedToDocument = function (nodes) { /* .. */ }
ko.utils.arrayFilter = function (array, predicate) { /* .. */ }
ko.utils.arrayFirst = function (array, predicate, predicateOwner) { /* .. */ }