Comparing version
16
index.js
@@ -1,15 +0,9 @@ | ||
const reduce = accumulator => async iterable => { | ||
let result = accumulator; | ||
import aiReduce from "ai-reduce"; | ||
for await (const chunk of iterable) { | ||
result = result.concat(chunk); | ||
} | ||
const reducer = (accumulator, item) => accumulator.concat(item); | ||
return result; | ||
}; | ||
const concat = aiReduce.partial(reducer, ""); | ||
concat.obj = aiReduce.partial(reducer, []); | ||
concat.buff = iterable => aiReduce(reducer, [], iterable).then(Buffer.concat); | ||
const concat = reduce(""); | ||
concat.obj = reduce([]); | ||
concat.buff = iterable => concat.obj(iterable).then(Buffer.concat); | ||
export default concat; |
{ | ||
"name": "ai-concat", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Concat an async iterable into a promise", | ||
@@ -33,3 +33,7 @@ "repository": "parro-it/ai-concat", | ||
"tape-async": "^2.3.0" | ||
}, | ||
"dependencies": { | ||
"ai-reduce": "^1.1.0", | ||
"is-async-iterable": "^1.0.0" | ||
} | ||
} |
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
3266
1.74%2
Infinity%8
-38.46%1
Infinity%+ Added
+ Added
+ Added
+ Added