function parse(args) {
            if (!args.to) {
                // illegal arguments
                return null;
            }
            var direction;
            switch (args.to) {
                case CursorMove.RawDirection.Left:
                    direction = 0 /* Left */;
                    break;
                case CursorMove.RawDirection.Right:
                    direction = 1 /* Right */;
                    break;
                case CursorMove.RawDirection.Up:
                    direction = 2 /* Up */;
                    break;
                case CursorMove.RawDirection.Down:
                    direction = 3 /* Down */;
                    break;
                case CursorMove.RawDirection.WrappedLineStart:
                    direction = 4 /* WrappedLineStart */;
                    break;
                case CursorMove.RawDirection.WrappedLineFirstNonWhitespaceCharacter:
                    direction = 5 /* WrappedLineFirstNonWhitespaceCharacter */;
                    break;
                case CursorMove.RawDirection.WrappedLineColumnCenter:
                    direction = 6 /* WrappedLineColumnCenter */;
                    break;
                case CursorMove.RawDirection.WrappedLineEnd:
                    direction = 7 /* WrappedLineEnd */;
                    break;
                case CursorMove.RawDirection.WrappedLineLastNonWhitespaceCharacter:
                    direction = 8 /* WrappedLineLastNonWhitespaceCharacter */;
                    break;
                case CursorMove.RawDirection.ViewPortTop:
                    direction = 9 /* ViewPortTop */;
                    break;
                case CursorMove.RawDirection.ViewPortBottom:
                    direction = 11 /* ViewPortBottom */;
                    break;
                case CursorMove.RawDirection.ViewPortCenter:
                    direction = 10 /* ViewPortCenter */;
                    break;
                case CursorMove.RawDirection.ViewPortIfOutside:
                    direction = 12 /* ViewPortIfOutside */;
                    break;
                default:
                    // illegal arguments
                    return null;
            }
            var unit = 0 /* None */;
            switch (args.by) {
                case CursorMove.RawUnit.Line:
                    unit = 1 /* Line */;
                    break;
                case CursorMove.RawUnit.WrappedLine:
                    unit = 2 /* WrappedLine */;
                    break;
                case CursorMove.RawUnit.Character:
                    unit = 3 /* Character */;
                    break;
                case CursorMove.RawUnit.HalfLine:
                    unit = 4 /* HalfLine */;
                    break;
            }
            return {
                direction: direction,
                unit: unit,
                select: (!!args.select),
                value: (args.value || 1)
            };
        }
Units for Cursor move 'by' argument