UNPKG

decaffeinate-parser

Version:

A better AST for CoffeeScript, inspired by CoffeeScriptRedux.

16 lines (15 loc) 608 B
import { DefaultParam, Rest } from '../nodes'; import getLocation from '../util/getLocation'; import mapAny from './mapAny'; export default function mapParam(context, node) { var _a = getLocation(context, node), line = _a.line, column = _a.column, start = _a.start, end = _a.end, raw = _a.raw; var param = mapAny(context, node.name); if (node.value) { var value = mapAny(context, node.value); return new DefaultParam(line, column, start, end, raw, param, value); } if (node.splat) { return new Rest(line, column, start, end, raw, param); } return param; }