@bitovi/objection-querystring-parser
Advanced tools
Comparing version 0.2.8 to 0.3.0
@@ -5,8 +5,4 @@ function isNotValidInteger(number) { | ||
function isAnArray(item) { | ||
return Array.isArray(item); | ||
} | ||
function isObject(val) { | ||
if (val === null || isAnArray(val)) { | ||
if (val === null || Array.isArray(val)) { | ||
return false; | ||
@@ -17,11 +13,5 @@ } | ||
function containsNoErrorFromParser(error) { | ||
return error.length === 0; | ||
} | ||
module.exports = { | ||
isAnArray, | ||
containsNoErrorFromParser, | ||
isNotValidInteger, | ||
isObject, | ||
}; |
@@ -1,5 +0,2 @@ | ||
const { | ||
containsNoErrorFromParser, | ||
isObject, | ||
} = require("../helpers/validation"); | ||
const { isObject } = require("../helpers/validation"); | ||
@@ -9,3 +6,3 @@ function parseField(field, fieldErrors) { | ||
let errors = []; | ||
if (!containsNoErrorFromParser(fieldErrors)) { | ||
if (fieldErrors.length) { | ||
errors = fieldErrors; | ||
@@ -12,0 +9,0 @@ } else if (!isObject(field)) { |
@@ -5,7 +5,3 @@ const { | ||
} = require("../helpers/helperfunctions"); | ||
const { | ||
isAnArray, | ||
containsNoErrorFromParser, | ||
isObject, | ||
} = require("../helpers/validation"); | ||
const { isObject } = require("../helpers/validation"); | ||
@@ -83,3 +79,3 @@ const Operator = Object.freeze({ | ||
let errors = []; | ||
filters = isAnArray(filters) ? filters : [filters]; | ||
filters = Array.isArray(filters) ? filters : [filters]; | ||
for (let filter of filters) { | ||
@@ -100,3 +96,3 @@ //use the orWhere only from the second iteration. | ||
if (filters) { | ||
if (!containsNoErrorFromParser(filterErrors)) { | ||
if (filterErrors.length) { | ||
errors = filterErrors; | ||
@@ -103,0 +99,0 @@ } else if (!isObject(filters)) { |
@@ -1,12 +0,7 @@ | ||
const { | ||
isAnArray, | ||
containsNoErrorFromParser, | ||
} = require("../helpers/validation"); | ||
function parseInclude(include, includeErrors) { | ||
const parsedArray = []; | ||
let errors = []; | ||
if (!containsNoErrorFromParser(includeErrors)) { | ||
if (includeErrors.length) { | ||
errors = includeErrors; | ||
} else if (!isAnArray(include)) { | ||
} else if (!Array.isArray(include)) { | ||
errors.push("Include field should be an array"); | ||
@@ -13,0 +8,0 @@ } else if (include.length > 0) { |
@@ -1,6 +0,2 @@ | ||
const { | ||
containsNoErrorFromParser, | ||
isNotValidInteger, | ||
isObject, | ||
} = require("../helpers/validation"); | ||
const { isNotValidInteger, isObject } = require("../helpers/validation"); | ||
@@ -10,3 +6,3 @@ function parsePagination(page, pageErrors) { | ||
let errors = []; | ||
if (!containsNoErrorFromParser(pageErrors)) { | ||
if (pageErrors.length) { | ||
errors = pageErrors; | ||
@@ -13,0 +9,0 @@ } else if (!isObject(page)) { |
@@ -1,12 +0,7 @@ | ||
const { | ||
isAnArray, | ||
containsNoErrorFromParser, | ||
} = require("../helpers/validation"); | ||
function parseSort(sort, sortErrors) { | ||
const parsedArray = []; | ||
let errors = []; | ||
if (!containsNoErrorFromParser(sortErrors)) { | ||
if (sortErrors.length) { | ||
errors = sortErrors; | ||
} else if (!isAnArray(sort)) { | ||
} else if (!Array.isArray(sort)) { | ||
errors.push("Sort field should be an array"); | ||
@@ -13,0 +8,0 @@ } else if (sort.length > 0) { |
{ | ||
"name": "@bitovi/objection-querystring-parser", | ||
"version": "0.2.8", | ||
"version": "0.3.0", | ||
"description": "", | ||
@@ -20,3 +20,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"@bitovi/querystring-parser": "^0.7.8" | ||
"@bitovi/querystring-parser": "^0.7.12" | ||
}, | ||
@@ -34,3 +34,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "96833029f0c567feea43fb4284402fb277719070" | ||
"gitHead": "e6c78d07257affc6352a304eced33991e5688071" | ||
} |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
0
28087
16
815