CKEDITOR.tools.object
The namespace with helper functions and polyfills for objects.
Filtering
Properties
-
List of ECMA3 object properties with obsolete DontEnum attribute.
Defaults to
['toString', 'toLocaleString', 'valueOf', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'constructor']
Methods
-
Returns an array of key-value pairs using enumerable string-keyed object properties.
console.log( CKEDITOR.tools.object.entries( { foo: 1, bar: false } ); // -> [ [ 'foo', 1 ], [ 'bar', false ] ]
Parameters
obj : Object
Returns
Array
Object's key-value pairs.
-
findKey( obj, value ) → String | null
CKEDITOR.tools.object#findKey
Returns the first key from
obj
which has a givenvalue
.Parameters
obj : Object
An object whose
key
is looked for.value : Mixed
An object's
value
to be looked for.
Returns
String | null
Matched
key
ornull
if not found.
-
Returns an array of passed object keys.
console.log( CKEDITOR.tools.object.keys( { foo: 1, bar: false } ); // -> [ 'foo', 'bar' ]
Parameters
obj : Object
Returns
Array
Object's keys.
-
merge( obj1, obj2 ) → Object
CKEDITOR.tools.object#merge
Merges two objects and returns the new one.
var obj1 = { a: 1, conflicted: 10, obj: { c: 1 } }, obj2 = { b: 2, conflicted: 20, obj: { d: 2 } }; CKEDITOR.tools.object.merge( obj1, obj2 );
This code produces the following object:
{ a: 1, b: 2, conflicted: 20, obj: { c: 1, d: 2 } }
Parameters
obj1 : Object
The source object which will be used to create a new base object.
obj2 : Object
An object whose properties will be merged into the base one.
Returns
Object
The merged object.
-
Returns an array of passed object enumerable values.
console.log( CKEDITOR.tools.object.values( { foo: 1, bar: false } ); // -> [ 1, false ]
Parameters
obj : Object
Returns
Array
Object's values.