I added comments related to this, but some important things to know are as follows.
It is not necessary for calling code to call the loadTransformOptions() function. This should be called only if the caller wants to override the default transform options that are generated by this library. The caller can override the generated mapping of available options at any time. If the caller does nothing to specify the options mapping, then the library will automatically generate the full mapping of available options based on the _objGlobalDataTypeOptions and _objDataTypeOptionsTemplate objects that are embedded within the library. This occurs automatically when the decorator object is instantiated.
Whether the caller uses the default options mapping or specifies their own, every data type's options end up being composed of:
The "global" options that can apply to every data type (as specified in the _objGlobalDataTypeOptions object).
If the data type "extends" another data type, then it inherits whatever its parent has set for ops and acts.
The data type can have additional options defined just for it (e.g. the ip's bigInt action).
The data type can explicitly exclude options by including array fields named excludesOperands and excludesActions.
(NOTE: All of the above can be (optionally) customized by the calling code (if desired) by calling loadTransformOptions() and providing it a mapping object. Overriding the global options is a little wonky, but doable, and in general shouldn't be an issue. The expectation is that in the vast majority of cases calling code will want to use the transform options mapping that is generated automatically by default.)
When retrieving options for one or more data types...
...if, for example, you call fnReturnOptions() like this:
var objTransformOptions = objDec.fnReturnOptions({ typ: 'string', dataTypes: ['ip', 'url'] });
Then, the response you'd receive would look something like this:
I added comments related to this, but some important things to know are as follows.
It is not necessary for calling code to call the
loadTransformOptions()
function. This should be called only if the caller wants to override the default transform options that are generated by this library. The caller can override the generated mapping of available options at any time. If the caller does nothing to specify the options mapping, then the library will automatically generate the full mapping of available options based on the_objGlobalDataTypeOptions
and_objDataTypeOptionsTemplate
objects that are embedded within the library. This occurs automatically when the decorator object is instantiated.Whether the caller uses the default options mapping or specifies their own, every data type's options end up being composed of:
_objGlobalDataTypeOptions
object).ops
andacts
.bigInt
action).excludesOperands
andexcludesActions
.(NOTE: All of the above can be (optionally) customized by the calling code (if desired) by calling
loadTransformOptions()
and providing it a mapping object. Overriding the global options is a little wonky, but doable, and in general shouldn't be an issue. The expectation is that in the vast majority of cases calling code will want to use the transform options mapping that is generated automatically by default.)When retrieving options for one or more data types... ...if, for example, you call
fnReturnOptions()
like this:var objTransformOptions = objDec.fnReturnOptions({ typ: 'string', dataTypes: ['ip', 'url'] });
Then, the response you'd receive would look something like this:
(Note: The contents of the
ops
andacts
arrays for each data type get returned in alphabetical order.)