Skip to content

Commit

Permalink
feat(metadata-function-map): add metadata function map to support che…
Browse files Browse the repository at this point in the history
…ck evaulate functions as an id string (#2162)
  • Loading branch information
straker committed Apr 15, 2020
1 parent fc2cac0 commit ec9b931
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/core/base/check.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
/*global CheckResult,DqElement */
/*global CheckResult,DqElement, metadataFunctionMap */

function createExecutionContext(spec) {
/*eslint no-eval:0 */
'use strict';
if (typeof spec === 'string') {
if (metadataFunctionMap.has(spec)) {
return metadataFunctionMap.get(spec);
}

return new Function('return ' + spec + ';')();
}
return spec;
Expand Down
9 changes: 9 additions & 0 deletions lib/core/base/metadata-function-map.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*eslint no-unused-vars:0*/
// TODO: es-modules-checks
// TODO: es-modules-rules
// import all check evaluate and after functions, and all rule matches functions

const metadataFunctionMap = new Map();

// TODO: es-modules-core
// export default metadataFunctionMap;

0 comments on commit ec9b931

Please sign in to comment.