Bajo

The core plugin. The main engine. The special plugin that controls the app's boot process and makes sure all other plugins work nicely.

Don't create your own instance of this class or App class. Instead, use the boot process.

Constructor

new Bajo(app)

Constructor.

Parameters:
NameTypeDescription
appApp

App instance. Usefull to call app method inside a plugin.

Members

alias :string

Alias. Read-only

Type:
  • string
Default Value
  • 'bajo'

config :Bajo.TConfig

Configuration object

See
  • config

hooks :Array.<Bajo.THook>

Hooks container. This is where all hooks definition are stored.

Type:
  • Array.<Bajo.THook>

whiteSpace :Array.<string>

Array of white space characters. Used to trim strings

Type:
  • Array.<string>

Methods

(async) bootApp()

Bajo boot process. This method is called by the App class during the app's boot process:

  1. Ensure directories are there and exist
  2. Collect all plugins available plugins
  3. Collect all config handlers from all loaded plugins
  4. Build configuration object
  5. Building plugins listed in package.json or .plugins file
  6. Determining the boot order
  7. Ensure the uniqueness of all plugins' name and alias
  8. Ensure all plugins dependencies are met
  9. Collect all hooks from all loaded plugins
  10. Run all plugins according to the boot order
  11. And finally attaching all exit handlers it could find

breakNsPath(name, checkNsopt) → {Bajo.TNsPathResult}

Break name to their components.

If path starts with //, e.g. name is https://example.com, it will be treated as a URL and returned as an object with only path property filled with the original name.

If query string is present in the path, it will be parsed and returned as an object with qs property containing the parsed query string.

If path contains parameters in the format of :key|value or {key|value}, they will be extracted and returned as an object with params property containing the extracted parameters.

This method is one of the most used method in Bajo. It is because every files, names, resources, and even commands are all identified by their namespace and path.

Parameters:
NameTypeAttributesDefaultDescription
nameBajo.TNsPathPairs

Name in format ns:path

checkNsboolean<optional>
true

If true (default), check if the namespace exists in the app. If not, throw an error

Returns:
Type: 
Bajo.TNsPathResult

breakNsPathFromFile(options) → {Object}

Break file path to its namespace & path infos.

Parameters:
NameTypeDescription
optionsObject

Options object

Properties
NameTypeAttributesDescription
filestring<optional>

File path to break

dirstring<optional>

Base directory to remove from file path

nsstring<optional>

Namespace to use. If not provided, will be extracted from file path

suffixstring<optional>

Suffix to remove from file path

getTypeboolean<optional>

Whether to extract type from file path

Returns:

Namespace and path information

Type: 
Object

(async) buildCollections(optionsopt) → {Array.<Object>}

Method to transform config's array or object into a collection of objects with uniformed structure. This is useful to build a collection of items from config's array or object, e.g. a collection of commands, routes, etc.

You typically also provide a handler function to transform each item in the collection. The handler function will be called with an object containing the following keys:

  • item: the current item in the collection
  • index: the index of the current item in the collection
  • cfg: the entire config object
Parameters:
NameTypeAttributesDefaultDescription
optionsObject<optional>
{}

Options

Properties
NameTypeAttributesDefaultDescription
nsstring<optional>
'bajo'

Namespace. If not provided, defaults to bajo

handlerfunction<optional>

Function to transform each item while building

dupChecksArray.<string><optional>
[]

Array of keys to check for duplicates

containerstring

Key used as container name

useDefaultNameboolean<optional>
true

If true (default) and name key is not provided, returned item will be named default

Returns:

Returned collection of objects

Type: 
Array.<Object>

buildNsPath(optionsopt) → {TNsPathPairs}

Build ns/path pairs.

Parameters:
NameTypeAttributesDefaultDescription
optionsobject<optional>
{}

Options object

Properties
NameTypeAttributesDefaultDescription
nsstring<optional>
''

Namespace

subNsstring<optional>

Sub namespace

subSubNsstring<optional>

Sub sub namespace

pathstring<optional>

Path

Returns:

Ns/path pairs

Type: 
TNsPathPairs

(async) callHandler(name, …argsopt) → {Promise.<*>}

Calling a function handler in any plugins:

  • If name is a string, the corresponding plugin's method will be called with passed args as its parameters
  • If name is a plugin instance, this will be used as the scope instead. The first args is now the handler name and the rest are its parameters
  • If name is a function, this function will be run under scope with the remaining args
  • If name is an object and has handler key in it, this function handler will be instead
Parameters:
NameTypeAttributesDescription
nameTNsPathPairs | Plugin | function | Object

Method's name, plugin instance, function handler or plain object. See above for details

args*<optional>
<repeatable>

One or more arguments passed as parameter to the handler

Returns:

Returned value

Type: 
Promise.<*>

(async) eachPlugins(handler, optionsopt) → {Promise.<Object>}

This function iterates through all loaded plugins and call the provided handler scoped as the running plugin. And an object with the following key serves as its parameter:

  • file: file matched the glob pattern
  • dir: plugin's base directory

Inside the handler, return false to break the loop, return undefined to skip the current item, or return any value to be saved in the result object.

Parameters:
NameTypeAttributesDefaultDescription
handlerfunction

Function handler. Can be an async function. Scoped to the running plugin

optionsstring | Object<optional>
{}

Options. If a string is provided, it serves as the glob pattern as described below, otherwise:

Properties
NameTypeAttributesDefaultDescription
globstring | Array.<string><optional>

Glob pattern. If provided, it will be used to find files in the plugin's extend directory. If not provided, the handler will be called once for each plugin

useBajoboolean<optional>
false

If true, add bajo to the running plugins too

prefixstring<optional>
''

Prepend glob pattern with prefix.

noUnderscoreboolean<optional>
true

If true (default), matched file with name starts with underscore is ignored.

returnItemsboolean<optional>

If true, each value of returned handler call will be saved as an object with running plugin name as its keys.

Returns:

Object with each plugin's name as its key and the returned value from the handler as its value

Type: 
Promise.<Object>

format(value, typeopt, optionsopt) → {string}

Format value.

Parameters:
NameTypeAttributesDefaultDescription
value*

Value to format.

typestring<optional>

Data type to use. See TBajoDataType for acceptable values. If not provided, return the untouched value.

optionsObject<optional>
{}

Options.

Properties
NameTypeAttributesDefaultDescription
emptyValuestring<optional>
''

Empty value to use if function resulted empty. Defaults to the one from your config.

withUnitboolean<optional>
true

Return with its unit appended.

langstring<optional>

Format value according to this language. Defaults to the one you set in config.

latitudestring<optional>

If Bajo Spatial is loaded and data type is a double or float, then format it as latitude in degree, minute, second.

longitudestring<optional>

If Bajo Spatial is loaded and data type is a double or float, then format it as longitude in degree, minute, second.

Returns:

Formatted value.

Type: 
string

formatByField(field, value, dataTypeopt, optionsopt) → {Array|string}

Format value by field name.

Parameters:
NameTypeAttributesDefaultDescription
fieldstring

Format field name. See TBajoFormatField for acceptable values.

value*

Value to format.

dataTypestring<optional>

Value's data type. See TBajoDataType for acceptable values.

optionsObject<optional>
{}

Options.

Properties
NameTypeAttributesDefaultDescription
withUnitboolean<optional>
true

Return with its unit appended.

langstring<optional>

Format value according to this language. Defaults to the one you set in config.

Returns:

Return string if withUnit is true. Otherwise is an array of [value, unit, separator].

Type: 
Array | string

(async) fromJs(file) → {Object}

Read and parse JavaScript file.

Parameters:
NameTypeAttributesDefaultDescription
filestring

File to read and parse

options.readFromFileboolean<optional>
false

Ignored for this method. Always read from file.

options.throwNotFoundboolean<optional>
false

If true, throw exception if file is not found

options.defValueobject<optional>
{}

Default value to use if value returned empty

options.parserOptsobject<optional>
{}

Options to be passed if file exports a function

Returns:

Parsed JavaScript object

Type: 
Object

(async) fromJson(text, optionsopt) → {Object}

Parse JSON string or read and parse JSON file.

Parameters:
NameTypeAttributesDefaultDescription
textstring

Text to be parsed or file path to be read if options.readFromFile is true

optionsobject | boolean<optional>
{}

Options object. If a boolean is provided, it will be treated as options.readFromFile

Properties
NameTypeAttributesDefaultDescription
readFromFileboolean<optional>
false

If true, text is treated as a file path

throwNotFoundboolean<optional>
false

If true, throw exception if file is not found

defValueobject<optional>
{}

Default value to use if value returned empty

parserOptsobject<optional>
{}

Options to be passed to JSON.parse()

Returns:

Parsed object.

Type: 
Object

(async) fromYaml(text, optionsopt) → {object}

Parse YAML text or read and parse YAML file.

Parameters:
NameTypeAttributesDefaultDescription
textstring

Text to be parsed or file path to be read if options.readFromFile is true

optionsobject | boolean<optional>
{}

Options object. If a boolean is provided, it will be treated as options.readFromFile

Properties
NameTypeAttributesDefaultDescription
readFromFileboolean<optional>
false

If true, text is treated as a file path

throwNotFoundboolean<optional>
false

If true, throw exception if file is not found

parserOptsobject<optional>
{}

Options to be passed to YAML.load()

defValueobject<optional>
{}

Default value to use if value returned empty

Returns:

Parsed object

Type: 
object

(async) fromYml(text, optionsopt) → {object}

Parse YML text or read and parse YML file. Alias for Bajo#fromYaml.

Parameters:
NameTypeAttributesDefaultDescription
textstring

Text to be parsed or file path to be read if options.readFromFile is true

optionsobject | boolean<optional>
{}

Options object. If a boolean is provided, it will be treated as options.readFromFile

Properties
NameTypeAttributesDefaultDescription
readFromFileboolean<optional>
false

If true, text is treated as a file path

throwNotFoundboolean<optional>
false

If true, throw exception if file is not found

defValueobject<optional>
{}

Default value to use if value returned empty

parserOptsobject<optional>
{}

Options to be passed to YAML.load()

Returns:

Parsed object

Type: 
object

getDownloadDir() → {string}

Get download directory. If doesn't exist, it will be created automatically.

Returns:

Absolute path to the download directory

Type: 
string

getMethod(name, thrownopt) → {function}

Get class method by name.

Parameters:
NameTypeAttributesDefaultDescription
namestring

Name in format ns:methodName.

thrownboolean<optional>
true

If true (default), throw exception in case of error.

Returns:

Class method.

Type: 
function

getModuleDir(pkgName, withGlobalDiropt) → {string}

Get module directory.

Parameters:
NameTypeAttributesDefaultDescription
pkgNamestring

Package name to find.

withGlobalDirboolean<optional>
true

Whether to include the global module directory.

Returns:

Return absolute package directory.

Type: 
string

getUnitFormat(optionsopt) → {TBajoFormatResult}

Get unit format.

Parameters:
NameTypeAttributesDefaultDescription
optionsObject<optional>
{}

Options.

Properties
NameTypeAttributesDescription
langstring<optional>

Language to use. Defaults to the one you set in config.

unitSysstring<optional>

Unit system to use. Defaults to language's unit system or metric if unspecified.

Returns:

Returned value.

Type: 
TBajoFormatResult

(async) importModule()

Import file/module from any loaded plugins.

Method proxy from module:Helper.importModule

(async) importPkg(…pkgs) → {Object|Array}

Import one or more packages belongs to a plugin.

If the last arguments passed is an object, this object serves as options object:

  • returnDefault: should return package's default export. Defaults to true
  • throwNotFound: should throw if package is not found. Defaults to false
  • noCache: always use fresh import. Defaults to false
  • asObject: see below. Defaults to false

Return value:

  • if options.asObject is true (default false), return as object with package's names as it's keys
  • Otherwise depends on how many parameters are provided, it should return the named package or an array of packages

Example: you want to import delay and chalk from bajo plugin because you want to use it in your code `javascript const { importPkg } from this.app.bajo const [delay, chalk] = await importPkg('bajo:delay', 'bajo:chalk')

await delay(1000) ... `

Parameters:
NameTypeAttributesDescription
pkgsTNsPathPairs<repeatable>

One or more packages in format {ns}:{packageName}.

Returns:

See above.

Type: 
Object | Array

isLogInRange(level) → {boolean}

Check whether log level is within log's app current level.

Parameters:
NameTypeDescription
levelstring

Level to check. See TLogLevels for more.

Returns:
Type: 
boolean

isValidApp(dir, returnPkgopt) → {boolean|Object}

Check whether directory is a valid Bajo app.

Parameters:
NameTypeAttributesDescription
dirstring

Directory to check.

returnPkgboolean<optional>

Set true to return its package.json content.

Returns:
Type: 
boolean | Object

isValidPlugin(dir, returnPkgopt) → {boolean|Object}

Check whether directory is a valid Bajo plugin.

Parameters:
NameTypeAttributesDescription
dirstring

Directory to check.

returnPkgboolean<optional>

Set true to return its package.json content.

Returns:
Type: 
boolean | Object

join(input, optionsopt) → {string}

Return human friendly joined array of items.

Parameters:
NameTypeAttributesDefaultDescription
inputArray.<*>

Array to join

optionsstring | Object<optional>
{}

If provided and is a string, it will be used as separator.

Properties
NameTypeAttributesDefaultDescription
separatorstring<optional>
', '

Separator to use.

lastSeparatorstring<optional>
'and'

Text to use as the last separator.

Returns:
Type: 
string

numUnit(valueopt, defUnitopt) → {string}

Get numeric portion and its unit from a string.

Parameters:
NameTypeAttributesDefaultDescription
valuestring<optional>
''

Value to get its numeric portion

defUnitstring<optional>
''

Default unit if value doesn't have one

Returns:
Type: 
string

parseConfig(input, extsopt, optionsopt) → {Object|Array|null}

Parse input using all registered config handlers. The first handler that returns a valid object or array will be used.

Use this method if you want to parse a text input that can be in any format supported by the registered config handlers.

Parameters:
NameTypeAttributesDefaultDescription
inputstring

The input string to be processed by the config handlers.

extsArray.<string><optional>

Optional array of extensions to filter the config handlers. If provided, only handlers with matching extensions will be used.

optionsobject<optional>
{}

Options to be passed to the config handlers.

Returns:

The result from the first successful config handler, or null if none succeed.

Type: 
Object | Array | null

(async) readAllConfigs(path, optionsopt) → {Object}

Read all forms of configuration files from file path.

Internally, it will call Bajo#readConfig twice, first for the default config file and second for the environment based config file. Then it will merge both results using defaultsDeep.

Parameters:
NameTypeAttributesDefaultDescription
pathstring

Base path to start looking config files.

optionsObject<optional>
{}

Options. See Bajo#readConfig for more.

Returns:

Merged configuration object.

Type: 
Object

(async) readConfig(file, optionsopt) → {Object}

Read and parse file as config object. Supported types: .js, .json and .yml/.yaml. More supports can be added using plugin. bajo-config gives you additional supports for .yml, .yaml and .toml file.

If file extension is .*, it will be auto detected and parsed accordingly

Parameters:
NameTypeAttributesDefaultDescription
filestring

File to read and parse.

optionsObject<optional>
{}

Options

Properties
NameTypeAttributesDefaultDescription
ignoreErrorboolean<optional>

Any exception will be silently discarded

nsstring<optional>

If provided, scoped to this namespace. Otherwise, the running plugin's namespace will be used

baseNsstring<optional>

If provided, it will be used as the base namespace for extending config from other plugins

extendstring | Array.<string> | boolean<optional>

If provided, it will be used as the base namespace for extending config from other plugins. Set to false to disable extending

checkOverrideboolean<optional>

If true and baseNs is provided or extend is not false, check for override config in main plugin

mergeboolean | string<optional>

If true, config from other plugins will be merged into the original config. If concat, it performs array concatenation if object is an array. Otherwise, it will perform a deep defaults merge

patternstring<optional>

If provided and auto detection is on (extension is .*), it will be used for instead the auto generated one

defValueObject<optional>
{}

Default value to use if value returned empty

parserOptsObject<optional>
{}

Parser options

globOptsObject<optional>
{}

fast-glob options

Returns:
Type: 
Object

(async) runHook(hookName, …argsopt) → {Array}

Run named module:Hook.

If no hook found with the given name, it will return an empty array. If a hook has noWait set to true, it will not wait for the hook to finish and will not return its result.

Note: Even though this method returns a result, it is not recommended to use the result for any purpose. Use the result only for debugging or logging purposes. Hooks are designed to be fast, lightweight and mutate arguments given to them so that the next hook can benefit from the changes.

Parameters:
NameTypeAttributesDescription
hookNameTNsPathPairs

Name of the hook to run.

argsany<optional>
<repeatable>

Argument passed to the hook function.

Returns:

Array of hook execution results.

Type: 
Array

(async) saveAsDownload(file, item, printSavedopt) → {string}

Save item as file in Bajo's download directory. That is a directory inside your Bajo plugin's data directory.

If file exists already, file will automatically be renamed incrementally.

Parameters:
NameTypeAttributesDefaultDescription
filestring

File name.

itemObject

Item to save.

printSavedboolean<optional>
true

Print info on screen.

Returns:

Full file path.

Type: 
string

(async) toJson(data, optionsopt) → {Promise.<(string|void)>}

Convert data to JSON string, optionally write to file if options.writeToFile is provided.

Parameters:
NameTypeAttributesDefaultDescription
dataObject

Data to convert to JSON string

optionsObject | string<optional>
{}

Options object. If a string is provided, it will be treated as options.writeToFile

Properties
NameTypeAttributesDefaultDescription
writeToFilestring<optional>

If not empty, write result to this file path instead of returning it as string

parserOptsObject<optional>
{}

Options for JSON.stringify()

Returns:

JSON string or void if written to file

Type: 
Promise.<(string|void)>

(async) toYaml(object, optionsopt) → {Promise.<(string|void)>}

Convert object to YAML string, optionally write to file if options.writeToFile is provided.

Parameters:
NameTypeAttributesDescription
objectobject

Object to be converted

optionsobject | string<optional>

Options object. If a string is provided, it will be treated as options.writeToFile

Properties
NameTypeAttributesDefaultDescription
writeToFilestring<optional>

If not empty, write result to this file path instead of returning it as string

parserOptsObject<optional>
{}

Options for YAML.dump()

Returns:

YAML string or void if written to file

Type: 
Promise.<(string|void)>

(async) toYml(object, optionsopt) → {Promise.<(string|void)>}

Convert object to YML string, optionally write to file if options.writeToFile is provided. Alias for Bajo#toYaml.

Parameters:
NameTypeAttributesDescription
objectobject

Object to be converted

optionsobject | string<optional>

Options object. If a string is provided, it will be treated as options.writeToFile

Properties
NameTypeAttributesDefaultDescription
writeToFilestring<optional>

If not empty, write result to this file path instead of returning it as string

parserOptsObject<optional>
{}

Options for YAML.dump()

Returns:

YAML string or void if written to file

Type: 
Promise.<(string|void)>

Type Definitions

TConfig

Type:
  • Object
Properties
NameTypeAttributesDefaultDescription
envstring

Environment name (dev or prod)

runtimeObject<optional>
{}

Runtime configuration

Properties
NameTypeAttributesDefaultDescription
noWarningboolean<optional>
false

If true, Bajo will not show any warning messages. Default is false

logObject<optional>
{}

Logging configuration

Properties
NameTypeAttributesDefaultDescription
timeTakenboolean<optional>
false

If true, Bajo will log the time taken for each operation. Default is false

dateFormatstring<optional>
'YYYY-MM-DDTHH:mm:ss.SSS'

Date format for logging

useUtcboolean<optional>
false

If true, Bajo will use UTC instead of local time for logging. Default is false

prettyboolean<optional>
false

If true, Bajo will use pretty logging format. Default is false

appletboolean<optional>
false

Whether to log when in applet mode or not. Default is false

saveboolean<optional>
false

Whether to save logs to file. Default is false

rotationObject<optional>
{}

Log rotation configuration, used only if log.save is true

Properties
NameTypeAttributesDefaultDescription
cyclestring<optional>
'none'

Rotation cycle (none, daily, weekly, monthly). Default is none

compressOldboolean<optional>
true

Whether to compress old logs. Default is true

byPluginboolean<optional>
false

Whether to rotate logs by plugin. Default is false

retainnumber<optional>
5

Number of old logs to retain. Default is 5

dumpObject<optional>
{}

Dump configuration

Properties
NameTypeAttributesDefaultDescription
depthnumber<optional>
2

Depth of object to dump. Default is 2

compactboolean<optional>
false

If true, Bajo will dump objects in compact format. Default is false

colorsboolean<optional>
true

If true, Bajo will dump objects with colors. Default is true

breakLengthnumber<optional>
80

Break length for dumping objects. Default is 80

callerboolean<optional>
true

If true, Bajo will dump the caller of the dump function. Default is true

frameObject<optional>
{}

Display frame configuration for dumping objects

Properties
NameTypeAttributesDefaultDescription
titleAlignmentstring<optional>
'center'

Title alignment for dumping objects. Default is center

paddingnumber<optional>
1

Padding for dumping objects. Default is 1

marginnumber<optional>
1

Margin for dumping objects. Default is 1

borderStylestring<optional>
'round'

Border style for dumping objects. Default is round

langstring<optional>

Default language for internationalization. Default is the system language or en-US if not available

intlObject<optional>
{}

Internationalization configuration

Properties
NameTypeAttributesDefaultDescription
supportedArray.<string><optional>
['en-US', 'id']

Supported languages. Default is en-US and id. Add more if you want it

fallbackstring<optional>
'en-US'

Fallback language if the requested language is not supported. Default is en-US

lookupOrderArray.<string><optional>
[]

Lookup order for languages. Default is empty array

emptyValuestring<optional>
''

Value to use for empty values. Default is empty string

datetimeObject<optional>

Datetime format. See Intl.DateTimeFormat for more information

dateObject<optional>

Date format. See Intl.DateTimeFormat for more information

timeObject<optional>

Time format. See Intl.DateTimeFormat for more information

floatObject<optional>

Float format. See Intl.NumberFormat for more information

doubleObject<optional>

Double format. See Intl.NumberFormat for more information

smallintObject<optional>

Smallint format. See Intl.NumberFormat for more information

integerObject<optional>

Integer format. See Intl.NumberFormat for more information

unitSysObject<optional>
{}

Unit system configuration. Object with keys as language codes and values as unit systems. Supported values are metric, imperial and nautical

Properties
NameTypeAttributesDefaultDescription
en-USstring<optional>
'imperial'

Unit system for en-US. Default is imperial

idstring<optional>
'metric'

Unit system for id. Default is metric

timeZonestring<optional>

Default timezone for internationalization. If not provided, the system timezone will be used

exitHandlerboolean<optional>
true

Whether to attach exit handlers for graceful shutdown. Default is true

cacheObject<optional>
{}

Cache configuration

Properties
NameTypeAttributesDefaultDescription
purgeArray.<string><optional>
[]

List of cache names to purge on startup. Default is empty array

purgeIntvDurstring | number<optional>
'5m'

Interval duration for purging cache. Default is 5m

TDataType

Supported data types.

Type:
  • Object
Properties
NameTypeDescription
0string

string

1string

float

2string

double

3string

integer

4string

smallint

5string

date

6string

time

7string

datetime

8string

array

9string

object

TFormatResult

Object returned by bajo:getUnitFormat.

Type:
  • Object
Properties
NameTypeDescription
unitSysstring

Unit system.

formatObject

Format object.

TFormatter

Type:
  • Object
Properties
NameTypeDescription
metricObject

Metric formatter

Properties
NameTypeDescription
speedFnObject

Function to format speed in metric

speedUnitstring

Speed unit in metric

distanceFnObject

Function to format distance in metric

distanceUnitstring

Distance unit in metric

areaFnObject

Function to format area in metric

areaUnitstring

Area unit in metric

degreeFnObject

Function to format degree in metric

degreeUnitstring

Degree unit in metric

degreeUnitSepstring

Degree unit separator in metric

imperialObject

Imperial formatter

Properties
NameTypeDescription
speedFnObject

Function to format speed in imperial

speedUnitstring

Speed unit in imperial

distanceFnObject

Function to format distance in imperial

distanceUnitstring

Distance unit in imperial

areaFnObject

Function to format area in imperial

areaUnitstring

Area unit in imperial

degreeFnObject

Function to format degree in imperial

degreeUnitstring

Degree unit in imperial

degreeUnitSepstring

Degree unit separator in imperial

nauticalObject

Nautical formatter

Properties
NameTypeDescription
speedFnObject

Function to format speed in nautical

speedUnitstring

Speed unit in nautical

distanceFnObject

Function to format distance in nautical

distanceUnitstring

Distance unit in nautical

areaFnObject

Function to format area in nautical

areaUnitstring

Area unit in nautical

degreeFnObject

Function to format degree in nautical

degreeUnitstring

Degree unit in nautical

degreeUnitSepstring

Degree unit separator in nautical

TFormatterFieldMap

Formatter field mapping.

Type:
  • Object
Properties
NameTypeAttributesDefaultDescription
speedstring<optional>
'speed'
distancestring<optional>
'distance'
areastring<optional>
'area'
degreestring<optional>
'degree'
headingstring<optional>
'degree'
coursestring<optional>
'degree'

TNsPathPairs

Name in {ns}:{path} format.

Type:
  • string

TNsPathResult

Object returned by bajo:breakNsPath().

Type:
  • Object
Properties
NameTypeAttributesDescription
nsstring<optional>

Namespace

subNsstring<optional>

Sub namespace

subSubNsstring<optional>

Sub of sub namespace

fullNsstring<optional>

Full namespace, including sub namespaces

pathstring

Path without query string or hash

fullPathstring<optional>

Full path, including query string and hash

realPathstring<optional>

Path without query string or hash, but with parameters replaced with their values

realFullPathstring<optional>

Full path, including query string and hash, but with parameters replaced with their values

qsObject<optional>

Query string object

paramsObject<optional>

Parameters object