forEach
forEach<
S,B>(source,binding,body):ForEachSpec<SextendsFluentSpec<X> ?X:S&Spec,BextendsFluentSpec<Y> ?Y:B&Spec>
Defined in: extract/spec.ts:1076
Iterate over values from source spec and execute body for each, binding each value to the given variable name.
Type Parameters
Section titled “Type Parameters”S extends SpecLike
B extends SpecLike
Parameters
Section titled “Parameters”source
Section titled “source”S
Spec that produces an array of values to iterate over
binding
Section titled “binding”string
Variable name to bind each value to
B
Spec to execute for each bound value
Returns
Section titled “Returns”ForEachSpec<S extends FluentSpec<X> ? X : S & Spec, B extends FluentSpec<Y> ? Y : B & Spec>
Example
Section titled “Example”forEach( $.get('companies').strings(), 'company', extract($ => ({ name: variableRef('company'), revenue: $.get('data').get(variableRef('company')).number(), })))