change fun name to isStringOrObjectOrThrow

Signed-off-by: Fabio José <fabiojose@gmail.com>
This commit is contained in:
Fabio José 2019-07-23 09:04:55 -03:00
parent cb5f0e377e
commit 7684947e41
2 changed files with 4 additions and 4 deletions

View File

@ -1,7 +1,7 @@
const {
isString,
isDefinedOrThrow,
isValidOrThrow
isStringOrObjectOrThrow
} = require("../../utils/fun.js");
function JSONParser() {
@ -25,7 +25,7 @@ function validateAndParse(payload) {
var json =
Array.of(payload)
.filter(p => isDefinedOrThrow(p, nullOrIndefinedPayload))
.filter(p => isValidOrThrow(p, invalidPayloadTypeError))
.filter(p => isStringOrObjectOrThrow(p, invalidPayloadTypeError))
.map(asJSON)
.shift();

View File

@ -8,7 +8,7 @@ const isDefinedOrThrow = (v, t) =>
? () => true
: (() => {throw t})());
const isValidOrThrow = (v, t) =>
const isStringOrObjectOrThrow = (v, t) =>
(isString(v)
? true
: isObject(v)
@ -21,5 +21,5 @@ module.exports = {
isDefined : isDefined,
isDefinedOrThrow : isDefinedOrThrow,
isValidOrThrow : isValidOrThrow
isStringOrObjectOrThrow : isStringOrObjectOrThrow
};