Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const getNextTransformer = (fileName, config) => {
const self = config.transform.find(([pattern]) => new RegExp(pattern).test(fileName));
return new ScriptTransformer({
...config,
transform: config.transform.filter(entry => entry !== self),
});
};
const getNextTransformer = (filename, config) => {
const extension = path.extname(filename);
const jsFileName = `${filename.slice(0, -extension.length)}.js`;
const self = config.transform.find(([pattern]) => new RegExp(pattern).test(filename));
const jsTransforms = config.transform.filter(([pattern]) => new RegExp(pattern).test(jsFileName));
return new ScriptTransformer({
...config,
transform: [
...config.transform.filter(entry => entry !== self),
...jsTransforms.map(([pattern, ...rest]) => [self[0], ...rest]),
],
});
};