Skip to content

Commit a490b1a

Browse files
authored
docs: add backticks around code snippets in descriptions (#477)
This means things like npmx can render the descriptions as markdown.
1 parent 3622b45 commit a490b1a

3 files changed

Lines changed: 23 additions & 25 deletions

File tree

manifests/micro-utilities.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
"snippet::array-coerce": {
44
"id": "snippet::array-coerce",
55
"type": "simple",
6-
"description": "You can use a combination of a ternary operator and Array.isArray to make sure a value, undefined, null or an array is always returned as an array.",
6+
"description": "You can use a combination of a ternary operator and `Array.isArray` to make sure a value, `undefined`, `null` or an array is always returned as an array.",
77
"example": "(arr == null ? [] : Array.isArray(arr) ? arr : [arr])"
88
},
99
"snippet::array-difference": {
1010
"id": "snippet::array-difference",
1111
"type": "simple",
12-
"description": "You can use a combination of filter and includes to calculate the difference between two arrays.",
12+
"description": "You can use a combination of `filter` and `includes` to calculate the difference between two arrays.",
1313
"example": "const difference = (a, b) => a.filter((item) => !b.includes(item))"
1414
},
1515
"snippet::array-from-count": {
@@ -33,13 +33,13 @@
3333
"snippet::array-union": {
3434
"id": "snippet::array-union",
3535
"type": "simple",
36-
"description": "You can use a combination of the spread operator and Set to create a union of two arrays.",
36+
"description": "You can use a combination of the spread operator and `Set` to create a union of two arrays.",
3737
"example": "const union = (a, b) => [...new Set([...a, ...b])]"
3838
},
3939
"snippet::array-unique": {
4040
"id": "snippet::array-unique",
4141
"type": "simple",
42-
"description": "You can convert to and from a Set to remove duplicates from an array.",
42+
"description": "You can convert to and from a `Set` to remove duplicates from an array.",
4343
"example": "const unique = (arr) => [...new Set(arr)]"
4444
},
4545
"snippet::async-function-constructor": {
@@ -57,7 +57,7 @@
5757
"snippet::call-bind": {
5858
"id": "snippet::call-bind",
5959
"type": "simple",
60-
"description": "Every modern runtime provides a way to bind to the call method of a function.",
60+
"description": "Every modern runtime provides a way to bind to the `call` method of a function.",
6161
"example": "const fnBound = Function.call.bind(fn)"
6262
},
6363
"snippet::char-last": {
@@ -75,13 +75,13 @@
7575
"snippet::get-iterator": {
7676
"id": "snippet::get-iterator",
7777
"type": "simple",
78-
"description": "Every modern runtime provides a way to get the iterator function through the Symbol.iterator symbol.",
78+
"description": "Every modern runtime provides a way to get the iterator function through the `Symbol.iterator` symbol.",
7979
"example": "const iterator = obj[Symbol.iterator]?.()"
8080
},
8181
"snippet::has-argv": {
8282
"id": "snippet::has-argv",
8383
"type": "simple",
84-
"description": "You can use the includes method on the process.argv array to check if a flag is present.",
84+
"description": "You can use the `includes` method on the `process.argv` array to check if a flag is present.",
8585
"example": "process.argv.includes('--flag')"
8686
},
8787
"snippet::is-arguments": {
@@ -93,7 +93,7 @@
9393
"snippet::is-arraybuffer": {
9494
"id": "snippet::is-arraybuffer",
9595
"type": "simple",
96-
"description": "You can use `instanceof ArrayBuffer`, or if cross-realm, use Object.prototype.toString.call(obj) === \"[object ArrayBuffer]\"",
96+
"description": "You can use `instanceof ArrayBuffer`, or if cross-realm, use `Object.prototype.toString.call(obj) === \"[object ArrayBuffer]\"`",
9797
"example": "const isArrayBuffer = obj instanceof ArrayBuffer;\n// for cross-realm\nconst isArrayBufferCrossRealm = Object.prototype.toString.call(obj) === \"[object ArrayBuffer]\""
9898
},
9999
"snippet::is-async-function": {
@@ -111,19 +111,19 @@
111111
"snippet::is-boolean": {
112112
"id": "snippet::is-boolean",
113113
"type": "simple",
114-
"description": "You can use typeof to check if a value is a boolean primitive, and Object.prototype.toString.call to check if it's a Boolean object.",
114+
"description": "You can use `typeof` to check if a value is a boolean primitive, and `Object.prototype.toString.call` to check if it's a `Boolean` object.",
115115
"example": "Object.prototype.toString.call(v) === \"[object Boolean]\""
116116
},
117117
"snippet::is-ci": {
118118
"id": "snippet::is-ci",
119119
"type": "simple",
120-
"description": "Every major CI provider sets a CI environment variable that you can use to detect if you're running in a CI environment.",
120+
"description": "Every major CI provider sets a `CI` environment variable that you can use to detect if you're running in a CI environment.",
121121
"example": "Boolean(process.env.CI)"
122122
},
123123
"snippet::is-date": {
124124
"id": "snippet::is-date",
125125
"type": "simple",
126-
"description": "You can use `instanceof Date`, or if cross-realm, use Object.prototype.toString.call(v) === \"[object Date]\"",
126+
"description": "You can use `instanceof Date`, or if cross-realm, use `Object.prototype.toString.call(v) === \"[object Date]\"`",
127127
"example": "const isDate = v instanceof Date;\n// for cross-realm\nconst isDateCrossRealm = Object.prototype.toString.call(v) === \"[object Date]\""
128128
},
129129
"snippet::is-even": {
@@ -159,7 +159,7 @@
159159
"snippet::is-npm": {
160160
"id": "snippet::is-npm",
161161
"type": "simple",
162-
"description": "If the current environment is npm the `npm_config_user_agent` environment variable will be set and start with \"npm\".",
162+
"description": "If the current environment is npm the `npm_config_user_agent` environment variable will be set and start with `\"npm\"`.",
163163
"example": "const isNpm = process.env.npm_config_user_agent?.startsWith(\"npm\")"
164164
},
165165
"snippet::is-object": {
@@ -183,7 +183,7 @@
183183
"snippet::is-primitve": {
184184
"id": "snippet::is-primitve",
185185
"type": "simple",
186-
"description": "You can check `typeof` of a value to determine if it's a primitive. Note that `typeof null` is \"object\" so you need to check for null separately.",
186+
"description": "You can check `typeof` of a value to determine if it's a primitive. Note that `typeof null` is `\"object\"` so you need to check for `null` separately.",
187187
"example": "const isPrimitive = (value) => value === null || (typeof value !== \"function\" && typeof value !== \"object\");"
188188
},
189189
"snippet::is-regexp": {
@@ -231,7 +231,7 @@
231231
"snippet::json-file": {
232232
"id": "snippet::json-file",
233233
"type": "simple",
234-
"description": "You can use `JSON` and 'node:fs' to read and write json file.",
234+
"description": "You can use `JSON` and `node:fs` to read and write JSON files.",
235235
"example": "import * as fs from 'node:fs/promises'\nfs.readFile(file, 'utf8').then(JSON.parse)\nfs.writeFile(file, JSON.stringify(data, null, 2) + '\\n')"
236236
},
237237
"snippet::math-random": {

manifests/native.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,7 @@
897897
"Object.assign": {
898898
"id": "Object.assign",
899899
"type": "native",
900-
"description": "Object.assign, or if deep clones are needed, use structuredClone",
900+
"description": "`Object.assign`, or if deep clones are needed, use `structuredClone`",
901901
"url": {
902902
"type": "mdn",
903903
"id": "Web/JavaScript/Reference/Global_Objects/Object/assign"
@@ -1404,7 +1404,7 @@
14041404
"es-errors": {
14051405
"id": "es-errors",
14061406
"type": "removal",
1407-
"description": "Error and its subclasses are natively built into all modern environments.",
1407+
"description": "`Error` and its subclasses are natively built into all modern environments.",
14081408
"url": {
14091409
"type": "mdn",
14101410
"id": "Web/JavaScript/Reference/Global_Objects/Error"
@@ -1413,7 +1413,7 @@
14131413
"es-string-html-methods": {
14141414
"id": "es-string-html-methods",
14151415
"type": "removal",
1416-
"description": "All the methods exported by this modules are generally available on the String prototype in modern environments.",
1416+
"description": "All the methods exported by this modules are generally available on the `String` prototype in modern environments.",
14171417
"url": {
14181418
"type": "mdn",
14191419
"id": "Web/JavaScript/Reference/Global_Objects/String#html_wrapper_methods"
@@ -1439,7 +1439,7 @@
14391439
"for...of": {
14401440
"id": "for...of",
14411441
"type": "native",
1442-
"description": "for...of (using \"Object.entries\" if dealing with objects)",
1442+
"description": "`for...of` (using `Object.entries` if dealing with objects)",
14431443
"url": {
14441444
"type": "mdn",
14451445
"id": "Web/JavaScript/Reference/Statements/for...of"
@@ -1482,7 +1482,7 @@
14821482
"has-bigints": {
14831483
"id": "has-bigints",
14841484
"type": "removal",
1485-
"description": "Every modern environment has support for BigInt. You can just remove the check.",
1485+
"description": "Every modern environment has support for `BigInt`. You can just remove the check.",
14861486
"url": {
14871487
"type": "mdn",
14881488
"id": "Web/JavaScript/Reference/Global_Objects/BigInt"
@@ -1491,7 +1491,7 @@
14911491
"has-dynamic-import": {
14921492
"id": "has-dynamic-import",
14931493
"type": "removal",
1494-
"description": "Every modern environment has support for dynamic import. You can just remove the check.",
1494+
"description": "Every modern environment has support for dynamic `import()`. You can just remove the check.",
14951495
"url": {
14961496
"type": "mdn",
14971497
"id": "Web/JavaScript/Reference/Operators/import"
@@ -1518,7 +1518,7 @@
15181518
"has-proto": {
15191519
"id": "has-proto",
15201520
"type": "removal",
1521-
"description": "Every modern environment has support for __proto__. You can just remove the check.",
1521+
"description": "Every modern environment has support for `__proto__`. You can just remove the check.",
15221522
"url": {
15231523
"type": "mdn",
15241524
"id": "Web/JavaScript/Reference/Operators/Object_initializer#prototype_setter"
@@ -1527,7 +1527,7 @@
15271527
"has-symbols": {
15281528
"id": "has-symbols",
15291529
"type": "removal",
1530-
"description": "Every modern environment has support for Symbols. You can just remove the check.",
1530+
"description": "Every modern environment has support for `Symbol`. You can just remove the check.",
15311531
"url": {
15321532
"type": "mdn",
15331533
"id": "Web/JavaScript/Reference/Global_Objects/Symbol"

manifests/preferred.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2999,7 +2999,6 @@
29992999
"fs": {
30003000
"id": "fs",
30013001
"type": "native",
3002-
"description": "Node file system module",
30033002
"nodeFeatureId": {"moduleName": "node:fs"},
30043003
"url": {"type": "node", "id": "api/fs.html"}
30053004
},
@@ -3288,7 +3287,6 @@
32883287
"readline.createInterface": {
32893288
"id": "readline.createInterface",
32903289
"type": "native",
3291-
"description": "readline.createInterface",
32923290
"nodeFeatureId": {
32933291
"moduleName": "node:readline",
32943292
"exportName": "createInterface"
@@ -3307,7 +3305,7 @@
33073305
"sort-object": {
33083306
"id": "sort-object",
33093307
"type": "removal",
3310-
"description": "Object.entries and Array.prototype.sort can be used to sort object keys.",
3308+
"description": "`Object.entries` and `Array.prototype.sort` can be used to sort object keys.",
33113309
"url": {"type": "e18e", "id": "sort-object"}
33123310
},
33133311
"sort-object-keys": {

0 commit comments

Comments
 (0)