main.js
function _InternalSerializeCurrentContext () {
  let profile = { default: {} }

  // Separate this function into another utils library.
  let serializeEntity = function (ent) {
    if (ent.constructor.name === 'Array') {
      serializeArray()
    } else {
      profile.default[ent.constructor.name] = ent
    }
  }

  let serializeArray = function (ent) {
    let entityName
    for (let ei in ent) {
      // First, it creates as many entries of the same object as existing and initializes as empty arrays
      if (ent[ei].constructor.name !== entityName) {
        entityName = ent[ei].constructor.name
        profile.default[entityName] = []
      }
    }
    for (let ei in ent) {
      // Then it reiterates again, this time pushing the contents to the correct array record
      profile.default[ent[ei].constructor.name].push(ent[ei])
    }
  }

  serializeEntity(GetEnvironment())
  serializeArray(GetMotionDetectors())
  serializeArray(GetNotifiers())
  serializeArray(GetFilters())

  return utils.JSON.stringify(profile)
}
function _InternalSerializeCurrentContext () {
  let profile = { default: {} }

  // Separate this function into another utils library.
  let serializeEntity = function (ent) {
    if (ent.constructor.name === 'Array') {
      serializeArray()
    } else {
      profile.default[ent.constructor.name] = ent
    }
  }

  let serializeArray = function (ent) {
    let entityName
    for (let ei in ent) {
      // First, it creates as many entries of the same object as existing and initializes as empty arrays
      if (ent[ei].constructor.name !== entityName) {
        entityName = ent[ei].constructor.name
        profile.default[entityName] = []
      }
    }
    for (let ei in ent) {
      // Then it reiterates again, this time pushing the contents to the correct array record
      profile.default[ent[ei].constructor.name].push(ent[ei])
    }
  }

  serializeEntity(GetEnvironment())
  serializeArray(GetMotionDetectors())
  serializeArray(GetNotifiers())
  serializeArray(GetFilters())

  return utils.JSON.stringify(profile)
}
function _InternalSerializeCurrentContext ( ) { let profile = { default : { } } // Separate this function into another utils library. let serializeEntity = function ( ent ) { if ( ent . constructor . name === 'Array' ) { serializeArray ( ) } else { profile . default [ ent . constructor . name ] = ent } } let serializeArray = function ( ent ) { let entityName for ( let ei in ent ) { // First, it creates as many entries of the same object as existing and initializes as empty arrays if ( ent [ ei ] . constructor . name !== entityName ) { entityName = ent [ ei ] . constructor . name profile . default [ entityName ] = [ ] } } for ( let ei in ent ) { // Then it reiterates again, this time pushing the contents to the correct array record profile . default [ ent [ ei ] . constructor . name ] . push ( ent [ ei ] ) } } serializeEntity ( GetEnvironment ( ) ) serializeArray ( GetMotionDetectors ( ) ) serializeArray ( GetNotifiers ( ) ) serializeArray ( GetFilters ( ) ) return utils . JSON . stringify ( profile ) }
Internal function which serializes the current Context into the format matching the "profile" object
of the config file.
@returns {object} Returns a "profile" object in JSON.stringify format
@internal
Internal function which serializes the current Context into the format matching the profile object of the config file .