Comparing version
@@ -10,3 +10,2 @@ import * as Methods from './methods'; | ||
export declare class AsyncArray<T> extends Array<T> { | ||
private input; | ||
/** | ||
@@ -33,3 +32,3 @@ * Creates an instance of AsyncArray | ||
*/ | ||
aFilter(cb: Methods.CallBackFilter<T>): Promise<T[]>; | ||
aFilter(cb: Methods.CallBackFilter<T>): Promise<AsyncArray<T>>; | ||
/** | ||
@@ -67,3 +66,3 @@ * Async find method | ||
*/ | ||
aMap<R>(cb: Methods.CallBackMap<T, R>): Promise<R[]>; | ||
aMap<R>(cb: Methods.CallBackMap<T, R>): Promise<AsyncArray<R>>; | ||
/** | ||
@@ -70,0 +69,0 @@ * Async Reduce method |
@@ -27,3 +27,2 @@ "use strict"; | ||
super(...args); | ||
this.input = args; | ||
} | ||
@@ -39,3 +38,3 @@ /** | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return Methods.every(this.input, cb); | ||
return Methods.every(this, cb); | ||
}); | ||
@@ -52,3 +51,3 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return Methods.filter(this.input, cb); | ||
return new AsyncArray(...(yield Methods.filter(this, cb))); | ||
}); | ||
@@ -65,3 +64,3 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return Methods.find(this.input, cb); | ||
return Methods.find(this, cb); | ||
}); | ||
@@ -78,3 +77,3 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return Methods.findIndex(this.input, cb); | ||
return Methods.findIndex(this, cb); | ||
}); | ||
@@ -91,3 +90,3 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield Methods.forEach(this.input, cb); | ||
yield Methods.forEach(this, cb); | ||
}); | ||
@@ -105,3 +104,3 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return Methods.map(this.input, cb); | ||
return new AsyncArray(...(yield Methods.map(this, cb))); | ||
}); | ||
@@ -120,3 +119,3 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return Methods.reduce(this.input, cb, initialValue); | ||
return Methods.reduce(this, cb, initialValue); | ||
}); | ||
@@ -135,3 +134,3 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return Methods.reduceRight(this.input, cb, initialValue); | ||
return Methods.reduceRight(this, cb, initialValue); | ||
}); | ||
@@ -148,3 +147,3 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return Methods.some(this.input, cb); | ||
return Methods.some(this, cb); | ||
}); | ||
@@ -151,0 +150,0 @@ } |
var typedoc = typedoc || {}; | ||
typedoc.search = typedoc.search || {}; | ||
typedoc.search.data = {"kinds":{"1":"External module","64":"Function","128":"Class","512":"Constructor","1024":"Property","2048":"Method","65536":"Type literal","4194304":"Type alias"},"rows":[{"id":0,"kind":1,"name":"\"methods/every\"","url":"modules/_methods_every_.html","classes":"tsd-kind-external-module"},{"id":1,"kind":4194304,"name":"CallBackEvery","url":"modules/_methods_every_.html#callbackevery","classes":"tsd-kind-type-alias tsd-parent-kind-external-module tsd-has-type-parameter","parent":"\"methods/every\""},{"id":2,"kind":65536,"name":"__type","url":"modules/_methods_every_.html#callbackevery.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias tsd-is-not-exported","parent":"\"methods/every\".CallBackEvery"},{"id":3,"kind":64,"name":"every","url":"modules/_methods_every_.html#every","classes":"tsd-kind-function tsd-parent-kind-external-module tsd-has-type-parameter","parent":"\"methods/every\""},{"id":4,"kind":1,"name":"\"methods/filter\"","url":"modules/_methods_filter_.html","classes":"tsd-kind-external-module"},{"id":5,"kind":4194304,"name":"CallBackFilter","url":"modules/_methods_filter_.html#callbackfilter","classes":"tsd-kind-type-alias tsd-parent-kind-external-module tsd-has-type-parameter","parent":"\"methods/filter\""},{"id":6,"kind":65536,"name":"__type","url":"modules/_methods_filter_.html#callbackfilter.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias tsd-is-not-exported","parent":"\"methods/filter\".CallBackFilter"},{"id":7,"kind":64,"name":"filter","url":"modules/_methods_filter_.html#filter","classes":"tsd-kind-function tsd-parent-kind-external-module tsd-has-type-parameter","parent":"\"methods/filter\""},{"id":8,"kind":1,"name":"\"methods/find\"","url":"modules/_methods_find_.html","classes":"tsd-kind-external-module"},{"id":9,"kind":4194304,"name":"CallBackFind","url":"modules/_methods_find_.html#callbackfind","classes":"tsd-kind-type-alias tsd-parent-kind-external-module tsd-has-type-parameter","parent":"\"methods/find\""},{"id":10,"kind":65536,"name":"__type","url":"modules/_methods_find_.html#callbackfind.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias tsd-is-not-exported","parent":"\"methods/find\".CallBackFind"},{"id":11,"kind":64,"name":"find","url":"modules/_methods_find_.html#find","classes":"tsd-kind-function tsd-parent-kind-external-module tsd-has-type-parameter","parent":"\"methods/find\""},{"id":12,"kind":1,"name":"\"methods/find_index\"","url":"modules/_methods_find_index_.html","classes":"tsd-kind-external-module"},{"id":13,"kind":4194304,"name":"CallBackFindIndex","url":"modules/_methods_find_index_.html#callbackfindindex","classes":"tsd-kind-type-alias tsd-parent-kind-external-module tsd-has-type-parameter","parent":"\"methods/find_index\""},{"id":14,"kind":65536,"name":"__type","url":"modules/_methods_find_index_.html#callbackfindindex.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias tsd-is-not-exported","parent":"\"methods/find_index\".CallBackFindIndex"},{"id":15,"kind":64,"name":"findIndex","url":"modules/_methods_find_index_.html#findindex","classes":"tsd-kind-function tsd-parent-kind-external-module tsd-has-type-parameter","parent":"\"methods/find_index\""},{"id":16,"kind":1,"name":"\"methods/foreach\"","url":"modules/_methods_foreach_.html","classes":"tsd-kind-external-module"},{"id":17,"kind":4194304,"name":"CallBackForEach","url":"modules/_methods_foreach_.html#callbackforeach","classes":"tsd-kind-type-alias tsd-parent-kind-external-module tsd-has-type-parameter","parent":"\"methods/foreach\""},{"id":18,"kind":65536,"name":"__type","url":"modules/_methods_foreach_.html#callbackforeach.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias tsd-is-not-exported","parent":"\"methods/foreach\".CallBackForEach"},{"id":19,"kind":64,"name":"forEach","url":"modules/_methods_foreach_.html#foreach","classes":"tsd-kind-function tsd-parent-kind-external-module tsd-has-type-parameter","parent":"\"methods/foreach\""},{"id":20,"kind":1,"name":"\"methods/map\"","url":"modules/_methods_map_.html","classes":"tsd-kind-external-module"},{"id":21,"kind":4194304,"name":"CallBackMap","url":"modules/_methods_map_.html#callbackmap","classes":"tsd-kind-type-alias tsd-parent-kind-external-module tsd-has-type-parameter","parent":"\"methods/map\""},{"id":22,"kind":65536,"name":"__type","url":"modules/_methods_map_.html#callbackmap.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias tsd-is-not-exported","parent":"\"methods/map\".CallBackMap"},{"id":23,"kind":64,"name":"map","url":"modules/_methods_map_.html#map","classes":"tsd-kind-function tsd-parent-kind-external-module tsd-has-type-parameter","parent":"\"methods/map\""},{"id":24,"kind":1,"name":"\"methods/reduce\"","url":"modules/_methods_reduce_.html","classes":"tsd-kind-external-module"},{"id":25,"kind":4194304,"name":"CallBackReduce","url":"modules/_methods_reduce_.html#callbackreduce","classes":"tsd-kind-type-alias tsd-parent-kind-external-module tsd-has-type-parameter","parent":"\"methods/reduce\""},{"id":26,"kind":65536,"name":"__type","url":"modules/_methods_reduce_.html#callbackreduce.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias tsd-is-not-exported","parent":"\"methods/reduce\".CallBackReduce"},{"id":27,"kind":64,"name":"reduce","url":"modules/_methods_reduce_.html#reduce","classes":"tsd-kind-function tsd-parent-kind-external-module tsd-has-type-parameter","parent":"\"methods/reduce\""},{"id":28,"kind":1,"name":"\"methods/reduce_right\"","url":"modules/_methods_reduce_right_.html","classes":"tsd-kind-external-module"},{"id":29,"kind":4194304,"name":"CallBackReduceRight","url":"modules/_methods_reduce_right_.html#callbackreduceright","classes":"tsd-kind-type-alias tsd-parent-kind-external-module tsd-has-type-parameter","parent":"\"methods/reduce_right\""},{"id":30,"kind":65536,"name":"__type","url":"modules/_methods_reduce_right_.html#callbackreduceright.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias tsd-is-not-exported","parent":"\"methods/reduce_right\".CallBackReduceRight"},{"id":31,"kind":64,"name":"reduceRight","url":"modules/_methods_reduce_right_.html#reduceright","classes":"tsd-kind-function tsd-parent-kind-external-module tsd-has-type-parameter","parent":"\"methods/reduce_right\""},{"id":32,"kind":1,"name":"\"methods/some\"","url":"modules/_methods_some_.html","classes":"tsd-kind-external-module"},{"id":33,"kind":4194304,"name":"CallBackSome","url":"modules/_methods_some_.html#callbacksome","classes":"tsd-kind-type-alias tsd-parent-kind-external-module tsd-has-type-parameter","parent":"\"methods/some\""},{"id":34,"kind":65536,"name":"__type","url":"modules/_methods_some_.html#callbacksome.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias tsd-is-not-exported","parent":"\"methods/some\".CallBackSome"},{"id":35,"kind":64,"name":"some","url":"modules/_methods_some_.html#some","classes":"tsd-kind-function tsd-parent-kind-external-module tsd-has-type-parameter","parent":"\"methods/some\""},{"id":36,"kind":1,"name":"\"methods/index\"","url":"modules/_methods_index_.html","classes":"tsd-kind-external-module"},{"id":37,"kind":1,"name":"\"async_ray\"","url":"modules/_async_ray_.html","classes":"tsd-kind-external-module"},{"id":38,"kind":128,"name":"AsyncArray","url":"classes/_async_ray_.asyncarray.html","classes":"tsd-kind-class tsd-parent-kind-external-module tsd-has-type-parameter","parent":"\"async_ray\""},{"id":39,"kind":1024,"name":"input","url":"classes/_async_ray_.asyncarray.html#input","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-private","parent":"\"async_ray\".AsyncArray"},{"id":40,"kind":512,"name":"constructor","url":"classes/_async_ray_.asyncarray.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"\"async_ray\".AsyncArray"},{"id":41,"kind":2048,"name":"aEvery","url":"classes/_async_ray_.asyncarray.html#aevery","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"async_ray\".AsyncArray"},{"id":42,"kind":2048,"name":"aFilter","url":"classes/_async_ray_.asyncarray.html#afilter","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"async_ray\".AsyncArray"},{"id":43,"kind":2048,"name":"aFind","url":"classes/_async_ray_.asyncarray.html#afind","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"async_ray\".AsyncArray"},{"id":44,"kind":2048,"name":"aFindIndex","url":"classes/_async_ray_.asyncarray.html#afindindex","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"async_ray\".AsyncArray"},{"id":45,"kind":2048,"name":"aForEach","url":"classes/_async_ray_.asyncarray.html#aforeach","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"async_ray\".AsyncArray"},{"id":46,"kind":2048,"name":"aMap","url":"classes/_async_ray_.asyncarray.html#amap","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter","parent":"\"async_ray\".AsyncArray"},{"id":47,"kind":2048,"name":"aReduce","url":"classes/_async_ray_.asyncarray.html#areduce","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter","parent":"\"async_ray\".AsyncArray"},{"id":48,"kind":2048,"name":"aReduceRight","url":"classes/_async_ray_.asyncarray.html#areduceright","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter","parent":"\"async_ray\".AsyncArray"},{"id":49,"kind":2048,"name":"aSome","url":"classes/_async_ray_.asyncarray.html#asome","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"async_ray\".AsyncArray"},{"id":50,"kind":1024,"name":"length","url":"classes/_async_ray_.asyncarray.html#length","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":51,"kind":2048,"name":"toString","url":"classes/_async_ray_.asyncarray.html#tostring","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":52,"kind":2048,"name":"toLocaleString","url":"classes/_async_ray_.asyncarray.html#tolocalestring","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":53,"kind":2048,"name":"pop","url":"classes/_async_ray_.asyncarray.html#pop","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":54,"kind":2048,"name":"push","url":"classes/_async_ray_.asyncarray.html#push","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":55,"kind":2048,"name":"concat","url":"classes/_async_ray_.asyncarray.html#concat","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":56,"kind":2048,"name":"join","url":"classes/_async_ray_.asyncarray.html#join","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":57,"kind":2048,"name":"reverse","url":"classes/_async_ray_.asyncarray.html#reverse","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":58,"kind":2048,"name":"shift","url":"classes/_async_ray_.asyncarray.html#shift","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":59,"kind":2048,"name":"slice","url":"classes/_async_ray_.asyncarray.html#slice","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":60,"kind":2048,"name":"sort","url":"classes/_async_ray_.asyncarray.html#sort","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":61,"kind":2048,"name":"splice","url":"classes/_async_ray_.asyncarray.html#splice","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":62,"kind":2048,"name":"unshift","url":"classes/_async_ray_.asyncarray.html#unshift","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":63,"kind":2048,"name":"indexOf","url":"classes/_async_ray_.asyncarray.html#indexof","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":64,"kind":2048,"name":"lastIndexOf","url":"classes/_async_ray_.asyncarray.html#lastindexof","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":65,"kind":2048,"name":"every","url":"classes/_async_ray_.asyncarray.html#every","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":66,"kind":2048,"name":"some","url":"classes/_async_ray_.asyncarray.html#some","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":67,"kind":2048,"name":"forEach","url":"classes/_async_ray_.asyncarray.html#foreach","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":68,"kind":2048,"name":"map","url":"classes/_async_ray_.asyncarray.html#map","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":69,"kind":2048,"name":"filter","url":"classes/_async_ray_.asyncarray.html#filter","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":70,"kind":2048,"name":"reduce","url":"classes/_async_ray_.asyncarray.html#reduce","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":71,"kind":2048,"name":"reduceRight","url":"classes/_async_ray_.asyncarray.html#reduceright","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":72,"kind":1024,"name":"Array","url":"classes/_async_ray_.asyncarray.html#array","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-static","parent":"\"async_ray\".AsyncArray"},{"id":73,"kind":2048,"name":"find","url":"classes/_async_ray_.asyncarray.html#find","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":74,"kind":2048,"name":"findIndex","url":"classes/_async_ray_.asyncarray.html#findindex","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":75,"kind":2048,"name":"fill","url":"classes/_async_ray_.asyncarray.html#fill","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":76,"kind":2048,"name":"copyWithin","url":"classes/_async_ray_.asyncarray.html#copywithin","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":77,"kind":2048,"name":"__@iterator","url":"classes/_async_ray_.asyncarray.html#___iterator","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":78,"kind":2048,"name":"entries","url":"classes/_async_ray_.asyncarray.html#entries","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":79,"kind":2048,"name":"keys","url":"classes/_async_ray_.asyncarray.html#keys","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":80,"kind":2048,"name":"values","url":"classes/_async_ray_.asyncarray.html#values","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":81,"kind":2048,"name":"__@unscopables","url":"classes/_async_ray_.asyncarray.html#___unscopables","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":82,"kind":1,"name":"\"index\"","url":"modules/_index_.html","classes":"tsd-kind-external-module"},{"id":83,"kind":64,"name":"AsyncRay","url":"modules/_index_.html#asyncray","classes":"tsd-kind-function tsd-parent-kind-external-module tsd-has-type-parameter","parent":"\"index\""}]}; | ||
typedoc.search.data = {"kinds":{"1":"External module","64":"Function","128":"Class","512":"Constructor","1024":"Property","2048":"Method","65536":"Type literal","4194304":"Type alias"},"rows":[{"id":0,"kind":1,"name":"\"methods/every\"","url":"modules/_methods_every_.html","classes":"tsd-kind-external-module"},{"id":1,"kind":4194304,"name":"CallBackEvery","url":"modules/_methods_every_.html#callbackevery","classes":"tsd-kind-type-alias tsd-parent-kind-external-module tsd-has-type-parameter","parent":"\"methods/every\""},{"id":2,"kind":65536,"name":"__type","url":"modules/_methods_every_.html#callbackevery.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias tsd-is-not-exported","parent":"\"methods/every\".CallBackEvery"},{"id":3,"kind":64,"name":"every","url":"modules/_methods_every_.html#every","classes":"tsd-kind-function tsd-parent-kind-external-module tsd-has-type-parameter","parent":"\"methods/every\""},{"id":4,"kind":1,"name":"\"methods/filter\"","url":"modules/_methods_filter_.html","classes":"tsd-kind-external-module"},{"id":5,"kind":4194304,"name":"CallBackFilter","url":"modules/_methods_filter_.html#callbackfilter","classes":"tsd-kind-type-alias tsd-parent-kind-external-module tsd-has-type-parameter","parent":"\"methods/filter\""},{"id":6,"kind":65536,"name":"__type","url":"modules/_methods_filter_.html#callbackfilter.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias tsd-is-not-exported","parent":"\"methods/filter\".CallBackFilter"},{"id":7,"kind":64,"name":"filter","url":"modules/_methods_filter_.html#filter","classes":"tsd-kind-function tsd-parent-kind-external-module tsd-has-type-parameter","parent":"\"methods/filter\""},{"id":8,"kind":1,"name":"\"methods/find\"","url":"modules/_methods_find_.html","classes":"tsd-kind-external-module"},{"id":9,"kind":4194304,"name":"CallBackFind","url":"modules/_methods_find_.html#callbackfind","classes":"tsd-kind-type-alias tsd-parent-kind-external-module tsd-has-type-parameter","parent":"\"methods/find\""},{"id":10,"kind":65536,"name":"__type","url":"modules/_methods_find_.html#callbackfind.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias tsd-is-not-exported","parent":"\"methods/find\".CallBackFind"},{"id":11,"kind":64,"name":"find","url":"modules/_methods_find_.html#find","classes":"tsd-kind-function tsd-parent-kind-external-module tsd-has-type-parameter","parent":"\"methods/find\""},{"id":12,"kind":1,"name":"\"methods/find_index\"","url":"modules/_methods_find_index_.html","classes":"tsd-kind-external-module"},{"id":13,"kind":4194304,"name":"CallBackFindIndex","url":"modules/_methods_find_index_.html#callbackfindindex","classes":"tsd-kind-type-alias tsd-parent-kind-external-module tsd-has-type-parameter","parent":"\"methods/find_index\""},{"id":14,"kind":65536,"name":"__type","url":"modules/_methods_find_index_.html#callbackfindindex.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias tsd-is-not-exported","parent":"\"methods/find_index\".CallBackFindIndex"},{"id":15,"kind":64,"name":"findIndex","url":"modules/_methods_find_index_.html#findindex","classes":"tsd-kind-function tsd-parent-kind-external-module tsd-has-type-parameter","parent":"\"methods/find_index\""},{"id":16,"kind":1,"name":"\"methods/foreach\"","url":"modules/_methods_foreach_.html","classes":"tsd-kind-external-module"},{"id":17,"kind":4194304,"name":"CallBackForEach","url":"modules/_methods_foreach_.html#callbackforeach","classes":"tsd-kind-type-alias tsd-parent-kind-external-module tsd-has-type-parameter","parent":"\"methods/foreach\""},{"id":18,"kind":65536,"name":"__type","url":"modules/_methods_foreach_.html#callbackforeach.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias tsd-is-not-exported","parent":"\"methods/foreach\".CallBackForEach"},{"id":19,"kind":64,"name":"forEach","url":"modules/_methods_foreach_.html#foreach","classes":"tsd-kind-function tsd-parent-kind-external-module tsd-has-type-parameter","parent":"\"methods/foreach\""},{"id":20,"kind":1,"name":"\"methods/map\"","url":"modules/_methods_map_.html","classes":"tsd-kind-external-module"},{"id":21,"kind":4194304,"name":"CallBackMap","url":"modules/_methods_map_.html#callbackmap","classes":"tsd-kind-type-alias tsd-parent-kind-external-module tsd-has-type-parameter","parent":"\"methods/map\""},{"id":22,"kind":65536,"name":"__type","url":"modules/_methods_map_.html#callbackmap.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias tsd-is-not-exported","parent":"\"methods/map\".CallBackMap"},{"id":23,"kind":64,"name":"map","url":"modules/_methods_map_.html#map","classes":"tsd-kind-function tsd-parent-kind-external-module tsd-has-type-parameter","parent":"\"methods/map\""},{"id":24,"kind":1,"name":"\"methods/reduce\"","url":"modules/_methods_reduce_.html","classes":"tsd-kind-external-module"},{"id":25,"kind":4194304,"name":"CallBackReduce","url":"modules/_methods_reduce_.html#callbackreduce","classes":"tsd-kind-type-alias tsd-parent-kind-external-module tsd-has-type-parameter","parent":"\"methods/reduce\""},{"id":26,"kind":65536,"name":"__type","url":"modules/_methods_reduce_.html#callbackreduce.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias tsd-is-not-exported","parent":"\"methods/reduce\".CallBackReduce"},{"id":27,"kind":64,"name":"reduce","url":"modules/_methods_reduce_.html#reduce","classes":"tsd-kind-function tsd-parent-kind-external-module tsd-has-type-parameter","parent":"\"methods/reduce\""},{"id":28,"kind":1,"name":"\"methods/reduce_right\"","url":"modules/_methods_reduce_right_.html","classes":"tsd-kind-external-module"},{"id":29,"kind":4194304,"name":"CallBackReduceRight","url":"modules/_methods_reduce_right_.html#callbackreduceright","classes":"tsd-kind-type-alias tsd-parent-kind-external-module tsd-has-type-parameter","parent":"\"methods/reduce_right\""},{"id":30,"kind":65536,"name":"__type","url":"modules/_methods_reduce_right_.html#callbackreduceright.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias tsd-is-not-exported","parent":"\"methods/reduce_right\".CallBackReduceRight"},{"id":31,"kind":64,"name":"reduceRight","url":"modules/_methods_reduce_right_.html#reduceright","classes":"tsd-kind-function tsd-parent-kind-external-module tsd-has-type-parameter","parent":"\"methods/reduce_right\""},{"id":32,"kind":1,"name":"\"methods/some\"","url":"modules/_methods_some_.html","classes":"tsd-kind-external-module"},{"id":33,"kind":4194304,"name":"CallBackSome","url":"modules/_methods_some_.html#callbacksome","classes":"tsd-kind-type-alias tsd-parent-kind-external-module tsd-has-type-parameter","parent":"\"methods/some\""},{"id":34,"kind":65536,"name":"__type","url":"modules/_methods_some_.html#callbacksome.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias tsd-is-not-exported","parent":"\"methods/some\".CallBackSome"},{"id":35,"kind":64,"name":"some","url":"modules/_methods_some_.html#some","classes":"tsd-kind-function tsd-parent-kind-external-module tsd-has-type-parameter","parent":"\"methods/some\""},{"id":36,"kind":1,"name":"\"methods/index\"","url":"modules/_methods_index_.html","classes":"tsd-kind-external-module"},{"id":37,"kind":1,"name":"\"async_ray\"","url":"modules/_async_ray_.html","classes":"tsd-kind-external-module"},{"id":38,"kind":128,"name":"AsyncArray","url":"classes/_async_ray_.asyncarray.html","classes":"tsd-kind-class tsd-parent-kind-external-module tsd-has-type-parameter","parent":"\"async_ray\""},{"id":39,"kind":512,"name":"constructor","url":"classes/_async_ray_.asyncarray.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"\"async_ray\".AsyncArray"},{"id":40,"kind":2048,"name":"aEvery","url":"classes/_async_ray_.asyncarray.html#aevery","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"async_ray\".AsyncArray"},{"id":41,"kind":2048,"name":"aFilter","url":"classes/_async_ray_.asyncarray.html#afilter","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"async_ray\".AsyncArray"},{"id":42,"kind":2048,"name":"aFind","url":"classes/_async_ray_.asyncarray.html#afind","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"async_ray\".AsyncArray"},{"id":43,"kind":2048,"name":"aFindIndex","url":"classes/_async_ray_.asyncarray.html#afindindex","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"async_ray\".AsyncArray"},{"id":44,"kind":2048,"name":"aForEach","url":"classes/_async_ray_.asyncarray.html#aforeach","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"async_ray\".AsyncArray"},{"id":45,"kind":2048,"name":"aMap","url":"classes/_async_ray_.asyncarray.html#amap","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter","parent":"\"async_ray\".AsyncArray"},{"id":46,"kind":2048,"name":"aReduce","url":"classes/_async_ray_.asyncarray.html#areduce","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter","parent":"\"async_ray\".AsyncArray"},{"id":47,"kind":2048,"name":"aReduceRight","url":"classes/_async_ray_.asyncarray.html#areduceright","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter","parent":"\"async_ray\".AsyncArray"},{"id":48,"kind":2048,"name":"aSome","url":"classes/_async_ray_.asyncarray.html#asome","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"async_ray\".AsyncArray"},{"id":49,"kind":1024,"name":"length","url":"classes/_async_ray_.asyncarray.html#length","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":50,"kind":2048,"name":"toString","url":"classes/_async_ray_.asyncarray.html#tostring","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":51,"kind":2048,"name":"toLocaleString","url":"classes/_async_ray_.asyncarray.html#tolocalestring","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":52,"kind":2048,"name":"pop","url":"classes/_async_ray_.asyncarray.html#pop","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":53,"kind":2048,"name":"push","url":"classes/_async_ray_.asyncarray.html#push","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":54,"kind":2048,"name":"concat","url":"classes/_async_ray_.asyncarray.html#concat","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":55,"kind":2048,"name":"join","url":"classes/_async_ray_.asyncarray.html#join","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":56,"kind":2048,"name":"reverse","url":"classes/_async_ray_.asyncarray.html#reverse","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":57,"kind":2048,"name":"shift","url":"classes/_async_ray_.asyncarray.html#shift","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":58,"kind":2048,"name":"slice","url":"classes/_async_ray_.asyncarray.html#slice","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":59,"kind":2048,"name":"sort","url":"classes/_async_ray_.asyncarray.html#sort","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":60,"kind":2048,"name":"splice","url":"classes/_async_ray_.asyncarray.html#splice","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":61,"kind":2048,"name":"unshift","url":"classes/_async_ray_.asyncarray.html#unshift","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":62,"kind":2048,"name":"indexOf","url":"classes/_async_ray_.asyncarray.html#indexof","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":63,"kind":2048,"name":"lastIndexOf","url":"classes/_async_ray_.asyncarray.html#lastindexof","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":64,"kind":2048,"name":"every","url":"classes/_async_ray_.asyncarray.html#every","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":65,"kind":2048,"name":"some","url":"classes/_async_ray_.asyncarray.html#some","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":66,"kind":2048,"name":"forEach","url":"classes/_async_ray_.asyncarray.html#foreach","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":67,"kind":2048,"name":"map","url":"classes/_async_ray_.asyncarray.html#map","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":68,"kind":2048,"name":"filter","url":"classes/_async_ray_.asyncarray.html#filter","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":69,"kind":2048,"name":"reduce","url":"classes/_async_ray_.asyncarray.html#reduce","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":70,"kind":2048,"name":"reduceRight","url":"classes/_async_ray_.asyncarray.html#reduceright","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":71,"kind":1024,"name":"Array","url":"classes/_async_ray_.asyncarray.html#array","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-static","parent":"\"async_ray\".AsyncArray"},{"id":72,"kind":2048,"name":"find","url":"classes/_async_ray_.asyncarray.html#find","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":73,"kind":2048,"name":"findIndex","url":"classes/_async_ray_.asyncarray.html#findindex","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":74,"kind":2048,"name":"fill","url":"classes/_async_ray_.asyncarray.html#fill","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":75,"kind":2048,"name":"copyWithin","url":"classes/_async_ray_.asyncarray.html#copywithin","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":76,"kind":2048,"name":"__@iterator","url":"classes/_async_ray_.asyncarray.html#___iterator","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":77,"kind":2048,"name":"entries","url":"classes/_async_ray_.asyncarray.html#entries","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":78,"kind":2048,"name":"keys","url":"classes/_async_ray_.asyncarray.html#keys","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":79,"kind":2048,"name":"values","url":"classes/_async_ray_.asyncarray.html#values","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":80,"kind":2048,"name":"__@unscopables","url":"classes/_async_ray_.asyncarray.html#___unscopables","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"\"async_ray\".AsyncArray"},{"id":81,"kind":1,"name":"\"index\"","url":"modules/_index_.html","classes":"tsd-kind-external-module"},{"id":82,"kind":64,"name":"AsyncRay","url":"modules/_index_.html#asyncray","classes":"tsd-kind-function tsd-parent-kind-external-module tsd-has-type-parameter","parent":"\"index\""}]}; |
@@ -6,3 +6,3 @@ { | ||
"types": "dist/index.d.ts", | ||
"version": "2.2.1", | ||
"version": "3.0.0", | ||
"scripts": { | ||
@@ -9,0 +9,0 @@ "pretest": "npm run build", |
@@ -229,15 +229,22 @@ # Async-Ray | ||
## Chaining methods | ||
## Chaining | ||
### Please note that `.aEvery`, `.aFilter`, `.aFind`, `.aForEach`, `.aMap`, `aReduce` and `.aSome` cannot be chained with each other. | ||
## Between AsyncRay methods | ||
Eg: | ||
### **Only** `.aFilter` and `.aMap` may be chained together. | ||
Make sure to put before each AsyncRay method call an `await` (or call `.then(...)`) since a Promise is returned by the async methods. | ||
#### sample | ||
```js | ||
// Below code will throw an error | ||
AsyncRay([1,2,3]).aMap(...).aReduce(...) | ||
await(await AsyncRay([1,2,3]) | ||
.aFilter(...)) | ||
.Map(...) | ||
``` | ||
But `.aEvery`, `.aFilter`, `.aFind`,`.aFindIndex`, `.aForEach`, `.aMap`, `aReduce`, `aReduceRight` and `.aSome` can be chained with other [Array methods](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array#). | ||
## Between other [Array methods](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array#) methods | ||
`.aEvery`, `.aFilter`, `.aFind`,`.aFindIndex`, `.aForEach`, `.aMap`, `aReduce`, `aReduceRight` and `.aSome` can be chained with other [Array methods](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array#). | ||
#### sample 1 - `aMap` and `filter` | ||
@@ -244,0 +251,0 @@ |
import 'mocha'; | ||
import * as should from 'should'; | ||
import { AsyncRay } from '../lib/'; | ||
import { AsyncArray } from '../lib/async_ray'; | ||
@@ -9,2 +10,6 @@ async function dummyAsync(num: number): Promise<number> { | ||
async function dummyAsyncCond(condition: boolean): Promise<boolean> { | ||
return Promise.resolve(condition); | ||
} | ||
function dummy(num: number): number { | ||
@@ -20,3 +25,14 @@ return num * 10; | ||
it('Chaining aMap() and map()', async () => { | ||
it('aMap() and aFilter()', async () => { | ||
const outputArray = | ||
await(await AsyncRay(inputArray) | ||
.aMap(async (i) => | ||
dummyAsync(i))) | ||
.aFilter(async (i) => | ||
dummyAsyncCond(!!i)) | ||
should(outputArray).instanceOf(AsyncArray); | ||
}); | ||
it('aMap() and map()', async () => { | ||
const outputArray = (await AsyncRay(inputArray).aMap(async (i) => | ||
@@ -29,3 +45,3 @@ dummyAsync(i) | ||
it('Chaining aMap() and reduce()', async () => { | ||
it('aMap() and reduce()', async () => { | ||
const output = (await AsyncRay(inputArray).aMap(async (i) => | ||
@@ -38,3 +54,3 @@ dummyAsync(i) | ||
it('Chaining aMap() and find()', async () => { | ||
it('aMap() and find()', async () => { | ||
const output = (await AsyncRay(inputArray).aMap(async (i) => | ||
@@ -47,3 +63,3 @@ dummyAsync(i) | ||
it('Chaining aFilter() and map()', async () => { | ||
it('aFilter() and map()', async () => { | ||
const outputArray = (await AsyncRay(inputArray).aFilter( | ||
@@ -56,3 +72,3 @@ async (i) => (await dummyAsync(i)) > 20 | ||
it('Chaining aFilter() and reduce()', async () => { | ||
it('aFilter() and reduce()', async () => { | ||
const output = (await AsyncRay(inputArray).aFilter( | ||
@@ -65,3 +81,3 @@ async (i) => (await dummyAsync(i)) > 20 | ||
it('Chaining aFilter() and find()', async () => { | ||
it('aFilter() and find()', async () => { | ||
const output = (await AsyncRay(inputArray).aFilter( | ||
@@ -68,0 +84,0 @@ async (i) => (await dummyAsync(i)) > 20 |
import 'mocha'; | ||
import * as should from 'should'; | ||
import { AsyncRay } from '../lib/'; | ||
import { AsyncArray } from '../lib/async_ray'; | ||
@@ -16,2 +17,18 @@ async function dummy(condition: boolean): Promise<boolean> { | ||
describe('filter', () => { | ||
it('should return an instance of AsyncArray', async () => { | ||
const outputArray = await AsyncRay(inputArray).aFilter(async (i) => | ||
dummy(!!i) | ||
); | ||
should(outputArray).instanceOf(AsyncArray); | ||
}); | ||
it('should return an instance of Array', async () => { | ||
const outputArray = await AsyncRay(inputArray).aFilter(async (i) => | ||
dummy(!!i) | ||
); | ||
should(outputArray).instanceOf(Array); | ||
}); | ||
it('should filter and send a none-empty array', async () => { | ||
@@ -18,0 +35,0 @@ const outputArray = await AsyncRay(inputArray).aFilter( |
import 'mocha'; | ||
import * as should from 'should'; | ||
import { AsyncRay } from '../lib/'; | ||
import { AsyncArray } from '../lib/async_ray'; | ||
@@ -16,2 +17,14 @@ async function dummy(num: number): Promise<number> { | ||
describe('map', () => { | ||
it('should return an instance of AsyncArray', async () => { | ||
const outputArray = await AsyncRay(inputArray).aMap(async () => null); | ||
should(outputArray).instanceOf(AsyncArray); | ||
}); | ||
it('should return an instance of Array', async () => { | ||
const outputArray = await AsyncRay(inputArray).aMap(async () => null); | ||
should(outputArray).instanceOf(Array); | ||
}); | ||
it('should map the given cb', async () => { | ||
@@ -18,0 +31,0 @@ const outputArray = await AsyncRay(inputArray).aMap( |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
4825214
0.03%75
1.35%2563
1.3%299
2.4%