UNPKG

507 BJavaScriptView Raw
1const createTransformer = require('./lib/createTransformer').default;
2
3/**
4 * Exposes API similar to Babel:
5 *
6 * import lebab from "lebab";
7 * const {code, warnings} = lebab.transform('Some JS', ['let', 'arrow']);
8 *
9 * @param {String} code The code to transform
10 * @param {String[]} transformNames The transforms to apply
11 * @return {Object} An object with code and warnings props
12 */
13exports.transform = function(code, transformNames) {
14 return createTransformer(transformNames).run(code);
15};