UNPKG

yui-pathogen-encoder

Version:

Enables pathogen encoding in YUI Loader

49 lines (38 loc) 1.11 kB
/* * Copyright (c) 2013, Yahoo! Inc. All rights reserved. * Copyrights licensed under the New BSD License. * See the accompanying LICENSE.txt file for terms. */ /*jslint nomen:true, node:true */ "use strict"; var plugin = require('./plugin'); /** Extends object with properties from other objects. var a = { foo: 'bar' } , b = { bar: 'baz' } , c = { baz: 'xyz' }; utils.extends(a, b, c); // a => { foo: 'bar', bar: 'baz', baz: 'xyz' } @method extend @param {Object} obj the receiver object to be extended @param {Object*} supplier objects @return {Object} The extended object **/ function extend(obj) { Array.prototype.slice.call(arguments, 1).forEach(function (source) { var key; if (!source) { return; } for (key in source) { if (source.hasOwnProperty(key)) { obj[key] = source[key]; } } }); return obj; } module.exports = { yui: function (describe) { describe = extend({}, plugin.describe, describe || {}); return extend({}, plugin, { describe: describe }); } };