Skip to main content

Vinyl.isVinyl()

Determines if an object is a Vinyl instance. Use this method instead of instanceof.

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.

Usage

const Vinyl = require('vinyl');

const file = new Vinyl();
const notAFile = {};

Vinyl.isVinyl(file) === true;
Vinyl.isVinyl(notAFile) === false;

Signature

Vinyl.isVinyl(file);

Parameters

parametertypenote
fileobjectThe object to check.

Returns

True if the file object is a Vinyl instance.