UNPKG

explicit

Version:

System to explicitly specify the way a method works.

22 lines (19 loc) 449 B
'use strict' function assertPlugin (options, plugin) { if (!options) { options = {} } if (!options.plugins) { options.plugins = [] } if (!Array.isArray(options.plugins)) { if (options.plugins === plugin) { return options } options.plugins = [plugin, options.plugins] } else if (options.plugins.indexOf(plugin) === -1) { options.plugins.unshift(plugin) } return options } module.exports = assertPlugin