Config
Table of Contents

Function

Object.values( object )

Returns an array of values for all enumerable properties defined explicitly on the object (not its prototype).

Parameters

objectObject The object to get the array of values from.

Returns

Array The list of values.

"use strict";

( function () {

Object.extend({
 values: function ( object ) {
   var values = [];
   for ( var key in object ) {
     if ( object.hasOwnProperty( key ) ) {
       values.push( object[ key ] );
     }
   }
   return values;
 },

Function

Object.keyOf( object, value )

Searches the object and returns the first key it finds which maps to the given value (as determined by ===).

Parameters

objectObject The object to search.
value* The value to search for.

Returns

String|undefined The key for that value in the object. Undefined is returned if the value is not found.

keyOf: function ( object, value ) {
   for ( var key in object ) {
     if ( object[ key ] === value ) {
       return key;
     }
   }
 },

Function

Object.filter( object, include )

Takes two objects and returns a new object which contains all the properties of the first for which the same key has a truthy value in the second.

Parameters

objectObject The object to copy properties from.
includeObject The object to check for a truthy key value in before copying the property.

Returns

Object The filtered object.

filter: function ( object, include ) {
   var result = {},
     key;
   for ( key in object ) {
     if ( include[ key ] ) {
       result[ key ] = object[ key ];
     }
   }
   return result;
 },

Function

Object.zip( keys, values )

Takes two arrays and returns an object with keys from the first array and values taken from the corresponding position in the second array.

Parameters

keys{String[]} The array of keys.
valuesArray The array of values.

Returns

Object The object mapping keys to values.

zip: function ( keys, values ) {
   var l = Math.min( keys.length, values.length ),
     obj = {};
   while ( l-- ) {
     obj[ keys[l] ] = values[l];
   }
   return obj;
 },

Function

Object.fromQueryString( query )

Converts a URL query string (the part after the '?') into an object of key/value pairs.

Parameters

queryString The key/value pairs in query string form.

Returns

Object The key/value pairs in object form.

fromQueryString: function ( query ) {
   var result = {};
   query.split( '&' ).forEach( function ( pair ) {
       var parts = pair.split( '=' ).map( decodeURIComponent );
       result[ parts[0] ] = parts[1];
   });
   return result;
 }
});

}() );
Animation
Application
Core
DataStore
DOM
DragDrop
Foundation
IO
Localisation
Selection
Parser
TimeZones
Storage
Touch
CollectionViews
UA
ContainerViews
ControlViews
PanelViews
View