function resolvePlugin(item) {
    /**
     * Handle when string was given, such as plugins: ['bs-html-injector']
     */
    if (typeof item === "string") {
        return getFromString(item);
    }

    if (!isMap(item)) {
        return new Plugin().mergeDeep({
            errors: [new Error("Plugin not supported in this format")]
        });
    }

    if (item.has("module")) {
        var nameOrObj = item.get("module");
        var options = item.get("options");

        /**
         * The 'module' key can be a string, this allows
         * inline plugin references, but with options
         * eg:
         *
         * bs.init({
         *     plugins: [
         *         {
         *             module: './myjs-file.js'
         *             options: {
         *                 files: "*.html"
         *             }
         *         }
         *     ]
         * });
         */
        if (typeof nameOrObj === "string") {
            return getFromString(nameOrObj).mergeDeep({
                options: options
            });
        }

        /**
         * If the plugin was given completely inline (because it needs options)
         * eg:
         *
         * bs.init({
         *     plugins: [
         *         {
         *             module: {
         *                 plugin: function() {
         *                     console.log('My plugin code')
         *                 }
         *             },
         *             options: {
         *                 files: "*.html"
         *             }
         *         }
         *     ]
         * })
         */
        if (Immutable.Map.isMap(nameOrObj)) {
            return new Plugin({
                module: nameOrObj,
                options: options
            });
        }
    }

    /**
     * If a module was given directly. For example, ater calling require.
     *
     * eg:
     *    var myplugin = require('./some-js');
     *    bs.init({plugins: [myplugin]});
     */
    if (item.has("plugin")) {
        return new Plugin({
            module: item
        });
    }

    /**
     * If we reach here, the plugin option was used incorrectly
     */
    return new Plugin().mergeDeep({
        errors: [new Error("Plugin was not configured correctly")]
    });
}
Accept a string/object
and resolve it into the plugin format above
@param item
@returns {*}