From 7684947e413dcdc2f84ee62a92d06c47050592f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabio=20Jos=C3=A9?= Date: Tue, 23 Jul 2019 09:04:55 -0300 Subject: [PATCH] change fun name to isStringOrObjectOrThrow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fabio José --- lib/formats/json/parser.js | 4 ++-- lib/utils/fun.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/formats/json/parser.js b/lib/formats/json/parser.js index cb82cc1..d72a153 100644 --- a/lib/formats/json/parser.js +++ b/lib/formats/json/parser.js @@ -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(); diff --git a/lib/utils/fun.js b/lib/utils/fun.js index 38dc3a2..cf0ca68 100644 --- a/lib/utils/fun.js +++ b/lib/utils/fun.js @@ -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 };