Skip to content

Commit ee28df8

Browse files
kelvindesman43081j
andauthored
feat(micro-utilities): add merge-descriptors to replacements (#1225)
* feat(micro-utilities): add merge-descriptors to replacements * Apply suggestion from @43081j --------- Co-authored-by: James Garbutt <43081j@users.noreply.github.com>
1 parent 02b9ed4 commit ee28df8

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

‎manifests/micro-utilities.json‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,12 @@
540540
"description": "You can use `Math.random()` or `crypto.getRandomValues` if cryptographic randomness is required.",
541541
"example": "crypto.getRandomValues(new Uint32Array(1))[0] / (2 ** 32);\n// or\nMath.random();"
542542
},
543+
"snippet::merge-descriptors": {
544+
"id": "snippet::merge-descriptors",
545+
"type": "simple",
546+
"description": "You can copy property descriptors (including getters and setters) from one object to another with `Object.defineProperties` and `Object.getOwnPropertyDescriptors`. To skip properties the destination already has, loop over `Object.getOwnPropertyNames` instead.",
547+
"example": "const mergeDescriptors = (destination, source) =>\n Object.defineProperties(destination, Object.getOwnPropertyDescriptors(source))"
548+
},
543549
"snippet::min-indent": {
544550
"id": "snippet::min-indent",
545551
"type": "simple",
@@ -1369,6 +1375,11 @@
13691375
"moduleName": "math-random",
13701376
"replacements": ["snippet::math-random"]
13711377
},
1378+
"merge-descriptors": {
1379+
"type": "module",
1380+
"moduleName": "merge-descriptors",
1381+
"replacements": ["snippet::merge-descriptors"]
1382+
},
13721383
"min-indent": {
13731384
"type": "module",
13741385
"moduleName": "min-indent",

0 commit comments

Comments
 (0)