JS Objects related methods
Methods
# static clear(obj, ignoredPropertiesopt)
Deletes all properties from an object, except a predefined list.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
obj |
object
|
The object to clear. | |
ignoredProperties |
Array.<string>
|
<optional> |
The properties to keep |
# static sort(obj, reverseopt, compareFnopt) → {object}
Sorts object keys and returns a new sorted object.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
obj |
object
|
The object to sort. | ||
reverse |
bool
|
<optional> |
false | Set to true to sort in the reverse order. |
compareFn |
function
|
<optional> |
Specifies a function that defines the sort order. Note that this parameter is ignored if reversed is true. If omitted, the keys are converted to strings, then sorted according to each character's Unicode code point value. |
The new sorted object.
object