-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
После build-а функция уже с параметрами и получается вложенный массив.
{ '$function': [ [ 'test', { data: 42 } ], { ENV: 'test' } ] }. Надо склеивать параметры функции или обрабатывать вложенный массив.
'use strict';
const buildConfig = require('dollar-config/build');
const DollarConfig = require('dollar-config');
const source = {
func: { $function: [ 'test', { data: 42 } ] }
};
const functions = {
test: (params) => params.data
};
const good = new DollarConfig(source, { functions });
console.log('GOOD', good.get('func', {})); // => GOOD 42
const builded = buildConfig(source, { ENV: 'test' });
const bad = new DollarConfig(builded, { functions });
console.log('BAD', bad.get('func', {})); // Кидает ошибку
/*
.../node_modules/dollar-config/index.js:189
path = path.split('.');
^
TypeError: path.split is not a function
at get (.../node_modules/dollar-config/index.js:189:17)
at Object.$function (.../node_modules/dollar-config/index.js:44:16)
at Config._resolve (.../node_modules/dollar-config/index.js:110:44)
at Config.get (.../node_modules/dollar-config/index.js:80:30)
at ...
*/Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels