@visactor/vchart
Version:
charts lib based @visactor/VGrammar
19 lines (15 loc) • 757 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.map = void 0;
const data_1 = require("../../constant/data"), vutils_1 = require("@visactor/vutils"), map = (data, opt) => {
const options = (0, vutils_1.isFunction)(opt) ? opt() : opt, features = data.features;
return features && features.forEach(((f, index) => {
var _a, _b;
f[data_1.DEFAULT_DATA_INDEX] = index;
const name = null === (_a = f.properties) || void 0 === _a ? void 0 : _a[options.nameProperty], mappedName = null === (_b = options.nameMap) || void 0 === _b ? void 0 : _b[`${name}`];
f[data_1.DEFAULT_MAP_LOOK_UP_KEY] = mappedName || name;
})), features;
};
exports.map = map;
//# sourceMappingURL=map.js.map