Static

Static

Methods

(static) assign(target, …sources)

Override the default assign method and ensure that the first argument is an instance of ElasticObject. Doesn't support addition of plugins, look into ElasticObject.loadPlugins() for that.

Source:
Parameters:
Name Type Attributes Description
target Object | ElasticObject
sources * <repeatable>

Objects|ElasticObjects to be merged

Returns:

ElasticObject

Example
const obj1 = {a: 1, b: 2};
const obj2 = {c: 3, d: 4};
console.log(ElasticObject.assign(obj1, obj2)); // ElasticObject {a: 1, b: 2, c: 3, d: 4}
const obj3 = {e: 5, f: 6};
const obj4 = new ElasticObject({g: 7, h: 8});
console.log(ElasticObject.assign(obj3, obj4)); // ElasticObject {e: 5, f: 6, g: 7, h: 8}

(static) create(data, pluginsopt)

Creates a new ElasticObject from an existing object.

Source:
See:
Parameters:
Name Type Attributes Description
data *
plugins * <optional>
Returns:

ElasticObject

Example
const obj = ElasticObject.create({a: 1, b: 2});

(static) fromEntries(entries, pluginsopt)

Creates a new ElasticObject from an iterable.

Source:
See:
Parameters:
Name Type Attributes Description
entries Iterable
plugins * <optional>
Returns:

ElasticObject

Example
const entries = new Map([
 ['foo', 'bar'],
 ['baz', 42]
 ]);
const eObj = ElasticObject.createFrom(entries);