aboutsummaryrefslogtreecommitdiff
path: root/lib/util.js
diff options
context:
space:
mode:
authorBen Burwell <ben.burwell@trifecta.com>2016-09-14 12:30:04 -0400
committerBen Burwell <ben.burwell@trifecta.com>2016-09-14 12:30:04 -0400
commitfd5817a6bb3185314540825e3d665e94ffe188c0 (patch)
tree9b35138a18122ebfcb5cfa41ac0eadd27cb2c002 /lib/util.js
Initial commit
Diffstat (limited to 'lib/util.js')
-rw-r--r--lib/util.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/util.js b/lib/util.js
new file mode 100644
index 0000000..3c6857c
--- /dev/null
+++ b/lib/util.js
@@ -0,0 +1,13 @@
+HTMLCollection.prototype.map = function(fn) {
+ var results = [];
+ for (var idx = 0; idx < this.length; idx++) {
+ results.push(fn(this.item(idx)));
+ }
+ return results;
+};
+
+HTMLCollection.prototype.forEach = function(fn) {
+ for (var idx = 0; idx < this.length; idx++) {
+ fn(this.item(idx));
+ }
+};