Methods
(p_obj, p_fallback) → {object}
GetParameters:
Name | Type | Default | Description |
---|---|---|---|
p_obj |
* | ||
p_fallback |
object |
null
|
(p_baseObject, p_baseClass, p_merge)
ExtExtends another class NFO by copying properties & value from that class NFO that are missing
or undefined in the provided p_base
object. Existing properties values are left untouched, while arrays can be merged on
a per-case basis.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
p_baseObject |
* | target (base) nfo object |
|
p_baseClass |
* | class to extend nfo from |
|
p_merge |
* |
null
|
properties ID to be merged in (properties should be arrays) |
Examples:
//NFO from hypothetical 'Bar' class)
{
name:'Bar Object',
foo:'faz',
someArray:['A', 'B', 'C']
};
//Base object
var baseNFO = {
name:'My Custom NFO',
someArray:['CustomValue']
};
//Without merging options set
NFOS.Ext(baseNFO, Bar) == {
name:'My Custom NFO',
foo:'faz',
someArray:['CustomValue']
}
//With merging options set
NFOS.Ext(baseNFO, Bar, ['someArray']) == {
name:'My Custom NFO',
foo:'faz',
someArray:['A', 'B', 'C', 'CustomValue']
}