This package has been deprecated

Author message:

Package no longer maintained.

double-double-wrapper

1.1.1 • Public • Published

stable NPM version Build Status Coverage Status Dependency Status

double-double-wrapper

A wrapper for in-n-out to add resharing and caching of geofences without intermixing with usage logic

Example

var DoubleDoubleWrapper = require("double-double-wrapper");
 
var doubleDouble = new DoubleDoubleWrapper({
    cache: undefined // set this to an ES6 map-like object (async instead of sync, though)
});                  // if you want a different caching store
 
doubleDouble.getGeofence('geofenceName', verticesArrayofArrays, granularityInteger, function(err, geofence) {
    geofence.inside([0, 0]); // Boolean true/false indicating whether or not that point is in the polygon
});
 
doubleDouble.getGeofence('geofenceName', function(err, geofence) {
    console.log('after being defined, only need to reference by id');
});
 
doubleDouble.geoGeofence('geofence2', verticesArrayofArrays, function(err, geofence) {
    console.log('the granularity is not needed, but is useful for tuning the fast lookup table');
});
 
doubleDouble.getGeofenceGroup('groupOfGeofences', {
    regionA: {
        whiteoutGfs: [{
            vertices: regionToInclude,
            granularity: granularity1
        }, {
            vertices: anotherRegionToInclude
        }],
        blackoutGfs: [{
            vertices: regionToExclude
        }]
    },
    regionB: {
        whiteoutGfs: [{
            vertices: thirdRegionToInclude
        }]
    }
}, function(err, geofenceGroup) {
    geofenceGroup.isValidKey([0, 0], 'regionA'); // Determines if the point is in any of the whiteout
                                                 // geofences and not in any of the blackout geofences
                                                 // for the the regionA definition
    geofenceGroup.isValidKey([0, 0], 'regionB'); // Ditto for the second region
    geofenceGroup.getValidKeys([0, 0]); // Returns an array of regions the point is in
});
 
doubleDouble.getGeofenceGroup('groupOfGeofences', function(err, geofenceGroup) {
    console.log('similarly get just by the id if already defined');
    console.log('if the data is provided again, it WILL NOT rebuild all of those geofences');
    console.log('it will use the already-built version, instead, to avoid excessive CPU burn');
});

Installation

npm install double-double-wrapper

Tests

npm test

Contributors

  • David Ellis

Readme

Keywords

none

Package Sidebar

Install

npm i double-double-wrapper

Weekly Downloads

4

Version

1.1.1

License

none

Last publish

Collaborators

  • dfellis
  • jcorbin