StackGenVis: Alignment of Data, Algorithms, and Models for Stacking Ensemble Learning Using Performance Metrics https://doi.org/10.1109/TVCG.2020.3030352
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
StackGenVis/frontend/node_modules/plotly.js/tasks/compress_attributes.js

45 lines
1.0 KiB

4 years ago
var through = require('through2');
/**
* Browserify transform that strips meta attributes out
* of the plotly.js bundles
*/
// one line string with or without trailing comma
function makeStringRegex(attr) {
return attr + ': \'.*\'' + ',?';
}
// joined array of strings with or without trailing comma
function makeJoinedArrayRegex(attr) {
return attr + ': \\[[\\s\\S]*?\\]' + '\\.join\\(.*' + ',?';
}
// array with or without trailing comma
function makeArrayRegex(attr) {
return attr + ': \\[[\\s\\S]*?\\]' + ',?';
}
// ref: http://www.regexr.com/3cmac
var regexStr = [
makeStringRegex('description'),
makeJoinedArrayRegex('description'),
makeArrayRegex('requiredOpts'),
makeArrayRegex('otherOpts'),
makeStringRegex('hrName'),
makeStringRegex('role')
].join('|');
var regex = new RegExp(regexStr, 'g');
module.exports = function() {
return through(function(buf, enc, next) {
this.push(
buf.toString('utf-8')
.replace(regex, '')
);
next();
});
};