Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function createGenerator(props, generator?: Contours): Contours {
generator = generator || d3.contours();
return args.reduce((acc: Contours, arg) => {
const prop = props[arg];
if (prop) {
return acc[arg](prop);
}
return acc;
}, generator);
}
function create(img) {
return contours()
.size([m, n])
.thresholds(thresholds)(values)
.map(function (contour) {
var canvas = document.createElement('canvas');
var ctx = canvas.getContext('2d');
canvas.width = 2048;
canvas.height = 2048;
var path = geoPath(null, ctx);
if (img) {
var pattern = ctx.createPattern(img, 'repeat');
ctx.fillStyle = pattern;
}
else {
ctx.fillStyle = '#fff';
}
ctx.fillRect(0, 0, canvas.width, canvas.height);