Skip to content

Commit effa77a

Browse files
committed
Docs/types: add Promise<T> and Array<T> lovell#472
Changelog updates and version bump of devDeps
1 parent 6ccccf8 commit effa77a

13 files changed

Lines changed: 109 additions & 50 deletions

docs/api-channel.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ For raw pixel input, the `options` object should contain a `raw` attribute, whic
3838

3939
**Parameters**
4040

41-
- `images` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) \| [String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) \| [Buffer](https://nodejs.org/api/buffer.html))** one or more images (file paths, Buffers).
41+
- `images` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;([String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) \| [Buffer](https://nodejs.org/api/buffer.html))> | [String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) \| [Buffer](https://nodejs.org/api/buffer.html))** one or more images (file paths, Buffers).
4242
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** image options, see `sharp()` constructor.
4343

4444

docs/api-constructor.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
22

3-
#
3+
# Sharp
44

55
**Parameters**
66

@@ -41,41 +41,41 @@ readableStream.pipe(transformer).pipe(writableStream);
4141

4242
- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** Invalid parameters
4343

44-
Returns **Sharp**
44+
Returns **[Sharp](#sharp)**
4545

46-
# queue
47-
48-
An EventEmitter that emits a `change` event when a task is either:
46+
## format
4947

50-
- queued, waiting for _libuv_ to provide a worker thread
51-
- complete
48+
An Object containing nested boolean values representing the available input and output formats/methods.
5249

5350
**Examples**
5451

5552
```javascript
56-
sharp.queue.on('change', function(queueLength) {
57-
console.log('Queue contains ' + queueLength + ' task(s)');
58-
});
53+
console.log(sharp.format());
5954
```
6055

61-
# format
56+
Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
6257

63-
An Object containing nested boolean values representing the available input and output formats/methods.
58+
## versions
59+
60+
An Object containing the version numbers of libvips and its dependencies.
6461

6562
**Examples**
6663

6764
```javascript
68-
console.log(sharp.format());
65+
console.log(sharp.versions);
6966
```
7067

71-
Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
68+
# queue
7269

73-
# versions
70+
An EventEmitter that emits a `change` event when a task is either:
7471

75-
An Object containing the version numbers of libvips and its dependencies.
72+
- queued, waiting for _libuv_ to provide a worker thread
73+
- complete
7674

7775
**Examples**
7876

7977
```javascript
80-
console.log(sharp.versions);
78+
sharp.queue.on('change', function(queueLength) {
79+
console.log('Queue contains ' + queueLength + ' task(s)');
80+
});
8181
```

docs/api-input.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ image
5757
});
5858
```
5959

60-
Returns **([Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) | Sharp)**
60+
Returns **([Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)> | Sharp)**
6161

6262
# limitInputPixels
6363

docs/api-operation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ Convolve the image with the specified kernel.
238238
- `kernel` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
239239
- `kernel.width` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** width of the kernel in pixels.
240240
- `kernel.height` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** width of the kernel in pixels.
241-
- `kernel.kernel` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** Array of length `width*height` containing the kernel values.
241+
- `kernel.kernel` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>** Array of length `width*height` containing the kernel values.
242242
- `kernel.scale` **\[[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)]** the scale of the kernel in pixels. (optional, default `sum`)
243243
- `kernel.offset` **\[[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)]** the offset of the kernel in pixels. (optional, default `0`)
244244

docs/api-output.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ A Promises/A+ promise is returned when `callback` is not provided.
1919

2020
- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** Invalid parameters
2121

22-
Returns **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)** when no callback is provided
22+
Returns **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)>** when no callback is provided
2323

2424
# toBuffer
2525

@@ -36,7 +36,7 @@ By default, the format will match the input image. JPEG, PNG, WebP, and RAW are
3636

3737
- `callback` **\[[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)]**
3838

39-
Returns **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)** when no callback is provided
39+
Returns **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;[Buffer](https://nodejs.org/api/buffer.html)>** when no callback is provided
4040

4141
# withMetadata
4242

docs/changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ Requires libvips v8.4.2.
3030
[#622](https://github.com/lovell/sharp/pull/622)
3131
[@ppaskaris](https://github.com/ppaskaris)
3232

33+
* Allow use of extend with greyscale input.
34+
[#623](https://github.com/lovell/sharp/pull/623)
35+
[@ppaskaris](https://github.com/ppaskaris)
36+
3337
### v0.16 - "*pencil*"
3438

3539
Requires libvips v8.3.3

lib/channel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ const extractChannel = function extractChannel (channel) {
5454
* Buffers may be any of the image formats supported by sharp: JPEG, PNG, WebP, GIF, SVG, TIFF or raw pixel image data.
5555
* For raw pixel input, the `options` object should contain a `raw` attribute, which follows the format of the attribute of the same name in the `sharp()` constructor.
5656
*
57-
* @param {Array|String|Buffer} images - one or more images (file paths, Buffers).
57+
* @param {Array<String|Buffer>|String|Buffer} images - one or more images (file paths, Buffers).
5858
* @param {Object} options - image options, see `sharp()` constructor.
5959
* @returns {Sharp}
6060
* @throws {Error} Invalid parameters

lib/constructor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ let versions = {
2525
})();
2626

2727
/**
28-
* @name sharp
28+
* @class Sharp
2929
*
3030
* Constructor factory to create an instance of `sharp`, to which further methods are chained.
3131
*

lib/input.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ const clone = function clone () {
154154
* });
155155
*
156156
* @param {Function} [callback] - called with the arguments `(err, metadata)`
157-
* @returns {Promise|Sharp}
157+
* @returns {Promise<Object>|Sharp}
158158
*/
159159
const metadata = function metadata (callback) {
160160
const that = this;

lib/operation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ const normalize = function normalize (normalize) {
318318
* @param {Object} kernel
319319
* @param {Number} kernel.width - width of the kernel in pixels.
320320
* @param {Number} kernel.height - width of the kernel in pixels.
321-
* @param {Array} kernel.kernel - Array of length `width*height` containing the kernel values.
321+
* @param {Array<Number>} kernel.kernel - Array of length `width*height` containing the kernel values.
322322
* @param {Number} [kernel.scale=sum] - the scale of the kernel in pixels.
323323
* @param {Number} [kernel.offset=0] - the offset of the kernel in pixels.
324324
* @returns {Sharp}

0 commit comments

Comments
 (0)