From 3a7f5f6f4e60d08155fe6632116a1e2e32b2b43e Mon Sep 17 00:00:00 2001 From: Vitor Araujo Date: Fri, 20 Oct 2023 22:31:38 -0300 Subject: [PATCH] fix(datamapper): returns the value if it is considered empty Using checker.isEmpty null, undefined, {} or "" values will be returned by themselves, without being converted to null or undefined and without being passed to the parser. BREAKING CHANGE: This can change the way a value that does not exist in the collection is undefined in the application that uses the lib. A null value is returned as null, but an undefined is passed to the parser and can return a different value. Instead of "undefined", undefined will be returned, causing breaking changes in systems that expect "undefined" with a string type. #36 and #39 --- src/dataMapper.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dataMapper.js b/src/dataMapper.js index 81fad6a..3f1cd92 100644 --- a/src/dataMapper.js +++ b/src/dataMapper.js @@ -143,7 +143,7 @@ class DataMapper { } function dataParser(value, parser) { - if (value === null) return null + if (checker.isEmpty(value)) return value return parser(value) }