Skip to content

Commit

Permalink
fix: clone options object before mutating it
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverwoodings committed Oct 1, 2019
1 parent 2da2ddb commit 33f5dee
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ export function target(target) {
}

export function transform(source, options = {}) {
// We clone the options object because we mutate it later on. If we don't, then
// issues crop up if the caller re-uses the same options object between calls
// to this function.
options = Object.assign({}, options);
let ast;
let jsx = null;

Expand Down

0 comments on commit 33f5dee

Please sign in to comment.