Document Object#clone

fixes #9930
This commit is contained in:
Michael Friedrich 2015-10-16 11:57:19 +02:00
parent 498ff3c1ee
commit 4fb5329e60
2 changed files with 24 additions and 2 deletions

View File

@ -805,7 +805,8 @@ Array | [ "a", "b" ] | An array.
Dictionary | { a = 3 } | A dictionary. Dictionary | { a = 3 } | A dictionary.
Depending on which libraries are loaded additional types may become available. The `icinga` Depending on which libraries are loaded additional types may become available. The `icinga`
library implements a whole bunch of other types, e.g. Host, Service, CheckCommand, etc. library implements a whole bunch of other [object types](6-object-types.md#object-types),
e.g. Host, Service, CheckCommand, etc.
Each type has an associated type object which describes the type's semantics. These Each type has an associated type object which describes the type's semantics. These
type objects are made available using global variables which match the type's name: type objects are made available using global variables which match the type's name:
@ -816,9 +817,12 @@ type objects are made available using global variables which match the type's na
The type object's `prototype` property can be used to find out which methods a certain type The type object's `prototype` property can be used to find out which methods a certain type
supports: supports:
/* This returns: ["find","len","lower","replace","split","substr","to_string","upper"] */ /* This returns: ["contains","find","len","lower","replace","reverse","split","substr","to_string","upper"] */
keys(String.prototype) keys(String.prototype)
Additional documentation on type methods is available in the
[library reference](21-library-reference.md#library-reference).
## <a id="reserved-keywords"></a> Reserved Keywords ## <a id="reserved-keywords"></a> Reserved Keywords
These keywords are reserved and must not be used as constants or custom attributes. These keywords are reserved and must not be used as constants or custom attributes.

View File

@ -508,8 +508,22 @@ Signature:
Returns a copy of the string in reverse order. Returns a copy of the string in reverse order.
## <a id="object-type"></a> Object type
### <a id="object-clone"></a> Object#clone
Signature:
function clone();
Returns a copy of the object. Note that for object elements which are
reference values (e.g. objects such as arrays or dictionaries) the entire
object is recursively copied.
## <a id="array-type"></a> Array type ## <a id="array-type"></a> Array type
Inherits methods from the [object type](21-library-reference.md#object-type).
### <a id="array-add"></a> Array#add ### <a id="array-add"></a> Array#add
Signature: Signature:
@ -600,6 +614,10 @@ Signature:
Returns a new array with all elements of the current array in reverse order. Returns a new array with all elements of the current array in reverse order.
## <a id="dictionary-type"></a> Dictionary type
Inherits methods from the [object type](21-library-reference.md#object-type).
### <a id="dictionary-shallow-clone"></a> Dictionary#shallow_clone ### <a id="dictionary-shallow-clone"></a> Dictionary#shallow_clone
Signature: Signature: