Skip to content

Commit 25a22bf

Browse files
janiceilenephated
authored andcommitted
Docs: Add Vinyl.isVinyl() documentation
1 parent fc09067 commit 25a22bf

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

docs/api/vinyl-isvinyl.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<!-- front-matter
2+
id: api-vinyl-isvinyl
3+
title: Vinyl.isVinyl()
4+
hide_title: true
5+
sidebar_label: Vinyl.isVinyl()
6+
-->
7+
8+
# Vinyl.isVinyl()
9+
10+
Determines if an object is a Vinyl instance. Use this method instead of `instanceof`.
11+
12+
**Note**: This method uses an internal property that some older versions of Vinyl didn't expose resulting in a false negative if using an outdated version.
13+
14+
## Usage
15+
16+
```js
17+
const Vinyl = require('vinyl');
18+
19+
const file = new Vinyl();
20+
const notAFile = {};
21+
22+
Vinyl.isVinyl(file) === true;
23+
Vinyl.isVinyl(notAFile) === false;
24+
```
25+
26+
## Signature
27+
28+
```js
29+
Vinyl.isVinyl(file);
30+
```
31+
32+
### Parameters
33+
34+
| parameter | type | note |
35+
|:--------------:|:------:|-------|
36+
| file | object | The object to check. |
37+
38+
### Returns
39+
40+
True if the `file` object is a Vinyl instance.
41+

0 commit comments

Comments
 (0)