node package manager
Love JavaScript? Your insights can make it even better. Take the 2017 JavaScript Ecosystem Survey »

ismodule

isModule Build Status

Test if a string is an es6 module.

npm install --save ismodule;

var isModule = require('ismodule');
 
isModule('export default 9'); //true 
isModule('let b = "export default 9"'); //false