// source initialize a transporter Node as a source and adds it to the builder's node map.
// Source(..) takes one argument, a javascript hash which generally contains at
// least a name and a namespace property
//   {name: .., namespace: ..}
source initialize a transporter Node as a source and adds it to the builder's node map.
Source(..) takes one argument, a javascript hash which generally contains at
least a name and a namespace property
{name: .., namespace: ..}
// source initialize a transporter Node as a source and adds it to the builder ' s node map . // Source ( .. ) takes one argument a javascript hash which generally contains at // least a name and a namespace property // { name : .. namespace : .. }
func (js *JavascriptBuilder) source(call otto.FunctionCall) otto.Value {
	if len(call.ArgumentList) != 1 {
		js.err = fmt.Errorf("source must be called with 1 arg. (%d given)", len(call.ArgumentList))
		return otto.NullValue()
	}
	node, err := js.findNode("source", call.Argument(0))
	if err != nil {
		js.err = fmt.Errorf("source error, %s", err.Error())
		return otto.NullValue()
	}
	js.nodes[node.UUID] = node 
	nodeObject, err := node.Object()
	if err != nil {
		js.err = err
		return otto.NullValue()
	}
	js.setFunc(nodeObject, "transform", js.transform)
	js.setFunc(nodeObject, "save", js.save)
	return nodeObject.Value()
}
func ( js * JavascriptBuilder ) source ( call otto . FunctionCall ) otto . Value { if len ( call . ArgumentList ) != 1 { js . err = fmt . Errorf ( " " , len ( call . ArgumentList ) ) return otto . NullValue ( ) } node , err := js . findNode ( " " , call . Argument ( 0 ) ) if err != nil { js . err = fmt . Errorf ( " " , err . Error ( ) ) return otto . NullValue ( ) } js . nodes [ node . UUID ] = node nodeObject , err := node . Object ( ) if err != nil { js . err = err return otto . NullValue ( ) } js . setFunc ( nodeObject , " " , js . transform ) js . setFunc ( nodeObject , " " , js . save ) return nodeObject . Value ( ) }
source initialize a transporter Node as a source and adds it to the builder's node map.
source initialize a transporter Node as a source and adds it to the builder ' s node map .
// persist this