Skip to content

Commit 78a0088

Browse files
committed
Create index.js
1 parent a86ce05 commit 78a0088

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

index.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
// no idea what these regular expressions do,
3+
// but i extracted it from https://github.com/yahoo/js-module-formats/blob/master/index.js#L18
4+
var ES6ImportExportRegExp = /(?:^\s*|[}{\(\);,\n]\s*)(import\s+['"]|(import|module)\s+[^"'\(\)\n;]+\s+from\s+['"]|export\s+(\*|\{|default|function|var|const|let|[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*))/;
5+
6+
var ES6AliasRegExp = /(?:^\s*|[}{\(\);,\n]\s*)(export\s*\*\s*from\s*(?:'([^']+)'|"([^"]+)"))/;
7+
8+
module.exports = function (sauce) {
9+
return ES6ImportExportRegExp.test(sauce)
10+
|| ES6AliasRegExp.test(sauce);
11+
};

0 commit comments

Comments
 (0)