Classes
- ArrayFactory
- DumpFactory
- NSFactory
Class for handling data from events emitted during XML parsing.
Methods
(inner) convertArray(split) → {DataConverter}
Creates a converter function for splitting a string value as defined. If the value ultimately passed to the returned function can't be split, it returns an empty array.
Parameters:
Name | Type | Description |
---|---|---|
split |
string | RegExp | String or regular expression to split values at |
Returns:
A converter function splitting the value as defined
- Type
- DataConverter
(inner) convertBoolean(val) → {boolean}
A standard DataConverter
function that returns true
if the
supplied value is '1'
, and false
otherwise.
Parameters:
Name | Type | Description |
---|---|---|
val |
string | Text value to check |
Returns:
true
if val==='1'
, otherwise false
- Type
- boolean
(inner) convertNumber(val) → {number}
A standard DataConverter
function that examines the supplied value
and attempts to convert it to the number
it is equivalent to.
Parameters:
Name | Type | Description |
---|---|---|
val |
string | Text value to convert |
Returns:
The equivalent number value; NaN
if none exists
- Type
- number
(inner) createError()
Type Definitions
Attributes
Represents the attributes present on an XML tag.
Type:
- Object.<string, string>
DataConverter(val) → {boolean|string|number|object}
Parameters:
Name | Type | Description |
---|---|---|
val |
any | Value to operate on |
Returns:
The result of the conversion
- Type
- boolean | string | number | object
FactoryConstructor(root) → {NSFactory.<ProductType>}
Parameters:
Name | Type | Description |
---|---|---|
root |
module:nationscript/factory~Attributes | Attributes present on the XML root to handle |
Returns:
The initialized factory
- Type
- NSFactory.<ProductType>
FactoryDecider(check) → {boolean}
Parameters:
Name | Type | Description |
---|---|---|
check |
ProductType | The |
Returns:
true
to keep the product
, false
to discard it
- Type
- boolean
TagHandler(me, attrs) → {void}
Parameters:
Name | Type | Description |
---|---|---|
me |
NSFactory |
|
attrs |
module:nationscript/factory~Attributes | Key-value pairs of the tag's attributes |
Returns:
- Type
- void