Skip to content
This repository was archived by the owner on Jun 30, 2023. It is now read-only.

Commit 232b6ea

Browse files
author
Alan Shaw
committed
docs: better comments for supported transform types
1 parent 352f0c3 commit 232b6ea

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"form-data": "^2.4.0",
3333
"iterable-ndjson": "^1.1.0",
3434
"node-fetch": "^2.6.0",
35-
"pull-stream-to-async-iterator": "^1.0.1",
35+
"pull-stream-to-async-iterator": "^1.0.2",
3636
"querystring": "^0.2.0"
3737
},
3838
"devDependencies": {
@@ -42,7 +42,7 @@
4242
"dirty-chai": "^2.0.1",
4343
"go-ipfs-dep": "~0.4.21",
4444
"interface-ipfs-core": "~0.105.1",
45-
"ipfsd-ctl": "~0.42.0",
45+
"ipfsd-ctl": "^0.43.0",
4646
"multiaddr-to-uri": "^4.0.1",
4747
"pull-stream": "^3.6.12"
4848
},

src/add/normalise-input.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,22 @@ const blobToAsyncIterable = require('../lib/blob-to-async-iterable')
88
/*
99
Transform one of:
1010
11-
Buffer/ArrayBuffer/TypedArray
12-
Blob/File
11+
Buffer|ArrayBuffer|TypedArray
12+
Blob|File
1313
{ path, content: Buffer }
14+
{ path, content: Blob }
1415
{ path, content: Iterable<Buffer> }
1516
{ path, content: AsyncIterable<Buffer> }
1617
{ path, content: PullStream<Buffer> }
1718
Iterable<Number>
1819
Iterable<{ path, content: Buffer }>
20+
Iterable<{ path, content: Blob }>
1921
Iterable<{ path, content: Iterable<Number> }>
2022
Iterable<{ path, content: AsyncIterable<Buffer> }>
2123
Iterable<{ path, content: PullStream<Buffer> }>
2224
AsyncIterable<Buffer>
2325
AsyncIterable<{ path, content: Buffer }>
26+
AsyncIterable<{ path, content: Blob }>
2427
AsyncIterable<{ path, content: Iterable<Buffer> }>
2528
AsyncIterable<{ path, content: AsyncIterable<Buffer> }>
2629
AsyncIterable<{ path, content: PullStream<Buffer> }>
@@ -32,14 +35,14 @@ AsyncIterable<{ path, content: AsyncIterable<Buffer> }>
3235
*/
3336

3437
module.exports = function normalizeInput (input) {
35-
// Buffer/ArrayBuffer/TypedArray
38+
// Buffer|ArrayBuffer|TypedArray
3639
if (Buffer.isBuffer(input) || ArrayBuffer.isView(input) || input instanceof ArrayBuffer) {
3740
return (async function * () { // eslint-disable-line require-await
3841
yield normalizeTuple({ path: '', content: input })
3942
})()
4043
}
4144

42-
// Blob/File
45+
// Blob|File
4346
if (typeof Blob !== 'undefined' && input instanceof Blob) {
4447
return (async function * () { // eslint-disable-line require-await
4548
yield normalizeTuple({ path: '', content: input })
@@ -48,6 +51,7 @@ module.exports = function normalizeInput (input) {
4851

4952
// Iterable<Number>
5053
// Iterable<{ path, content: Buffer }>
54+
// Iterable<{ path, content: Blob }>
5155
// Iterable<{ path, content: Iterable<Number> }>
5256
// Iterable<{ path, content: AsyncIterable<Buffer> }>
5357
// Iterable<{ path, content: PullStream<Buffer> }>
@@ -66,6 +70,7 @@ module.exports = function normalizeInput (input) {
6670

6771
// AsyncIterable<Buffer>
6872
// AsyncIterable<{ path, content: Buffer }>
73+
// AsyncIterable<{ path, content: Blob }>
6974
// AsyncIterable<{ path, content: Iterable<Buffer> }>
7075
// AsyncIterable<{ path, content: AsyncIterable<Buffer> }>
7176
// AsyncIterable<{ path, content: PullStream<Buffer> }>
@@ -99,6 +104,7 @@ module.exports = function normalizeInput (input) {
99104
}
100105

101106
// { path, content: Buffer }
107+
// { path, content: Blob }
102108
// { path, content: Iterable<Buffer> }
103109
// { path, content: AsyncIterable<Buffer> }
104110
// { path, content: PullStream<Buffer> }
@@ -122,7 +128,7 @@ function normalizeTuple ({ path, content }) {
122128
}
123129

124130
function toAsyncIterable (input) {
125-
// Buffer/ArrayBuffer/TypedArray/array of bytes
131+
// Buffer|ArrayBuffer|TypedArray|array of bytes
126132
if (input[Symbol.iterator]) {
127133
const buf = Buffer.from(input)
128134
return Object.assign(
@@ -131,7 +137,7 @@ function toAsyncIterable (input) {
131137
)
132138
}
133139

134-
// Blob/File
140+
// Blob|File
135141
if (typeof Blob !== 'undefined' && input instanceof Blob) {
136142
return Object.assign(
137143
blobToAsyncIterable(input),

0 commit comments

Comments
 (0)