Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lambda-serverless-api

Package Overview
Dependencies
Maintainers
1
Versions
396
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lambda-serverless-api - npm Package Compare versions

Comparing version 8.2.0 to 9.0.0

lib/util/geo-point.js

11

lib/param/geo-point.js

@@ -7,4 +7,10 @@ "use strict";

const Joi = require('joi-strict');
const NumberList = require('./number-list');
const {
genSchema: genSchemaGeoPoint
} = require('../util/geo-point');
class GeoPoint extends NumberList {

@@ -17,2 +23,5 @@ constructor(name, position, opts = {}) {

this.relaxed = get(opts, 'relaxed', false);
this.schema = genSchemaGeoPoint({
maxPrecision: get(opts, 'maxPrecision', 5)
});
}

@@ -28,3 +37,3 @@

if (valid && (valueParsed.length !== 2 || valueParsed[0] < -180 || valueParsed[0] > 180 || valueParsed[1] < -90 || valueParsed[1] > 90)) {
if (valid && !Joi.test(valueParsed, this.schema)) {
valid = false;

@@ -31,0 +40,0 @@ }

5

lib/param/geo-poly-list.js

@@ -5,2 +5,4 @@ "use strict";

const get = require('lodash.get');
const JsonList = require('./json-list');

@@ -23,3 +25,4 @@

maxPointsPerimeter: opts.maxPointsPerimeter,
maxPointsPerHole: opts.maxPointsPerHole
maxPointsPerHole: opts.maxPointsPerHole,
maxPrecision: get(opts, 'maxPrecision', 5)
});

@@ -26,0 +29,0 @@ super(name, position, { ...opts,

@@ -5,2 +5,4 @@ "use strict";

const get = require('lodash.get');
const Json = require('./json');

@@ -23,3 +25,4 @@

maxPointsPerimeter: opts.maxPointsPerimeter,
maxPointsPerHole: opts.maxPointsPerHole
maxPointsPerHole: opts.maxPointsPerHole,
maxPrecision: get(opts, 'maxPrecision', 5)
});

@@ -26,0 +29,0 @@ super(name, position, { ...opts,

@@ -7,4 +7,10 @@ "use strict";

const Joi = require('joi-strict');
const NumberList = require('./number-list');
const {
genSchema: genSchemaGeoPoint
} = require('../util/geo-point');
class GeoRect extends NumberList {

@@ -17,2 +23,5 @@ constructor(name, position, opts = {}) {

this.relaxed = get(opts, 'relaxed', false);
this.schema = genSchemaGeoPoint({
maxPrecision: get(opts, 'maxPrecision', 5)
});
}

@@ -29,3 +38,3 @@

if (valid && (valueParsed.length !== 4 // check bounds
|| valueParsed[0] < -180 || valueParsed[0] > 180 || valueParsed[1] < -90 || valueParsed[1] > 90 || valueParsed[2] < -180 || valueParsed[2] > 180 || valueParsed[3] < -90 || valueParsed[3] > 90 // check latitude (longitude always valid because rect covering anti-meridian valid in es)
|| !Joi.test([valueParsed[0], valueParsed[1]], this.schema) || !Joi.test([valueParsed[2], valueParsed[3]], this.schema) // check latitude (longitude always valid because rect covering anti-meridian valid in es)
|| valueParsed[1] < valueParsed[3])) {

@@ -32,0 +41,0 @@ valid = false;

"use strict";
const get = require('lodash.get');
const JsonList = require('./json-list');

@@ -14,3 +16,4 @@

clockwise: opts.clockwise,
relaxed: opts.relaxed
relaxed: opts.relaxed,
maxPrecision: get(opts, 'maxPrecision', 5)
});

@@ -17,0 +20,0 @@ super(name, position, {

"use strict";
const get = require('lodash.get');
const Json = require('./json');

@@ -14,3 +16,4 @@

clockwise: opts.clockwise,
relaxed: opts.relaxed
relaxed: opts.relaxed,
maxPrecision: get(opts, 'maxPrecision', 5)
});

@@ -17,0 +20,0 @@ super(name, position, { ...opts,

@@ -14,3 +14,4 @@ "use strict";

maxPointsPerimeter,
maxPointsPerHole
maxPointsPerHole,
maxPrecision
}) => {

@@ -20,3 +21,4 @@ const perimeterSchema = genSchemaGeoShape({

clockwise: false,
relaxed
relaxed,
maxPrecision
});

@@ -26,3 +28,4 @@ const holesSchema = genSchemaGeoShape({

clockwise: true,
relaxed
relaxed,
maxPrecision
});

@@ -29,0 +32,0 @@ return Joi.array().ordered(perimeterSchema).items(holesSchema).custom((value, _) => {

@@ -9,9 +9,16 @@ "use strict";

const {
genSchema: genSchemaGeoPoint
} = require('./geo-point');
module.exports.genSchema = ({
maxPoints,
clockwise,
relaxed
relaxed,
maxPrecision
}) => {
assert(relaxed === undefined || typeof relaxed === 'boolean');
const schema = Joi.array().items(Joi.array().ordered(Joi.number().min(-180).max(180), Joi.number().min(-90).max(90))).custom((value, _) => {
const schema = Joi.array().items(genSchemaGeoPoint({
maxPrecision
})).custom((value, _) => {
if (!validateGeoShape({

@@ -18,0 +25,0 @@ geoShape: value,

@@ -42,3 +42,3 @@ {

},
"version": "8.2.0",
"version": "9.0.0",
"scripts": {

@@ -84,3 +84,3 @@ "clean": "rm -rf lib",

"@turf/kinks": "6.3.0",
"aws-sdk-wrap": "9.4.1",
"aws-sdk-wrap": "9.5.0",
"joi-strict": "2.0.0",

@@ -87,0 +87,0 @@ "lambda-async": "2.0.0",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc