ethers.js/docs.wrm/api/utils/properties.wrm

41 lines
1.4 KiB
Plaintext
Raw Normal View History

2020-02-01 11:39:21 +03:00
_section: Property Utilities
2021-02-08 22:52:31 +03:00
This is a collection of utility functions used for handling
properties in a platform-safe way.
The next major version of ethers will no longer be compatible
with ES3, so many of these will be removed in favor of the
built-in options available in ES2015 and above.
_property: ethers.utils.checkProperties(object, check) => void
Checks that //object// only contains properties included
in //check//, and throws [INVALID_ARGUMENT](errors--invalid-argument) if not.
2020-02-01 11:39:21 +03:00
2020-02-18 01:56:13 +03:00
_property: ethers.utils.deepCopy(anObject) => any
2021-02-08 22:52:31 +03:00
Creates a recursive copy of //anObject//. Frozen (i.e. and other known
immutable) objects are copied by reference.
2020-02-18 01:56:13 +03:00
_property: ethers.utils.defineReadOnly(anObject, name, value) => void
2021-02-08 22:52:31 +03:00
Uses the ``Object.defineProperty`` method to set a read-only property
on an object.
2020-02-18 01:56:13 +03:00
_property: ethers.utils.getStatic(aConstructor, key) => any
2021-02-08 22:52:31 +03:00
Recursively check for a static method //key// on an inheritance chain
from //aConstructor// to all ancestors.
This is used to mimic behaviour in other languages where ``this`` in
a static method will also search ancestors.
2020-02-18 01:56:13 +03:00
_property: ethers.utils.resolveProperties(anObject) => Promise<any> @<utils-resolveproperties> @SRC<properties>
2021-02-08 22:52:31 +03:00
Retruns a Promise which resolves all child values on //anObject//.
2020-02-18 01:56:13 +03:00
_property: ethers.utils.shallowCopy(anObject) => any
2021-02-08 22:52:31 +03:00
Returns a shallow copy of //anObject//. This is the same as
using ``Object.assign({ }, anObject)``.