# Yahoo! UI Library

### oop 3.1.1

Yahoo! UI Library > oop > YUI~oop
Search:
Filters Show Private Show Protected Show Deprecated

## Class YUI~oop

The following methods are added to the YUI instance

### Methods

#### aggregate

`object aggregate ( r , s , ov , wl )`
Applies object properties from the supplier to the receiver. If the target has the property, and the property is an object, the target object will be augmented with the supplier's value. If the property is an array, the suppliers value will be appended to the target.

Parameters:
  `r <Function>` the object to receive the augmentation
  `s <Function>` the object that supplies the properties to augment
  `ov <boolean>` if true, properties already on the receiver will be overwritten if found on the supplier.
  `wl <string[]>` a whitelist. If supplied, only properties in this list will be applied to the receiver.

Returns: `object`
  the extended object

#### augment

`object augment ( r , s , ov , wl , args )`
Applies prototype properties from the supplier to the receiver. The receiver can be a constructor or an instance.

Parameters:
  `r <Function>` the object to receive the augmentation
  `s <Function>` the object that supplies the properties to augment
  `ov <boolean>` if true, properties already on the receiver will be overwritten if found on the supplier.
  `wl <string[]>` a whitelist. If supplied, only properties in this list will be applied to the receiver.
  `args <Array | Any>` arg or arguments to apply to the supplier constructor when initializing.

Returns: `object`
  the augmented object

#### bind

`function bind ( f , c , args* )`
Returns a function that will execute the supplied function in the supplied object's context, optionally adding any additional supplied parameters to the beginning of the arguments collection the supplied to the function.

Parameters:
  `f <Function|String>` the function to bind, or a function name to execute on the context object
  `c <object>` the execution context
  `args* <object>` 0..n arguments to include before the arguments the function is executed with.

Returns: `function`
  the wrapped function

#### clone

`Array|Object clone ( o , safe , f , c , owner )`
Deep obj/array copy. Function clones are actually wrappers around the original function. Array-like objects are treated as arrays. Primitives are returned untouched. Optionally, a function can be provided to handle other data types, filter keys, validate values, etc.

Parameters:
  `o <object>` what to clone
  `safe <boolean>` if true, objects will not have prototype items from the source. If false, they will. In this case, the original is initially protected, but the clone is not completely immune from changes to the source object prototype. Also, cloned prototype items that are deleted from the clone will result in the value of the source prototype being exposed. If operating on a non-safe clone, items should be nulled out rather than deleted.
  `f <object>` optional function to apply to each item in a collection; it will be executed prior to applying the value to the new object. Return false to prevent the copy.
  `c <object>` optional execution context for f
  `owner <object>` Owner object passed when clone is iterating an object. Used to set up context for cloned functions.

Returns: `Array|Object`
  the cloned object

#### each

`YUI each ( o , f , proto )`
Executes the supplied function for each item in a collection. Supports arrays, objects, and Y.NodeLists

Parameters:
  `o <object>` the object to iterate
  `f <object>` the function to execute. This function receives the value, key, and object as parameters
  `proto <object>` if true, prototype properties are iterated on objects

Returns: `YUI`
  the YUI instance

#### extend

`YUI extend ( r , s , px , sx )`
Utility to set up the prototype, constructor and superclass properties to support an inheritance strategy that can chain constructors and methods. Static members will not be inherited.

Parameters:
  `r <Function>` the object to modify
  `s <Function>` the object to inherit
  `px <Object>` prototype properties to add/override
  `sx <Object>` static properties to add/override

Returns: `YUI`
  the YUI instance

#### rbind

`function rbind ( f , c , args* )`
Returns a function that will execute the supplied function in the supplied object's context, optionally adding any additional supplied parameters to the end of the arguments the function is executed with.

Parameters:
  `f <Function|String>` the function to bind, or a function name to execute on the context object
  `c <object>` the execution context
  `args* <object>` 0..n arguments to append to the end of arguments collection supplied to the function

Returns: `function`
  the wrapped function

Copyright © 2010 Yahoo! Inc. All rights reserved.