Sindbad~EG File Manager

Current Path : /home/infinitibizsol/.trash/node_modules.2/cloudinary-core/src/util/
Upload File :
Current File : /home/infinitibizsol/.trash/node_modules.2/cloudinary-core/src/util/ensureOption.js

/**
 * Returns an ensureOption function that relies on the provided `defaults` argument
 * for default values.
 * @private
 * @param {object} defaults
 * @return {function(*, *, *=): *}
 */
export function defaults(defaults) {
  return function ensureOption(options, name, defaultValue) {
    let value = options[name] || defaults[name] || defaultValue;
    if (value === undefined) {
      throw `Must supply ${name}`;
    }
    return value;
  };
}

/**
 * Get the option `name` from options, the global config, or the default value.
 * If the value is not defined and no default value was provided,
 * the method will throw an error.
 * @private
 * @param {object} options
 * @param {string} name
 * @param {*} [defaultValue]
 * @return {*} the value associated with the provided `name` or the default.
 *
 */
const empty = defaults({});
export default empty;


Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists