Skip to content
This repository has been archived by the owner on Sep 20, 2018. It is now read-only.

Commit

Permalink
[added] tap() method
Browse files Browse the repository at this point in the history
  • Loading branch information
jquense committed Dec 21, 2015
1 parent a21fb8f commit bd98e44
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,8 @@ export default function($){
return this
},

get() {
var result = []
this.each(el => result.push(el))
return result
tap(fn) {
fn.call(this, this)
},

reduce(cb, initial){
Expand All @@ -42,13 +40,19 @@ export default function($){
}, [])
},

get() {
var result = []
this.each(el => result.push(el))
return result
},

find(selector) {
return this._reduce((result, element) => {
return result.concat($.match(selector, element, false))
}, [])
},

traverse(test){
traverse(test) {
return this._reduce((result, element) => {
return result.concat(utils.traverse(element, test))
}, [])
Expand Down

0 comments on commit bd98e44

Please sign in to comment.