⁘ common

NFOS

NFOS wraps a few methods to consistantly fetch a class' NFO.
These are comparable to meta-data associated with a given class, only they are used internally to enforce defaut configurations & values, streamline behaviors and make everything both more modular and predictable.

Common use of NFOs include component external CSS definition, data icon associations, default serializer associations etc...

In background, a class NFO is just a static __NFO__ member pointing to a simple {object}, hence can be manipulated to alter some architectural behaviors at a very low level.

If you want to change/edit NFOs at runtime, make sure you know what you're doing !
go to → Members

Methods

staticGet(p_obj, p_fallback) → {object}

Parameters:
Name Type Default Description
p_obj *
p_fallback object null

staticExt(p_baseObject, p_baseClass, p_merge)

Extends 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']
}