Report an issue
Class

CKEDITOR.tools.object

class since 4.7.1

The namespace with helper functions and polyfills for objects.

Filtering

Methods

  • 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.

  • 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.