From 9a46e22316ee70ce1991d61a7504781a0f026296 Mon Sep 17 00:00:00 2001 From: Piotr Krajewski Date: Wed, 11 Mar 2020 18:13:30 +0100 Subject: [PATCH] Update index.js --- index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 725fdd1..d4f37fe 100644 --- a/index.js +++ b/index.js @@ -1,5 +1,6 @@ const transform = (input, callback) => { - if (!input || typeof input !== 'object') return callback(input); + if (typeof input === 'string') return callback(input); + if (!input || typeof input !== 'object') return input; if (Array.isArray(input)) return input.map(item => transform(item, callback)); return Object.keys(input).reduce((acc, key) => {