1 | 'use strict'
|
2 |
|
3 | const errorTransform = require('./error.transform').transform
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 | function factory (type, config, load, typed) {
|
13 | const row = load(require('../../function/matrix/row'))
|
14 |
|
15 |
|
16 | return typed('row', {
|
17 | '...any': function (args) {
|
18 |
|
19 | const lastIndex = args.length - 1
|
20 | const last = args[lastIndex]
|
21 | if (type.isNumber(last)) {
|
22 | args[lastIndex] = last - 1
|
23 | }
|
24 |
|
25 | try {
|
26 | return row.apply(null, args)
|
27 | } catch (err) {
|
28 | throw errorTransform(err)
|
29 | }
|
30 | }
|
31 | })
|
32 | }
|
33 |
|
34 | exports.name = 'row'
|
35 | exports.path = 'expression.transform'
|
36 | exports.factory = factory
|