Skip to content

Commit 8465efa

Browse files
gameroman43081j
andauthored
feat: improve mappings for some lodash.* modules (#632)
* feat: improve mappings for some `lodash.*` modules * fix * Apply suggestions from code review Co-authored-by: James Garbutt <43081j@users.noreply.github.com> --------- Co-authored-by: James Garbutt <43081j@users.noreply.github.com>
1 parent 838ddb8 commit 8465efa

3 files changed

Lines changed: 119 additions & 114 deletions

File tree

manifests/micro-utilities.json

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,12 @@
150150
"description": "You can use the modulo operator to check if a number is even.",
151151
"example": "(n % 2) === 0"
152152
},
153+
"snippet::is-function": {
154+
"id": "snippet::is-function",
155+
"type": "simple",
156+
"description": "You can use `typeof` to check if a value is a function.",
157+
"example": "const isString = (value) => typeof value === \"function\";"
158+
},
153159
"snippet::is-generator-function": {
154160
"id": "snippet::is-generator-function",
155161
"type": "simple",
@@ -180,6 +186,12 @@
180186
"description": "If the current environment is npm the `npm_config_user_agent` environment variable will be set and start with `\"npm\"`.",
181187
"example": "const isNpm = process.env.npm_config_user_agent?.startsWith(\"npm\")"
182188
},
189+
"snippet::is-null": {
190+
"id": "snippet::is-null",
191+
"type": "simple",
192+
"description": "You can check if a value is `null` using regular equality checks.",
193+
"example": "value === null"
194+
},
183195
"snippet::is-number": {
184196
"id": "snippet::is-number",
185197
"type": "simple",
@@ -240,6 +252,12 @@
240252
"description": "You can check if the current environment is Travis CI by checking if the `TRAVIS` environment variable is set.",
241253
"example": "const isTravis = () => \"TRAVIS\" in process.env;"
242254
},
255+
"snippet::is-undefined": {
256+
"id": "snippet::is-undefined",
257+
"type": "simple",
258+
"description": "You can use `typeof` to check if a value is `undefined`.",
259+
"example": "typeof value === \"undefined\";"
260+
},
243261
"snippet::is-whitespace": {
244262
"id": "snippet::is-whitespace",
245263
"type": "simple",
@@ -264,6 +282,12 @@
264282
"description": "You can use `Math.random()` or `crypto.getRandomValues` if cryptographic randomness is required.",
265283
"example": "crypto.getRandomValues(new Uint32Array(1))[0] / (2 ** 32);\n// or\nMath.random();"
266284
},
285+
"snippet::noop": {
286+
"id": "snippet::noop",
287+
"type": "simple",
288+
"description": "You can use an arrow function `() => {}` for a noop function.",
289+
"example": "const noop = () => {}"
290+
},
267291
"snippet::object-filter": {
268292
"id": "snippet::object-filter",
269293
"type": "simple",
@@ -628,6 +652,61 @@
628652
"moduleName": "last-char",
629653
"replacements": ["snippet::char-last"]
630654
},
655+
"lodash.isboolean": {
656+
"type": "module",
657+
"moduleName": "lodash.isboolean",
658+
"replacements": ["snippet::is-boolean"]
659+
},
660+
"lodash.isfunction": {
661+
"type": "module",
662+
"moduleName": "lodash.isfunction",
663+
"replacements": ["snippet::is-function"]
664+
},
665+
"lodash.isnull": {
666+
"type": "module",
667+
"moduleName": "lodash.isnull",
668+
"replacements": ["snippet::is-null"]
669+
},
670+
"lodash.isnumber": {
671+
"type": "module",
672+
"moduleName": "lodash.isnumber",
673+
"replacements": ["snippet::is-number"]
674+
},
675+
"lodash.isobject": {
676+
"type": "module",
677+
"moduleName": "lodash.isobject",
678+
"replacements": ["snippet::is-object"]
679+
},
680+
"lodash.isplainobject": {
681+
"type": "module",
682+
"moduleName": "lodash.isplainobject",
683+
"replacements": ["snippet::is-object"]
684+
},
685+
"lodash.isregexp": {
686+
"type": "module",
687+
"moduleName": "lodash.isregexp",
688+
"replacements": ["snippet::is-regexp"]
689+
},
690+
"lodash.isstring": {
691+
"type": "module",
692+
"moduleName": "lodash.isstring",
693+
"replacements": ["snippet::is-string"]
694+
},
695+
"lodash.issymbol": {
696+
"type": "module",
697+
"moduleName": "lodash.issymbol",
698+
"replacements": ["snippet::is-symbol"]
699+
},
700+
"lodash.isundefined": {
701+
"type": "module",
702+
"moduleName": "lodash.isundefined",
703+
"replacements": ["snippet::is-undefined"]
704+
},
705+
"lodash.noop": {
706+
"type": "module",
707+
"moduleName": "lodash.noop",
708+
"replacements": ["snippet::noop"]
709+
},
631710
"lower-case": {
632711
"type": "module",
633712
"moduleName": "lower-case",

manifests/native.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2277,6 +2277,46 @@
22772277
"moduleName": "left-pad",
22782278
"replacements": ["String.prototype.padStart"]
22792279
},
2280+
"lodash.isarray": {
2281+
"type": "module",
2282+
"moduleName": "lodash.isarray",
2283+
"replacements": ["Array.isArray"]
2284+
},
2285+
"lodash.isbuffer": {
2286+
"type": "module",
2287+
"moduleName": "lodash.isbuffer",
2288+
"replacements": ["Buffer.isBuffer"]
2289+
},
2290+
"lodash.iserror": {
2291+
"type": "module",
2292+
"moduleName": "lodash.iserror",
2293+
"replacements": ["Error.isError"]
2294+
},
2295+
"lodash.isfinite": {
2296+
"type": "module",
2297+
"moduleName": "lodash.isfinite",
2298+
"replacements": ["Number.isFinite"]
2299+
},
2300+
"lodash.isinteger": {
2301+
"type": "module",
2302+
"moduleName": "lodash.isinteger",
2303+
"replacements": ["Number.isInteger"]
2304+
},
2305+
"lodash.isnan": {
2306+
"type": "module",
2307+
"moduleName": "lodash.isnan",
2308+
"replacements": ["Number.isNaN"]
2309+
},
2310+
"lodash.join": {
2311+
"type": "module",
2312+
"moduleName": "lodash.join",
2313+
"replacements": ["Array.prototype.join"]
2314+
},
2315+
"lodash.lastindexof": {
2316+
"type": "module",
2317+
"moduleName": "lodash.lastindexof",
2318+
"replacements": ["Array.prototype.lastIndexOf"]
2319+
},
22802320
"long": {
22812321
"type": "module",
22822322
"moduleName": "long",

manifests/preferred.json

Lines changed: 0 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,12 +1170,6 @@
11701170
"replacements": ["lodash-underscore", "es-toolkit"],
11711171
"url": {"type": "e18e", "id": "lodash-underscore"}
11721172
},
1173-
"lodash.isarray": {
1174-
"type": "module",
1175-
"moduleName": "lodash.isarray",
1176-
"replacements": ["lodash-underscore", "es-toolkit"],
1177-
"url": {"type": "e18e", "id": "lodash-underscore"}
1178-
},
11791173
"lodash.isarraybuffer": {
11801174
"type": "module",
11811175
"moduleName": "lodash.isarraybuffer",
@@ -1194,18 +1188,6 @@
11941188
"replacements": ["lodash-underscore", "es-toolkit"],
11951189
"url": {"type": "e18e", "id": "lodash-underscore"}
11961190
},
1197-
"lodash.isboolean": {
1198-
"type": "module",
1199-
"moduleName": "lodash.isboolean",
1200-
"replacements": ["lodash-underscore", "es-toolkit"],
1201-
"url": {"type": "e18e", "id": "lodash-underscore"}
1202-
},
1203-
"lodash.isbuffer": {
1204-
"type": "module",
1205-
"moduleName": "lodash.isbuffer",
1206-
"replacements": ["lodash-underscore", "es-toolkit"],
1207-
"url": {"type": "e18e", "id": "lodash-underscore"}
1208-
},
12091191
"lodash.isdate": {
12101192
"type": "module",
12111193
"moduleName": "lodash.isdate",
@@ -1236,30 +1218,6 @@
12361218
"replacements": ["lodash-underscore", "es-toolkit"],
12371219
"url": {"type": "e18e", "id": "lodash-underscore"}
12381220
},
1239-
"lodash.iserror": {
1240-
"type": "module",
1241-
"moduleName": "lodash.iserror",
1242-
"replacements": ["lodash-underscore", "es-toolkit"],
1243-
"url": {"type": "e18e", "id": "lodash-underscore"}
1244-
},
1245-
"lodash.isfinite": {
1246-
"type": "module",
1247-
"moduleName": "lodash.isfinite",
1248-
"replacements": ["lodash-underscore", "es-toolkit"],
1249-
"url": {"type": "e18e", "id": "lodash-underscore"}
1250-
},
1251-
"lodash.isfunction": {
1252-
"type": "module",
1253-
"moduleName": "lodash.isfunction",
1254-
"replacements": ["lodash-underscore", "es-toolkit"],
1255-
"url": {"type": "e18e", "id": "lodash-underscore"}
1256-
},
1257-
"lodash.isinteger": {
1258-
"type": "module",
1259-
"moduleName": "lodash.isinteger",
1260-
"replacements": ["lodash-underscore", "es-toolkit"],
1261-
"url": {"type": "e18e", "id": "lodash-underscore"}
1262-
},
12631221
"lodash.islength": {
12641222
"type": "module",
12651223
"moduleName": "lodash.islength",
@@ -1284,12 +1242,6 @@
12841242
"replacements": ["lodash-underscore", "es-toolkit"],
12851243
"url": {"type": "e18e", "id": "lodash-underscore"}
12861244
},
1287-
"lodash.isnan": {
1288-
"type": "module",
1289-
"moduleName": "lodash.isnan",
1290-
"replacements": ["lodash-underscore", "es-toolkit"],
1291-
"url": {"type": "e18e", "id": "lodash-underscore"}
1292-
},
12931245
"lodash.isnative": {
12941246
"type": "module",
12951247
"moduleName": "lodash.isnative",
@@ -1302,42 +1254,12 @@
13021254
"replacements": ["lodash-underscore", "es-toolkit"],
13031255
"url": {"type": "e18e", "id": "lodash-underscore"}
13041256
},
1305-
"lodash.isnull": {
1306-
"type": "module",
1307-
"moduleName": "lodash.isnull",
1308-
"replacements": ["lodash-underscore", "es-toolkit"],
1309-
"url": {"type": "e18e", "id": "lodash-underscore"}
1310-
},
1311-
"lodash.isnumber": {
1312-
"type": "module",
1313-
"moduleName": "lodash.isnumber",
1314-
"replacements": ["lodash-underscore", "es-toolkit"],
1315-
"url": {"type": "e18e", "id": "lodash-underscore"}
1316-
},
1317-
"lodash.isobject": {
1318-
"type": "module",
1319-
"moduleName": "lodash.isobject",
1320-
"replacements": ["lodash-underscore", "es-toolkit"],
1321-
"url": {"type": "e18e", "id": "lodash-underscore"}
1322-
},
13231257
"lodash.isobjectlike": {
13241258
"type": "module",
13251259
"moduleName": "lodash.isobjectlike",
13261260
"replacements": ["lodash-underscore", "es-toolkit"],
13271261
"url": {"type": "e18e", "id": "lodash-underscore"}
13281262
},
1329-
"lodash.isplainobject": {
1330-
"type": "module",
1331-
"moduleName": "lodash.isplainobject",
1332-
"replacements": ["lodash-underscore", "es-toolkit"],
1333-
"url": {"type": "e18e", "id": "lodash-underscore"}
1334-
},
1335-
"lodash.isregexp": {
1336-
"type": "module",
1337-
"moduleName": "lodash.isregexp",
1338-
"replacements": ["lodash-underscore", "es-toolkit"],
1339-
"url": {"type": "e18e", "id": "lodash-underscore"}
1340-
},
13411263
"lodash.issafeinteger": {
13421264
"type": "module",
13431265
"moduleName": "lodash.issafeinteger",
@@ -1350,30 +1272,12 @@
13501272
"replacements": ["lodash-underscore", "es-toolkit"],
13511273
"url": {"type": "e18e", "id": "lodash-underscore"}
13521274
},
1353-
"lodash.isstring": {
1354-
"type": "module",
1355-
"moduleName": "lodash.isstring",
1356-
"replacements": ["lodash-underscore", "es-toolkit"],
1357-
"url": {"type": "e18e", "id": "lodash-underscore"}
1358-
},
1359-
"lodash.issymbol": {
1360-
"type": "module",
1361-
"moduleName": "lodash.issymbol",
1362-
"replacements": ["lodash-underscore", "es-toolkit"],
1363-
"url": {"type": "e18e", "id": "lodash-underscore"}
1364-
},
13651275
"lodash.istypedarray": {
13661276
"type": "module",
13671277
"moduleName": "lodash.istypedarray",
13681278
"replacements": ["lodash-underscore", "es-toolkit"],
13691279
"url": {"type": "e18e", "id": "lodash-underscore"}
13701280
},
1371-
"lodash.isundefined": {
1372-
"type": "module",
1373-
"moduleName": "lodash.isundefined",
1374-
"replacements": ["lodash-underscore", "es-toolkit"],
1375-
"url": {"type": "e18e", "id": "lodash-underscore"}
1376-
},
13771281
"lodash.isweakmap": {
13781282
"type": "module",
13791283
"moduleName": "lodash.isweakmap",
@@ -1392,12 +1296,6 @@
13921296
"replacements": ["lodash-underscore", "es-toolkit"],
13931297
"url": {"type": "e18e", "id": "lodash-underscore"}
13941298
},
1395-
"lodash.join": {
1396-
"type": "module",
1397-
"moduleName": "lodash.join",
1398-
"replacements": ["lodash-underscore", "es-toolkit"],
1399-
"url": {"type": "e18e", "id": "lodash-underscore"}
1400-
},
14011299
"lodash.kebabcase": {
14021300
"type": "module",
14031301
"moduleName": "lodash.kebabcase",
@@ -1428,12 +1326,6 @@
14281326
"replacements": ["lodash-underscore", "es-toolkit"],
14291327
"url": {"type": "e18e", "id": "lodash-underscore"}
14301328
},
1431-
"lodash.lastindexof": {
1432-
"type": "module",
1433-
"moduleName": "lodash.lastindexof",
1434-
"replacements": ["lodash-underscore", "es-toolkit"],
1435-
"url": {"type": "e18e", "id": "lodash-underscore"}
1436-
},
14371329
"lodash.lowercase": {
14381330
"type": "module",
14391331
"moduleName": "lodash.lowercase",
@@ -1578,12 +1470,6 @@
15781470
"replacements": ["lodash-underscore", "es-toolkit"],
15791471
"url": {"type": "e18e", "id": "lodash-underscore"}
15801472
},
1581-
"lodash.noop": {
1582-
"type": "module",
1583-
"moduleName": "lodash.noop",
1584-
"replacements": ["lodash-underscore", "es-toolkit"],
1585-
"url": {"type": "e18e", "id": "lodash-underscore"}
1586-
},
15871473
"lodash.now": {
15881474
"type": "module",
15891475
"moduleName": "lodash.now",

0 commit comments

Comments
 (0)