DOCUMENTATION

Quick-React Library Classes

QuickReactElement

Quick-React elements are an object type where each element has an assigned type, name, and a set of unique key/value attributes stored as a JavaScript Map data structure.

QuickReact

The QuickReact class methods perform all the processing of parsing Quick-React markup into an n-ary tree, which can then be output as React folder and file components for quick React project setup

Functions

output_index(useBootstrap, quickReact, NaryTree, QuickReactElement, NaryNode)string

Output the index.js file as index_qr.js for this React project

output_app(useBootstrap, quickReact, NaryTree, QuickReactElement, NaryNode)string

Output the App.js file as App_qr.js for this React project

output_component(useBootstrap, quickReact, NaryTree, QuickReactElement, NaryNode)string

Output individual component files for the React project

QuickReactElement

Quick-React elements are an object type where each element has an assigned type, name, and a
set of unique key/value attributes stored as a JavaScript Map data structure.

Kind: global class

new QuickReactElement(name, type, attributes)

The QuickReactElement class object constructor method

ParamTypeDescription
namestringa name for this element
typestringa type to categorize this element
attributesObjectobject - a shallow object containing [key, value] pairs

quickReactElement.type() ⇒ string

Get this element's designated type.

Kind: instance method of QuickReactElement
Returns: - this element's designated type

quickReactElement.type(typeValue)

Set this element's type value

Kind: instance method of QuickReactElement

ParamTypeDescription
typeValuestringstring - the element's type value

quickReactElement.subtype() ⇒ string

Get this element's subtype value

Kind: instance method of QuickReactElement
Returns: string - this element's designated subtype

quickReactElement.subtype(subtypeValue)

Set this element's subtype value

Kind: instance method of QuickReactElement

ParamTypeDescription
subtypeValuestringstring - the element's subtype value

quickReactElement.name() ⇒ string

Get the element's name.

Kind: instance method of QuickReactElement
Returns: string - this element's name

quickReactElement.name(nameValue)

Set this element's name.

Kind: instance method of QuickReactElement

ParamTypeDescription
nameValuestringstring - the element's name

quickReactElement.hasAttribute(key) ⇒ boolean

Check to see if the Quick-React element has a specific attribute set

Kind: instance method of QuickReactElement
Returns: boolean - does this Quick-React element have this attribute?

ParamTypeDescription
keystringstring - check to see whether this element has an attribute with the specified property key

quickReactElement.safeHasAttribute(obj) ⇒ boolean

Safely Check to see if the Quick-React element has a specific attribute key set to a specific value
This method does not return undefined for undefined properties, it always returns a boolean true or false value

Kind: instance method of QuickReactElement
Returns: boolean - does this Quick-React element have this attribute key and value?

ParamTypeDescription
objobjobject - check to see whether this element has an attribute with the specified property key and value, submitted as a shallow object

quickReactElement.getAttributeSize() ⇒ number

Returns the number of attributes this element has

Kind: instance method of QuickReactElement
Returns: number - the number of attributes this element has

quickReactElement.getAttribute(key) ⇒ string

Get an attribute's value specified by the key parameter

Kind: instance method of QuickReactElement
Returns: string - value string - the value associated with the specified key

ParamTypeDescription
keystringstring - the string representing the attribute property to search for

quickReactElement.deleteAttribute(key) ⇒ boolean

Delete an attribute specified by the key parameter

Kind: instance method of QuickReactElement
Returns: boolean - true or false return value depending on whether the delete request was successfully processed

ParamTypeDescription
keystringstring - the string representing the attribute property to delete

quickReactElement.setAttribute({key:value}) ⇒ Object

Set a key value pair as an attribute of this element

Kind: instance method of QuickReactElement
Returns: Object - map object - attribute map object is returned

ParamTypeDescription
{key:value}Objectobject to be set as a new attribute of this element or to replace an existing attribute with the same key

quickReactElement.getAllAttributes() ⇒ Array.<array>

Returns all key/value pairs as an array using the spread operator

Kind: instance method of QuickReactElement
Returns: Array.<array> - returns all key/value pairs as an array using the spread operator

quickReactElement.toString() ⇒ string

Returns the name of this element

Kind: instance method of QuickReactElement
Returns: string - returns the name of this element

QuickReact

The QuickReact class methods perform all the processing of parsing Quick-React markup into an
n-ary tree, which can then be output as React folder and file components for quick React project setup

Kind: global class

new QuickReact()

Instantiates a QuickReact object and an empty n-ary tree as a JavaScript object

quickReact.tree ⇒ Object

Retrieve a reference to this NaryTree

Kind: instance property of QuickReact
Returns: Object - NaryTree object associated with this QuickReact object

quickReact.parseMarkup(code) ⇒ Object

The parseMarkup method takes submitted Quick-React JSX markup code and produces an n-Ary tree structure representing the components, their nested
structure, and each element's attributes.

Kind: instance method of QuickReact
Returns: Object - returns a populated NaryTree object representing the lexed and parsed output of the supplied Quick-React markup code

ParamTypeDescription
codestringstring - Quick-Start markup code in text JSX format

quickReact._printRef(code, index, length) ⇒ string

This function prints a strings from the current code index to a specified length to provide the developer/user
with a reference as to where their code may have a syntax error.

Kind: instance method of QuickReact
Returns: string - message - a message regarding the error or problem found in the supplied code

ParamTypeDescription
codestringthe Quick-React markup code
indexnumberthe character position in the code where an error was found
lengthnumberthe length is characters of surrounding context text to display in the response message

quickReact._multiplier(attribute) ⇒ number

The _multiplier function checks the passed attribute and determines whether a multiplier
expression is used in the attribute, denoted by an '*', to request a repeat of the item a specified number of times.
Multiplier values can be a single integer digit or two integer digits long.

Kind: instance method of QuickReact
Returns: number - returns the multiplier value found in the attribute or 1 as a default

ParamTypeDescription
attributestringstring - the attribute key to search for

quickReact._findMultiplier(quickReactElement, searchAttribute, specifiedNameArray, defaultName, matchIndex) ⇒ number

This is the same as the _multiplier function except that it looks through all of the component's attributes for
the first matching attribute, compared via key name, and then checks to see if a multiplier expression is used.

Kind: instance method of QuickReact
Returns: number - returns the multiplier value found or zero if the attribute wasn't found, or one if the attribute was found but no multiplier was specified

ParamTypeDescription
quickReactElementObjectcomponent - a Quick-React object element to search
searchAttributestringthe attribute to search for in the element
specifiedNameArrayArray.<array>an array used to hold values of requested field/variable names in the markup
defaultNamestringa default name to use for a field/variable if specified names are used in the markup
matchIndexnumberadd support for use of an attribute more than one time in a single component

quickReact.generateProjectFiles(userID, projectID, NaryTree) ⇒ undefined

A function to generate React directories and files based on the n-Ary tree representation of the Quick-React markup

Kind: instance method of QuickReact
Returns: undefined - Stores the directories and files for the project and generates a zip file with all of the content archived into a single downloadable document.

ParamTypeDescription
userIDstringThe registered Quick-React user's unique id, as assigned by MongoDB.
projectIDstringThe registered Quick-React user's unique project ID, as assigned by MongoDB
NaryTreeObjecttree - The tree of parsed values representing the structure of this Quick-React project

output_index(useBootstrap, quickReact, NaryTree, QuickReactElement, NaryNode) ⇒ string

Output the index.js file as index_qr.js for this React project

Kind: global function
Returns: string - Outputs the code for the content of the index.js file as index_qr.js for this React project

ParamTypeDescription
useBootstrapbooleanboolean - boolean flag indicating whether react-bootstrap should be used
quickReactObjectobject - the instance of the Quick-React project object
NaryTreeObjecttree object - the parse tree of object and values for this project
QuickReactElementObjectobject - a specific quickReactElement
NaryNodeObjectnode object - a specific node in the project tree

output_app(useBootstrap, quickReact, NaryTree, QuickReactElement, NaryNode) ⇒ string

Output the App.js file as App_qr.js for this React project

Kind: global function
Returns: string - - Outputs the contents of the App.js file as App_qr.js for this React project

ParamTypeDescription
useBootstrapbooleanboolean - boolean flag indicating whether react-bootstrap should be used
quickReactObjectobject - the instance of the Quick-React project object
NaryTreeObjecttree object - the parse tree of object and values for this project
QuickReactElementObjectobject - a specific quickReactElement
NaryNodeObjectnode object - a specific node in the project tree

output_component(useBootstrap, quickReact, NaryTree, QuickReactElement, NaryNode) ⇒ string

Output individual component files for the React project

Kind: global function
Returns: strings - Outputs the content of a specific component file for this React project

ParamTypeDescription
useBootstrapbooleanboolean - boolean flag indicating whether react-bootstrap should be used
quickReactObjectobject - the instance of the Quick-React project object
NaryTreeObjecttree object - the parse tree of object and values for this project
QuickReactElementObjectobject - a specific quickReactElement
NaryNodeObjectnode object - a specific node in the project tree