Created
October 21, 2018 10:31
-
-
Save lokhmakov/e31dfe39faaa09a558da0fa10dc28abd to your computer and use it in GitHub Desktop.
core/entity/api/generate/require.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { builders as b } from 'ast-types' | |
export default ({ | |
name, | |
from, | |
}) => { | |
return b.variableDeclaration( | |
'const', | |
[ | |
b.variableDeclarator( | |
b.identifier(name), | |
b.callExpression( | |
b.identifier('require'), | |
[ | |
b.stringLiteral(from) | |
] | |
) | |
) | |
] | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment