Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
README.md
apptools.js
apptools.min.js
drawtools.js
helpers.js
helpers.php
maths.js
query.js
swipeslider.js

README.md

Helpers Documentation


templater

Usage

string templater( function TemplateFunction [, string InitialString ] )( string OutputSelector )( array ObjectArray )

Stamp data onto a template

Parameters

TemplateFunction
A callback *function* which represents a backtick template string.
InitialString
An optional *string* which would initialize the output string.
OutputSelector
An optional selector *string* of an element to place the output.
ObjectArray
An *array* of objects, or an *object*, to be iterated over.

Return

There are three return values, one from each step.

  1. A function which has a stored template function
  2. A function which has a stored output selector
  3. A string representing a converted output

Examples

let makeName = templater(o=>`<div>${o.name}</div>`)();
makeName({name:"George"});
makeName({name:"Fred"});

output: "<div>George</div><div>Fred</div>"
templater(o=>`<div>${o.name}</div>`)(".output")(
	[{name:"George"},{name:"Fred"}]
);

.output: "<div>George</div><div>Fred</div>"


... This document might need an update soon.

You can’t perform that action at this time.