@chix/flow
Version:
119 lines (118 loc) • 2.75 kB
YAML
type: flow
title: "Array fill, start 3 times with context"
links:
- target:
id: node3
port: in
source:
id: node2
port: out
- target:
id: node1
port: in
source:
id: node3
port: out
nodes:
- id: node1
title: Assert
ns: assert
name: deepEqual
context:
msg: Should persist
- id: node2
title: Str
ns: data
name: string
context:
in: test
- id: node3
title: Arr
ns: array
name: fill
context:
length: 3
nodeDefinitions:
assert:
deepEqual:
async: true
description: 'Tests for deep equality.'
expose:
- assert
fn: "on.input.in = function() {\n assert.deepEqual($.in, $.expect, $.msg);\n output({ out: $.get('in') });\n}\n"
name: deepEqual
ns: assert
phrases:
active: 'Assert Deep Equal'
ports:
input:
in:
title: Actual
async: true
type: any
expect:
title: Expect
type: any
msg:
title: Message
type: string
default: 'Not Deeply Equal'
output:
out:
title: Actual
type: any
dependencies:
npm:
assert: builtin
title: Assert
data:
string:
async: true
description: String
fn: "on.input.in = function() {\n output( { out: typeof $.in === null ? $.write('in', 'null') : $.write('in', $.in.toString()) });\n};\n"
name: string
ns: data
phrases:
active: 'Creating string {{input.string}}'
ports:
input:
in:
title: String
type: any
async: true
required: true
output:
out:
title: out
type: string
title: Str
array:
fill:
async: true
description: 'Fills an array to the length specified and outputs it.'
fn: "on.input.in = function() {\n\n if(!state.arr) state.arr = $.array || [];\n\n state.arr.push($.in);\n\n if(state.arr.length === $.length) {\n output({ out: $.write('array', state.arr) });\n state.arr = $.array || [];\n }\n\n};\n"
name: fill
ns: array
phrases:
active: 'Filling array'
ports:
input:
in:
title: Value
type: any
async: true
length:
title: Length
type: number
array:
title: Array
type: array
default: null
output:
out:
title: Array
type: array
length:
title: 'New Length'
type: number
title: Arr