From e3173b13c25b5f340f1f231b6c65c3c7c69030a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Aur=C3=A8le=20DARCHE?= Date: Sat, 26 Mar 2022 19:21:42 +0100 Subject: [PATCH] Clearer variable name --- packages/convict/src/main.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/convict/src/main.js b/packages/convict/src/main.js index fd89b39..c0f9127 100644 --- a/packages/convict/src/main.js +++ b/packages/convict/src/main.js @@ -65,7 +65,7 @@ const types = { // alias types.integer = types.int -const converters = new Map() +const custom_converters = new Map() const parsers_registry = {'*': JSON.parse} @@ -398,12 +398,11 @@ function getFormat(schema, path) { } function coerce(k, v, schema, instance) { - // magic coerceing const format = getFormat(schema, k) if (typeof v === 'string') { - if (converters.has(format)) { - return converters.get(format)(v, instance, k) + if (custom_converters.has(format)) { + return custom_converters.get(format)(v, instance, k) } switch (format) { case 'port': @@ -727,7 +726,7 @@ convict.addFormat = function(name, validate, coerce) { } types[name] = validate if (coerce) { - converters.set(name, coerce) + custom_converters.set(name, coerce) } }