From bb0614af2df9a54ae6a31c3ee21921f4f4b394cd Mon Sep 17 00:00:00 2001 From: Jordan Ramsay <34638a@users.noreply.github.com> Date: Wed, 12 Feb 2025 13:29:43 +1000 Subject: [PATCH] Update object.js Parody patch to align usecase with proposed change for `JSONparseSafe` helper. Tests are the same as per JSONSafeParse. Tests in PR comment. --- helpers/3p/object.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/helpers/3p/object.js b/helpers/3p/object.js index 2f2bf95..da75389 100644 --- a/helpers/3p/object.js +++ b/helpers/3p/object.js @@ -194,7 +194,10 @@ helpers.merge = function(context/*, objects, options*/) { */ helpers.JSONparse = function(str, options) { - return options.fn(JSON.parse(str)); + if (options.fn) { + return options.fn(JSON.parse(str)); + } + return JSON.parse(str); }; /** @@ -217,4 +220,4 @@ helpers.JSONstringify = function(obj, indent) { * deprecated in a future release */ -helpers.stringify = helpers.JSONstringify; \ No newline at end of file +helpers.stringify = helpers.JSONstringify;