API Docs for: 0.1.1
Show:

flatworld.MapDataManipulator Class

Class to get a consistent standard for the engine to be able to filter objects, when etrieving or sorting them. This is used when some method uses filters.

You must provide an object that defines how the given objects should be filtered, when constructing. The module will filter with every rule and object given and everything that doesn't pass one of the given filters, will be dropped out.

Given filters look something like this: { type: 'filter', object: 'layer', property: 'selectable', // THIS can also be an array, like: ['data', 'a'] => data.a value: true, } For more information, please check the mapDataManipulatorSpec.js (test) for now.

Constructor

flatworld.MapDataManipulator

(
  • rules
)

Parameters:

  • rules Array | Object

    REQUIRED. The rules that apply for this instance. Multiple rules in Array or one as Object.

Item Index

Methods

_getObject

() type private

This is the actual method that runs through the rules and arranges the data

Returns:

type:

[description]

_runRule

(
  • [varname] [description]
)
private

This is the actual method that runs through the rules and arranges the data

Parameters:

  • [varname] [description] Array optional

addRule

(
  • rules
)

adds a filter rule

Parameters:

filter

(
  • objects
)
Array

This has exceptional query, since it actually queries it's parent. Subcontainers have really no useful values and they are dumb containers of objects, every data is on their parent container

Parameters:

  • objects Array | Object

    The objects that are being filtered

Returns:

Array:

The found objects in an Array