Home Reference Source Repository

Function

Static Public Summary
public

defaults(options: Object, _defaults: Object): Object

Set default options where some option was not specified.

public

each(arr: Array<*>, fn: Function, target: Object)

Loop over each item in an array-like value.

public

eachKey(obj: Object, fn: Function, target: Object)

Loop over each key/value pair in a hash.

public

existy(thing: *): boolean

Determine if the thing is not undefined and not null.

public

Is this a function?

public

Test if token is a script tag.

public

Test if token is a style tag.

public

isTag(tok: Object, tag: String): boolean

Test if token is a script tag.

public

last(array: Array<*>): *

Get the last item in an array

public

postscribe(el: *, html: *, options: *): *

public

toArray(obj: *): Array<*>

Convert value (e.g., a NodeList) to an array.

Static Public

public defaults(options: Object, _defaults: Object): Object source

import {defaults} from 'postscribe/src/utils.js'

Set default options where some option was not specified.

Params:

NameTypeAttributeDescription
options Object

The destination

_defaults Object

The defaults

Return:

Object

public each(arr: Array<*>, fn: Function, target: Object) source

import {each} from 'postscribe/src/utils.js'

Loop over each item in an array-like value.

Params:

NameTypeAttributeDescription
arr Array<*>

The array to loop over

fn Function

The function to call

target Object
  • nullable: true

The object to bind to the function

public eachKey(obj: Object, fn: Function, target: Object) source

import {eachKey} from 'postscribe/src/utils.js'

Loop over each key/value pair in a hash.

Params:

NameTypeAttributeDescription
obj Object

The object

fn Function

The function to call

target Object
  • nullable: true

The object to bind to the function

public existy(thing: *): boolean source

import {existy} from 'postscribe/src/utils.js'

Determine if the thing is not undefined and not null.

Params:

NameTypeAttributeDescription
thing *

The thing to test

Return:

boolean

True if the thing is not undefined and not null.

public isFunction(x: *): boolean source

import {isFunction} from 'postscribe/src/utils.js'

Is this a function?

Params:

NameTypeAttributeDescription
x *

The variable to test

Return:

boolean

True if the variable is a function

public isScript(tok: Object): boolean source

import {isScript} from 'postscribe/src/utils.js'

Test if token is a script tag.

Params:

NameTypeAttributeDescription
tok Object

The token

Return:

boolean

True if the token is a script tag

public isStyle(tok: Object): boolean source

import {isStyle} from 'postscribe/src/utils.js'

Test if token is a style tag.

Params:

NameTypeAttributeDescription
tok Object

The token

Return:

boolean

True if the token is a style tag

public isTag(tok: Object, tag: String): boolean source

import {isTag} from 'postscribe/src/utils.js'

Test if token is a script tag.

Params:

NameTypeAttributeDescription
tok Object

The token

tag String

The tag name

Return:

boolean

True if the token is a script tag

public last(array: Array<*>): * source

import {last} from 'postscribe/src/utils.js'

Get the last item in an array

Params:

NameTypeAttributeDescription
array Array<*>

The array

Return:

*

The last item in the array

public postscribe(el: *, html: *, options: *): * source

import postscribe from 'postscribe/src/postscribe.js'

Params:

NameTypeAttributeDescription
el *
html *
options *

Return:

*

public toArray(obj: *): Array<*> source

import {toArray} from 'postscribe/src/utils.js'

Convert value (e.g., a NodeList) to an array.

Params:

NameTypeAttributeDescription
obj *

The object

Return:

Array<*>