Skip to content

Commit 5dde570

Browse files
committed
Add "has" method to check if an instance has been created
1 parent 23552da commit 5dde570

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

index.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,20 @@ module.exports.get = function (name) {
4646
throw new Error("An instance with the name `%s` was not found.".replace("%s", name));
4747
};
4848

49+
/**
50+
* Check if an instance has been created.
51+
* @method has
52+
* @param {String} name
53+
* @returns {Boolean}
54+
*/
55+
module.exports.has = function (name) {
56+
var instance = getSingle(name);
57+
if (instance) {
58+
return true;
59+
}
60+
return false;
61+
};
62+
4963
/**
5064
* Start the Browsersync service. This will launch a server, proxy or start the snippet
5165
* mode depending on your use-case.

0 commit comments

Comments
 (0)