Report an issue
Class

CKEDITOR.tools.object

class since 4.7.1

The namespace with helper functions and polyfills for objects.

Filtering

Properties

  • since 4.12.0 private

    DONT_ENUMS : Array

    List of ECMA3 object properties with obsolete DontEnum attribute.

    Defaults to ['toString', 'toLocaleString', 'valueOf', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'constructor']

Methods

  • since 4.12.0

    entries( obj ) → Array

    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

    Returns the first key from obj which has a given value.

    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 or null if not found.

  • since 4.12.0

    keys( obj ) → Array

    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

    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.

  • since 4.12.0

    values( obj ) → Array

    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.