Skip to content

Instantly share code, notes, and snippets.

@lokhmakov
Created October 21, 2018 10:31
Show Gist options
  • Save lokhmakov/e31dfe39faaa09a558da0fa10dc28abd to your computer and use it in GitHub Desktop.
Save lokhmakov/e31dfe39faaa09a558da0fa10dc28abd to your computer and use it in GitHub Desktop.
core/entity/api/generate/require.js
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