API Documentation

On GitHub

IP API

NoFlo - Flow-Based Programming for JavaScript
(c) 2016 TheGrid (Rituwall Inc.)
NoFlo may be freely distributed under the MIT license
module.exports = class IP

Valid IP types

  @types: [
    'data'
    'openBracket'
    'closeBracket'
  ]

Detects if an arbitrary value is an IP

  @isIP: (obj) ->
    obj and typeof obj is 'object' and
    obj.type and @types.indexOf(obj.type) > -1

Creates as new IP object Valid types: 'data', 'openBracket', 'closeBracket'

  constructor: (@type = 'data', @data = null, options = {}) ->
    @groups = [] # sync groups
    @scope = null # sync scope id
    @owner = null # packet owner process
    @clonable = false # cloning safety flag
    @index = null # addressable port index
    for key, val of options
      this[key] = val

Creates a new IP copying its contents by value not reference

  clone: ->
    ip = new IP @type
    for key, val of @
      continue if ['owner'].indexOf(key) isnt -1
      continue if val is null
      if typeof(val) is 'object'
        ip[key] = JSON.parse JSON.stringify val
      else
        ip[key] = val
    ip

Moves an IP to a different owner

  move: (@owner) ->

no-op

Frees IP contents

  drop: ->
    delete this[key] for key, val of @

This page contains documentation generated automatically on 2017-01-03 from NoFlo's IP.coffee file.