Skip to content

Commit 2ca23b3

Browse files
committed
shallow-copy
1 parent f663304 commit 2ca23b3

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
var acorn = require('acorn');
22
var walk = require('acorn/dist/walk');
3+
var copy = require('shallow-copy');
34
var defined = require('defined');
45
var fastFind = require('./find-fast');
56

@@ -29,7 +30,8 @@ var exports = module.exports = function (src, opts) {
2930

3031
exports.find = function (src, opts) {
3132
if (!opts) opts = {};
32-
opts = Object.assign({}, opts, { parse: getParseOpts(opts.parse) });
33+
else opts = copy(opts);
34+
opts.parse = getParseOpts(opts.parse);
3335

3436
if (!opts.isRequire && !opts.fullParse) {
3537
return fastFind(src, opts);

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
},
1919
"dependencies": {
2020
"acorn": "^4.0.3",
21-
"defined": "^1.0.0"
21+
"defined": "^1.0.0",
22+
"shallow-copy": "0.0.1"
2223
},
2324
"devDependencies": {
2425
"tap": "^10.7.3"

0 commit comments

Comments
 (0)