Skip to content

Commit

Permalink
Merge pull request #98 from wunci/chore/remove-newfunction
Browse files Browse the repository at this point in the history
chore: remove new Function
  • Loading branch information
errorrik authored Jan 9, 2025
2 parents 1e0563c + ba7bee0 commit 1119fdb
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ try {
catch (ex) {}

function extendsAsFunc(RawClass) {
let F = new Function();
let F = function () {};
F.prototype = RawClass.prototype;

let NewClass = function (option) {
Expand Down
2 changes: 1 addition & 1 deletion src/parse-name.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default function parseName(source) {
}
else if (/^(['"])([^\1]+)\1$/.test(propAccessorLiteral)) {
// for string literal
result.push((new Function('return ' + propAccessorLiteral))());
result.push(propAccessorLiteral.slice(1, propAccessorLiteral.length - 1));
}

term = term.slice(propAccessorEnd + 1);
Expand Down
3 changes: 1 addition & 2 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import './connect.spec';
import './connect.san.spec';
import './connect.createConnector.spec';
import './use.spec';
import './parse-name.spec';


import {store, Store, connect} from 'san-store';
Expand All @@ -21,5 +22,3 @@ describe('main', () => {
expect(typeof connect.san).toBe('function');
});
});


0 comments on commit 1119fdb

Please sign in to comment.