
Product
Rust Support Now in Beta
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
double-double-wrapper
Advanced tools
A wrapper for in-n-out to add resharing and caching of geofences without intermixing with usage logic
A wrapper for in-n-out to add resharing and caching of geofences without intermixing with usage logic
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');
});
npm install double-double-wrapper
npm test
FAQs
A wrapper for in-n-out to add resharing and caching of geofences without intermixing with usage logic
The npm package double-double-wrapper receives a total of 0 weekly downloads. As such, double-double-wrapper popularity was classified as not popular.
We found that double-double-wrapper demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.