forked from josdejong/mathjs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsubset.transform.js
More file actions
26 lines (23 loc) · 808 Bytes
/
subset.transform.js
File metadata and controls
26 lines (23 loc) · 808 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { factory } from '../../utils/factory.js'
import { errorTransform } from './utils/errorTransform.js'
import { createSubset } from '../../function/matrix/subset.js'
const name = 'subset'
const dependencies = ['typed', 'matrix']
export const createSubsetTransform = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix }) => {
const subset = createSubset({ typed, matrix })
/**
* Attach a transform function to math.subset
* Adds a property transform containing the transform function.
*
* This transform creates a range which includes the end value
*/
return typed('subset', {
'...any': function (args) {
try {
return subset.apply(null, args)
} catch (err) {
throw errorTransform(err)
}
}
})
}, { isTransformFunction: true })