Search
Preparing search index...
The search index is not available
squirrelly
Options
All
Public
Public/Protected
All
Inherited
Externals
Only exported
Menu
Globals
"containers"
Module "containers"
Index
Interfaces
Escape
Map
Generic
Data
Helper
Block
Helper
Content
Include
Helper
Content
Type aliases
Filter
Function
Helper
Function
Variables
filters
helpers
native
Helpers
templates
Functions
XMLEscape
async
Arr
Loop
async
Obj
Loop
err
With
Blocks
OrFilters
replace
Char
Object literals
esc
Map
Type aliases
Filter
Function
Filter
Function
:
(
str
:
string
)
=>
any
|
Promise
<
any
>
Type declaration
(
str
:
string
)
:
any
|
Promise
<
any
>
Parameters
str:
string
Returns
any
|
Promise
<
any
>
Helper
Function
Helper
Function
:
(
content
:
HelperContent
, blocks
:
Array
<
HelperBlock
>
, config
:
SqrlConfig
)
=>
string
|
Promise
<
string
>
Type declaration
(
content
:
HelperContent
, blocks
:
Array
<
HelperBlock
>
, config
:
SqrlConfig
)
:
string
|
Promise
<
string
>
Parameters
content:
HelperContent
blocks:
Array
<
HelperBlock
>
config:
SqrlConfig
Returns
string
|
Promise
<
string
>
Variables
filters
filters
:
Cacher
<
(
str
:
string
)
=>
any
|
Promise
<
any
>
>
= new Cacher<FilterFunction>({ e: XMLEscape })
helpers
helpers
:
Cacher
<
(
content
:
HelperContent
, blocks
:
Array
<
HelperBlock
>
, config
:
SqrlConfig
)
=>
string
|
Promise
<
string
>
>
= new Cacher<HelperFunction>({each: function (content: HelperContent, blocks: Array<HelperBlock>) {var res = ''var arr = content.params[0]errWithBlocksOrFilters('each', blocks, false)if (content.async) {return new Promise(function (resolve) {asyncArrLoop(arr, 0, content.exec, res, resolve)})} else {for (var i = 0; i < arr.length; i++) {res += content.exec(arr[i], i)}return res}},foreach: function (content: HelperContent, blocks: Array<HelperBlock>) {var obj = content.params[0]errWithBlocksOrFilters('foreach', blocks, false)if (content.async) {return new Promise(function (resolve) {asyncObjLoop(obj, Object.keys(obj), 0, content.exec, '', resolve)})} else {var res = ''for (var key in obj) {if (!hasOwnProp(obj, key)) continueres += content.exec(key, obj[key]) // todo: check on order}return res}},include: function (content: IncludeHelperContent,blocks: Array<HelperBlock>,config: SqrlConfig): string {errWithBlocksOrFilters('include', blocks, false)var template = config.storage.templates.get(content.params[0])if (!template) {throw SqrlErr('Could not fetch template "' + content.params[0] + '"')}return template(content.params[1], config)} as HelperFunction,extends: function (content: IncludeHelperContent,blocks: Array<HelperBlock>,config: SqrlConfig): string {var data: GenericData = content.params[1] || {}data.content = content.exec()for (var i = 0; i < blocks.length; i++) {var currentBlock = blocks[i]data[currentBlock.name] = currentBlock.exec()}var template = config.storage.templates.get(content.params[0])if (!template) {throw SqrlErr('Could not fetch template "' + content.params[0] + '"')}return template(data, config)} as HelperFunction,useScope: function (content: HelperContent, blocks: Array<HelperBlock>): string {errWithBlocksOrFilters('useScope', blocks, false)return content.exec(content.params[0])} as HelperFunction})
native
Helpers
native
Helpers
:
Cacher
<
Function
>
= new Cacher<Function>({if: function (buffer: ParentTemplateObject, env: SqrlConfig) {errWithBlocksOrFilters('if', false, buffer.f, true)var returnStr = 'if(' + buffer.p + '){' + compileScope(buffer.d, env) + '}'if (buffer.b) {for (var i = 0; i < buffer.b.length; i++) {var currentBlock = buffer.b[i]if (currentBlock.n === 'else') {returnStr += 'else{' + compileScope(currentBlock.d, env) + '}'} else if (currentBlock.n === 'elif') {returnStr += 'else if(' + currentBlock.p + '){' + compileScope(currentBlock.d, env) + '}'}}}return returnStr},try: function (buffer: ParentTemplateObject, env: SqrlConfig) {errWithBlocksOrFilters('try', false, buffer.f, true)if (!buffer.b || buffer.b.length !== 1 || buffer.b[0].n !== 'catch') {throw SqrlErr("native helper 'try' only accepts 1 block, 'catch'")}var returnStr = 'try{' + compileScope(buffer.d, env) + '}'var currentBlock = buffer.b[0]returnStr +='catch' +(currentBlock.res ? '(' + currentBlock.res + ')' : '') +'{' +compileScope(currentBlock.d, env) +'}'return returnStr},block: function (buffer: ParentTemplateObject, env: SqrlConfig) {errWithBlocksOrFilters('block', buffer.b, buffer.f, true)var returnStr ='if(!' +env.varName +'[' +buffer.p +']){tR+=(' +compileScopeIntoFunction(buffer.d, '', env) +')()}else{tR+=' +env.varName +'[' +buffer.p +']}'return returnStr}})
templates
templates
:
Cacher
<
(
data
:
object
, config
:
SqrlConfig
, cb
?:
CallbackFn
)
=>
string
>
= new Cacher<TemplateFunction>({})
Functions
XMLEscape
XMLEscape
(
str
:
unknown
)
:
string
Parameters
str:
unknown
Returns
string
async
Arr
Loop
async
Arr
Loop
(
arr
:
Array
<
any
>
, index
:
number
, fn
:
Function
, res
:
string
, cb
:
Function
)
:
void
Parameters
arr:
Array
<
any
>
index:
number
fn:
Function
res:
string
cb:
Function
Returns
void
async
Obj
Loop
async
Obj
Loop
(
obj
:
{}
, keys
:
Array
<
string
>
, index
:
number
, fn
:
Function
, res
:
string
, cb
:
Function
)
:
void
Parameters
obj:
{}
[
index:
string
]:
any
keys:
Array
<
string
>
index:
number
fn:
Function
res:
string
cb:
Function
Returns
void
err
With
Blocks
OrFilters
err
With
Blocks
OrFilters
(
name
:
string
, blocks
:
Array
<
any
>
|
false
, filters
:
Array
<
any
>
|
false
, native
?:
undefined
|
false
|
true
)
:
void
Parameters
name:
string
blocks:
Array
<
any
>
|
false
filters:
Array
<
any
>
|
false
Optional
native:
undefined
|
false
|
true
Returns
void
replace
Char
replace
Char
(
s
:
string
)
:
string
Parameters
s:
string
Returns
string
Object literals
esc
Map
esc
Map
:
object
"
"
:
"""
= """
&
&
:
"&"
= "&"
'
'
:
"'"
= "'"
<
<
:
"<"
= "<"
>
>
:
">"
= ">"
Globals
"browser"
"compile"
"compile-
string"
"config"
"containers"
"err"
"file-
handlers"
"file-
helpers"
"file-
utils"
"index"
"parse"
"render"
"storage"
"utils"
Escape
Map
Generic
Data
Helper
Block
Helper
Content
Include
Helper
Content
Filter
Function
Helper
Function
filters
helpers
native
Helpers
templates
XMLEscape
async
Arr
Loop
async
Obj
Loop
err
With
Blocks
OrFilters
replace
Char
esc
Map
Generated using
TypeDoc