forked from josdejong/mathjs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclone.js
More file actions
34 lines (29 loc) · 820 Bytes
/
clone.js
File metadata and controls
34 lines (29 loc) · 820 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
27
28
29
30
31
32
33
34
'use strict'
const object = require('../../utils/object')
function factory (type, config, load, typed) {
/**
* Clone an object.
*
* Syntax:
*
* math.clone(x)
*
* Examples:
*
* math.clone(3.5) // returns number 3.5
* math.clone(math.complex('2-4i') // returns Complex 2 - 4i
* math.clone(math.unit(45, 'deg')) // returns Unit 45 deg
* math.clone([[1, 2], [3, 4]]) // returns Array [[1, 2], [3, 4]]
* math.clone("hello world") // returns string "hello world"
*
* @param {*} x Object to be cloned
* @return {*} A clone of object x
*/
const clone = typed('clone', {
'any': object.clone
})
clone.toTex = undefined // use default template
return clone
}
exports.name = 'clone'
exports.factory = factory