DockerERTFF/public/PDF/dbMap.js

20 lines
535 B
JavaScript

// JavaScript Document
// map to create substitution to match the Datasource field => PDF Field name
// [DataSource Field, PDF Field]
const map = new Map([
['a', 1],
['b', 2],
['c', 3]
]);
map.set('key', 'value') // sets 'key' to = 'value' in Map object name map
const m = map.get('key') // returns value
function getValueByKey(map, key) {
const entry = [...map].find(([k, v]) => k === key);
return entry ? entry[1] : undefined;
}
const keyToFind = 'b';
const value = getValueByKey(map, keyToFind); // Returns 2