Package fcf-framework-core
A package of basic functions and classes required for the framework to work. This package provides functions for modular loading of JS files, basic processing of strings and data, a class for working with asynchronous operations, a logging mechanism, state and context saving methods, etc.
fcf.NUMBER = 4 - Specifies the number data type (not including the NaN value). Used in functions fcf.isNature and others.
fcf.OBJECT = 7 - Indicates the data type is object (excluding null and Date ). Used in functions fcf.isNature , etc.
fcf.ITERABLE = 9 - Points to an iterable object (the string type is not included in this category). Used in functions fcf.isNature , etc.
fcf.NUMBERED = 10 - Points to an numerable object (the string type is not included in this category). Used in functions fcf.isNature , etc.
fcf.log - Global logger
fcf.Actions fcf.actions ()
mixed fcf.append (object |array |Map |Set a_dest, object |array |Map |Set a_source1, ..., object |array |Map |Set a_sourceN)
mixed fcf.append (boolean a_copyMode, object |array |Map |Set a_dest, object |array |Map |Set a_source1, ..., object |array |Map |Set a_sourceN)
fcf.appendTranslate (object |string |[object |string ]|undefined a_dataOrFileName, boolean a_reload = false)
string fcf.buildUrl (string |fcf.RouteInfo a_url, object a_args = undefined, string a_anchor = undefined)
fcf.Configuration fcf.getConfiguration ()
fcf.Context fcf.getContext ()
fcf.EventChannel fcf.getEventChannel ()
object fcf.getState ()
boolean fcf.isNature (mixed a_value, string | fcf.UNDEFINED ..fcf.NUMBERED | [string |fcf.UNDEFINED ..fcf.NUMBERED ] a_nature, boolean a_softMode = false)
boolean fcf.isServer ()
string fcf.pad (string a_str, number a_len, string a_fill = " ", "l"|"left"|"r"|"right"|"c"|"center" a_align = "left")
Date fcf.parseDate (string a_string, string a_format = "Y*m*d*H*i*s*v", boolean a_strict = false, Date a_default = new Date (1970, 0, 1, 0, 0, 0, 0), integer a_timezoneOffset = 0)
mixed fcf.pattern (strign |object a_code, object a_environment = {}, object a_options = {quiet : false, result : "string"})
fcf.saveContext (ExpressResponse a_request)
fcf.setContext (fcf.Context a_context)
fcf.setState (object a_state)
string fcf.stackToString ()
string fcf.t (string a_str, string a_lang = fcf.getContext ().language || fcf.getConfiguration ().defaultLanguage)
mixed fcf.tokenize (strign |object a_code, object a_environment = {}, object a_options = {quiet : false, result : "string"})
string |object fcf.translate (string |object a_str, string a_lang = fcf.getContext ().language || fcf.getConfiguration ().defaultLanguage)
string fcf.uuid ()
Pages
- Install - Description of connecting a package to an executable script
- Configuration - Configuration object and main framework core settings
- Paths to resources - The structure of the formation of paths to files and resources
- Modules - Description of JavaScript modules in the framework
- Context - Describe how to use an execution context
- Translations - Description of static string translations
- Tokenization - Description of the string tokenization mechanism
Configuration parameters
warnEmptyContext - If set to true , then on the server side, when using an empty context, a warning message is displayed in the log.
defaultLanguage - Default language
aliases - An object that stores path aliases
translations - An array with information about translations. Can be specified either as an object containing translations, or as a string containing the path to the translation file.
tokenize - An object describing the list of available objects and functions in the server-side tokenizer used in the fcf.tokenize , fcf.pattern and fcf.inlineExecution functions.
moduleDirectories - Directories where NODEJS packages are searched
webModuleDirectory - URL prefix for packages that do not have an explicit package download URL in the sources configuration parameter (Browser side).
sources - An object that describes source files for loading JS modules on the client and server side
merge - An object that describes the rules for merging configuration properties from different configuration sources.
Constants
Variables
Events
[BROWSER ONLY]
page_ready
- The event is called when the page is completely loaded.
Classes
- Error class. Stores a string alias for the error, a tokenized string to be translated, and may also contain a pointer to the underlying error that caused the current error to be generated.
- An execution context object that contains information about the enforcement proceedings in the case of the meeting. For more progress information, see Context.
- The class of asynchronous operations is similar to Promise and can be used with the await operator, but has slightly different functionality.
- Abstract class for completing the asynchronous operation. Copies of this class are transmitted to the functions of the fcf.Actions
- The class that describes information about a URL's route
- The event channel class that implements the communication of different program blocks of the framework. The framework can use multiple event channels, but by default it always uses the main event channel, which is available via the fcf.getEventChannel () function
- Base class that adds functionality for handling internal events of an object
- A class that provides functionality for storing and expanding configuration parameters.
- Logger class with file recording
Functions
- Creates an fcf.Actions object
- Registers an exception name for fcf.Exception objects.
- Copies data from sources a_source1 ... a_sourceN to destination a_dest . If the argument a_copyMode is equal to true , a full (recursion) copy of the data is performed with the re-creation of objects
- Adds translations. If necessary, it can cause a complete reloading of all translation files.
- Gathers a new URL from the original one by adding arguments and an anchor
- Creates a copy of an object with recursive copying of fields
- Compares two values.
- Decodes a string from base64 format
- Performs decoding of descriptions of special characters in an HTML string
- Iterates over the elements in the a_object argument. Iteration ends if the callback function returns a value other than undefined .
- Checks if the object is empty. The following are considered empty: all empty iterables, fieldless objects (except Error and Date ), empty strings, and the following values: new Date (NaN ), NaN , null , undefined .
- Encodes a string in base64 format
- Encodes only structural special characters ( " ' > < &) in an HTML code construct
- Compares two values for equality.
- Converts the error object to a string representation
- Escapes single and double quotes with \
- Converts a Date object to a string representation
- Get an element stored in an object by key. Also performed for Map and Set objects
- Returns the default configuration object. You can read more about the configuration object on the configuration description page: Configuration
- Returns the current execution context. More information about execution context can be found at Context
- Returns the path of a directory
- Returns the message channel used by the default framework.
- Returns an extension for a file path
- Returns a filename
- Translates a relative URI in FCF notation into a real resource path
{module , subpath } fcf.getPathInfo (string a_path, a_isServerPath = fcf.isServer (), boolean a_quiet = false)
- Returns the module and the subpath by the path
- Returns a filename without a path extension
- Gets the current state object. More information about execution context and status can be found at Context
- Checks if an object contains an element with a given key. Also performed for Map and Set objects
- Creates a string from random characters in hex format
- Evaluates a single line Javascript expression
- Checks if an argument is iterable, but is not a string.
- Checks if an argument matches the given data classification
- Checks if the passed argument is an enumerable object. But string data is not treated as enumerated objects.
- Checks if the argument is an object and not null
- Determines where code is executed on the server or on the client
- Removes the given characters from the beginning of a string
- Declares an FCF module.
- Normalizes the path address to a subfield of an object
- Normalizes the resource path (File path/HTTP/HTTPS).
- Normalizes the relative subpath. Removes paths ./ and performs an offset ../ inside the relative path. Changes the multiple use of the character / (/////) to the single use (/).
- Pads a string to a given length
- Converts the string representation of a date and time to a Date
- Parses error information from the Error object.
- Converts a string with the path to the object into an array with information about the elements
- Parses a string containing information about the stack obtained from Error.stack
- Performs tokenization of the given string. The control constructs of the tokenizer are @{...}@ and !{...}!.
- Creates an object or an array at the path specified in the argument if the object does not exist. And returns the specified object.
- Performs replacement of all searched substrings in a string
- Performs module loading
- Returns a subfield of the object at the specified path
{object , key } fcf.resolveEx (object a_obj, string |[string |object ] a_path, boolean a_createObj = false)
- Returns information about the subobject at the given path, and optionally creates subobjects at the specified path if it is not present in the source object.
- Converts a string containing an alias to a real path in FCF notation.
- Removes the specified characters from the end of a string
- Stores the current context in Cookies. The context is stored in base64 encoded JSON format in the cookies parameter "fcf-context"
If the code is executed on the browser side, then the function must be called without arguments.
If the code is executed on the server side, then the function takes as an argument an Express server response object.
More information about execution context can be found at Context
- Sets the execution context. More information about execution context can be found at Context
- Sets the state object as current. More information about execution context and status can be found at Context
- Converts stack information to string representation
- Converts data to a string.
- Removes HTML tags from a source string
- Converts the a_name and a_value parameters to a string of the format `a_name : a_value`. For dimension values, automatically adds the ending "px";
- Performs a line feed. If no translation is found, the original string is returned.
- Performs tokenization of the given string. The control constructs of the tokenizer are @{{...}}@ and !{{...}}!.
- Performs tokenization only for translation constructs !{{...}}! and !{...}!.
- Removes the specified characters from the beginning and end of a string
- Performs unescaping of a string or strings in the passed object
- Creates a UUID string (v4)