0.1.0 • Published 8 years ago

jq-reduce v0.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

jQuery reduce()

The classic example

var total = $.reduce([1, 2, 3], function(p, c) {
  return p + c;
}, 0);

Reduce a jQuery collection into an Object

var refs = $('[ref]').reduce(function(p, c) {
  p[c.attributes.ref.value] = c;
  return p;
}, {});

Reduce a jQuery collection into an Array

var values = $(':text').reduce(function(p, c) {
  p.push(c.value);
  return p;
}, []);

The current item of the collection is the default context

var names = $(':input').reduce(function(p){
  return p.concat(this.name);
}, []);
0.1.0

8 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago