Skip to content

Commit 60d5fab

Browse files
committed
Merge branch 'main' into feat/titleize
2 parents 7f855fb + 0b3c30d commit 60d5fab

5 files changed

Lines changed: 242 additions & 0 deletions

File tree

‎docs/modules/fftjs.md‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
description: Modern alternative to the fftjs and fft-js packages for computing Fast Fourier Transforms
3+
---
4+
5+
# Replacements for `fftjs` and `fft-js`
6+
7+
**Motivation:** `fftjs` and `fft-js` are both unmaintained and have lighter, more modern alternatives.
8+
9+
## `fft.js`
10+
11+
[`fft.js`](https://github.com/indutny/fft.js) is a dependency-free radix-4 FFT. Instead of returning new objects, it writes into preallocated arrays where complex numbers are interleaved as `[re0, im0, re1, im1, ...]`.
12+
13+
Example:
14+
15+
<!-- prettier-ignore -->
16+
```js
17+
import fftjs from 'fftjs' // [!code --]
18+
import FFT from 'fft.js' // [!code ++]
19+
20+
const signal = [1, 1, 1, 1, 0, 0, 0, 0]
21+
22+
const spectrum = fftjs.fft(signal) // { real: [...], imag: [...] } // [!code --]
23+
const f = new FFT(signal.length) // [!code ++]
24+
const spectrum = f.createComplexArray() // [!code ++]
25+
f.realTransform(spectrum, signal) // [!code ++]
26+
f.completeSpectrum(spectrum) // [re0, im0, re1, im1, ...] // [!code ++]
27+
28+
const reconstructed = fftjs.ifft(spectrum).real // [!code --]
29+
const data = f.createComplexArray() // [!code ++]
30+
f.inverseTransform(data, spectrum) // [!code ++]
31+
const reconstructed = f.fromComplexArray(data) // [!code ++]
32+
```

‎docs/modules/prop-types.md‎

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
description: Modern alternatives to the prop-types package for checking React props
3+
---
4+
5+
# Replacements for `prop-types`
6+
7+
`prop-types` is [no longer maintained](https://github.com/meta/prop-types), and React 19 [no longer runs `propTypes` checks](https://react.dev/blog/2024/04/25/react-19-upgrade-guide#removed-proptypes-and-defaultprops).
8+
9+
## TypeScript
10+
11+
[TypeScript](https://www.typescriptlang.org/) checks component props before your code runs.
12+
13+
Follow React's [TypeScript setup guide](https://react.dev/learn/typescript), then replace `propTypes` with TypeScript types:
14+
15+
Before:
16+
17+
```javascript
18+
import PropTypes from 'prop-types'
19+
20+
function Greeting({ name }) {
21+
return <p>Hello, {name}!</p>
22+
}
23+
24+
Greeting.propTypes = {
25+
name: PropTypes.string
26+
}
27+
```
28+
29+
After:
30+
31+
```typescript
32+
interface GreetingProps {
33+
name?: string
34+
}
35+
36+
function Greeting({ name }: GreetingProps) {
37+
return <p>Hello, {name}!</p>
38+
}
39+
```
40+
41+
React also provides a [codemod](https://react.dev/blog/2024/04/25/react-19-upgrade-guide#removed-proptypes-and-defaultprops) to help with the conversion:
42+
43+
```sh
44+
npx codemod@latest react/prop-types-typescript
45+
```
46+
47+
After migrating, run your type checker and remove `prop-types` from your dependencies.
48+
49+
TypeScript does not check values at runtime. If you specificaly need runtime validation, you can use a library like [zod](https://zod.dev).

‎manifests/micro-utilities.json‎

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@
4242
"description": "You can use `arr.at(-1)` if supported or `arr[arr.length - 1]` to get the last element of an array.",
4343
"example": "const last = (arr) => arr.at(-1);\n// or in older environments\nconst lastLegacy = (arr) => arr[arr.length - 1]"
4444
},
45+
"snippet::array-shallow-equal": {
46+
"id": "snippet::array-shallow-equal",
47+
"type": "simple",
48+
"description": "You can compare the lengths and then use `Array.prototype.every` to check two arrays hold the same items in the same order.",
49+
"example": "const arraysEqual = (a, b) => a === b || (a.length === b.length && a.every((value, i) => value === b[i]))"
50+
},
4551
"snippet::array-slice-exclude-last-n": {
4652
"id": "snippet::array-slice-exclude-last-n",
4753
"type": "simple",
@@ -72,12 +78,24 @@
7278
"description": "You can use `Promise.all` with `Array.prototype.map` to do an async action with an array of items.",
7379
"example": "Promise.all(items.map(asyncFn))"
7480
},
81+
"snippet::async-each-series": {
82+
"id": "snippet::async-each-series",
83+
"type": "simple",
84+
"description": "You can use a `for await...of` loop to run an async function on each item one at a time, in order. Use `break` to stop early.",
85+
"example": "for await (const item of items) {\n await fn(item);\n}"
86+
},
7587
"snippet::async-function-constructor": {
7688
"id": "snippet::async-function-constructor",
7789
"type": "simple",
7890
"description": "You can get the `AsyncFunction` using `async function`.",
7991
"example": "const AsyncFunction = (async () => {}).constructor"
8092
},
93+
"snippet::async-pipe": {
94+
"id": "snippet::async-pipe",
95+
"type": "simple",
96+
"description": "You can use a `for...of` loop to pass a value through async functions one after another, awaiting each result.",
97+
"example": "const pipe = (...fns) => async (input) => {\n let value = input;\n for (const fn of fns) {\n value = await fn(value);\n }\n return value;\n};"
98+
},
8199
"snippet::bail": {
82100
"id": "snippet::bail",
83101
"type": "simple",
@@ -324,6 +342,12 @@
324342
"description": "You can check if the current environment is SSH by checking if the `SSH_CONNECTION` environment variable is set.",
325343
"example": "Boolean(process.env.SSH_CONNECTION)"
326344
},
345+
"snippet::is-integer-array": {
346+
"id": "snippet::is-integer-array",
347+
"type": "simple",
348+
"description": "You can use `Array.isArray` and `Number.isInteger` to check that a value is a non-empty array of integers. `findIndex` treats empty slots as `undefined`, so arrays with holes are rejected.",
349+
"example": "const isIntegerArray = (value) =>\n Array.isArray(value) &&\n value.length > 0 &&\n value.findIndex((v) => !Number.isInteger(v)) === -1"
350+
},
327351
"snippet::is-interactive": {
328352
"id": "snippet::is-interactive",
329353
"type": "simple",
@@ -432,6 +456,12 @@
432456
"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.",
433457
"example": "const isPrimitive = (value) => value === null || (typeof value !== \"function\" && typeof value !== \"object\");"
434458
},
459+
"snippet::is-promise": {
460+
"id": "snippet::is-promise",
461+
"type": "simple",
462+
"description": "You can use `instanceof Promise` to check for a promise. If you also need to accept other thenables, wrap the value with `Promise.resolve()` instead of checking it.",
463+
"example": "value instanceof Promise"
464+
},
435465
"snippet::is-redirect": {
436466
"id": "snippet::is-redirect",
437467
"type": "simple",
@@ -450,6 +480,12 @@
450480
"description": "You can use `process.getuid?.()` to check if a user is a root user.",
451481
"example": "const isRootUser = process.getuid?.() === 0"
452482
},
483+
"snippet::is-scoped": {
484+
"id": "snippet::is-scoped",
485+
"type": "simple",
486+
"description": "You can use a regular expression to check whether a string is a scoped npm package name.",
487+
"example": "const isScoped = (string) => /^@[a-z\\d][\\w-.]+\\/[a-z\\d][\\w-.]*$/i.test(string)"
488+
},
453489
"snippet::is-set": {
454490
"id": "snippet::is-set",
455491
"type": "simple",
@@ -696,6 +732,12 @@
696732
"description": "You can use `/^#!(.+)/` regex.",
697733
"example": "const shebangRegex = /^#!(.+)/;"
698734
},
735+
"snippet::shorten-home-path": {
736+
"id": "snippet::shorten-home-path",
737+
"type": "simple",
738+
"description": "You can use `os.homedir()` with `path.normalize` to replace the home directory at the start of a path with `~`.",
739+
"example": "import { homedir } from 'node:os'\nimport { normalize, sep } from 'node:path'\n\nconst home = homedir()\nconst shortenHomePath = (path) => {\n const normalized = normalize(path)\n return normalized === home || normalized.startsWith(home + sep) ? '~' + normalized.slice(home.length) : normalized\n}"
740+
},
699741
"snippet::split-lines": {
700742
"id": "snippet::split-lines",
701743
"type": "simple",
@@ -714,6 +756,18 @@
714756
"description": "You can check if the first character of the string is the BOM and strip it using `String.prototype.slice` if it is.",
715757
"example": "str.charCodeAt(0) === 0xFEFF ? str.slice(1) : str;"
716758
},
759+
"snippet::strip-bom-buffer": {
760+
"id": "snippet::strip-bom-buffer",
761+
"type": "simple",
762+
"description": "You can check the first three bytes for the UTF-8 byte order mark (`EF BB BF`) and remove them with `slice`.",
763+
"example": "const stripBomBuffer = (bytes) =>\n bytes[0] === 0xef && bytes[1] === 0xbb && bytes[2] === 0xbf ? bytes.slice(3) : bytes"
764+
},
765+
"snippet::strip-surrounding-substring": {
766+
"id": "snippet::strip-surrounding-substring",
767+
"type": "simple",
768+
"description": "You can use `String.prototype.replace` with a RegExp anchored to the start and end of the string to remove a substring from both ends.",
769+
"example": "str.replace(/^foo|foo$/g, '')"
770+
},
717771
"snippet::title-case": {
718772
"id": "snippet::title-case",
719773
"type": "simple",
@@ -789,6 +843,16 @@
789843
"moduleName": "array-differ",
790844
"replacements": ["snippet::array-difference"]
791845
},
846+
"array-equal": {
847+
"type": "module",
848+
"moduleName": "array-equal",
849+
"replacements": ["snippet::array-shallow-equal"]
850+
},
851+
"array-flatten": {
852+
"type": "module",
853+
"moduleName": "array-flatten",
854+
"replacements": ["snippet::array-flatten"]
855+
},
792856
"array-ify": {
793857
"type": "module",
794858
"moduleName": "array-ify",
@@ -1214,6 +1278,11 @@
12141278
"moduleName": "is-root",
12151279
"replacements": ["snippet::is-root-user"]
12161280
},
1281+
"is-scoped": {
1282+
"type": "module",
1283+
"moduleName": "is-scoped",
1284+
"replacements": ["snippet::is-scoped"]
1285+
},
12171286
"is-set": {
12181287
"type": "module",
12191288
"moduleName": "is-set",
@@ -1489,6 +1558,21 @@
14891558
"moduleName": "object.reduce",
14901559
"replacements": ["snippet::object-reduce"]
14911560
},
1561+
"p-each-series": {
1562+
"type": "module",
1563+
"moduleName": "p-each-series",
1564+
"replacements": ["snippet::async-each-series"]
1565+
},
1566+
"p-is-promise": {
1567+
"type": "module",
1568+
"moduleName": "p-is-promise",
1569+
"replacements": ["snippet::is-promise"]
1570+
},
1571+
"p-pipe": {
1572+
"type": "module",
1573+
"moduleName": "p-pipe",
1574+
"replacements": ["snippet::async-pipe"]
1575+
},
14921576
"path-key": {
14931577
"type": "module",
14941578
"moduleName": "path-key",
@@ -1536,6 +1620,11 @@
15361620
"moduleName": "repeat-element",
15371621
"replacements": ["snippet::array-filled-with"]
15381622
},
1623+
"scoped-regex": {
1624+
"type": "module",
1625+
"moduleName": "scoped-regex",
1626+
"replacements": ["snippet::is-scoped"]
1627+
},
15391628
"set-function-length": {
15401629
"type": "module",
15411630
"moduleName": "set-function-length",
@@ -1571,11 +1660,26 @@
15711660
"moduleName": "strip-bom",
15721661
"replacements": ["snippet::strip-bom"]
15731662
},
1663+
"strip-bom-buf": {
1664+
"type": "module",
1665+
"moduleName": "strip-bom-buf",
1666+
"replacements": ["snippet::strip-bom-buffer"]
1667+
},
15741668
"strip-bom-string": {
15751669
"type": "module",
15761670
"moduleName": "strip-bom-string",
15771671
"replacements": ["snippet::strip-bom"]
15781672
},
1673+
"strip-outer": {
1674+
"type": "module",
1675+
"moduleName": "strip-outer",
1676+
"replacements": ["snippet::strip-surrounding-substring"]
1677+
},
1678+
"tildify": {
1679+
"type": "module",
1680+
"moduleName": "tildify",
1681+
"replacements": ["snippet::shorten-home-path"]
1682+
},
15791683
"titleize": {
15801684
"type": "module",
15811685
"moduleName": "titleize",
@@ -1626,6 +1730,16 @@
16261730
"moduleName": "validate.io-function",
16271731
"replacements": ["snippet::is-function"]
16281732
},
1733+
"validate.io-integer-array": {
1734+
"type": "module",
1735+
"moduleName": "validate.io-integer-array",
1736+
"replacements": ["snippet::is-integer-array"]
1737+
},
1738+
"validate.io-number": {
1739+
"type": "module",
1740+
"moduleName": "validate.io-number",
1741+
"replacements": ["snippet::is-number"]
1742+
},
16291743
"year": {
16301744
"type": "module",
16311745
"moduleName": "year",

‎manifests/native.json‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,15 @@
8181
"compatKey": "api.AbortController.AbortController"
8282
}
8383
},
84+
"AbortSignal.timeout": {
85+
"id": "AbortSignal.timeout",
86+
"type": "native",
87+
"url": {"type": "mdn", "id": "Web/API/AbortSignal/timeout_static"},
88+
"webFeatureId": {
89+
"featureId": "abortsignal-timeout",
90+
"compatKey": "api.AbortSignal.timeout_static"
91+
}
92+
},
8493
"AggregateError": {
8594
"id": "AggregateError",
8695
"type": "native",
@@ -3248,6 +3257,11 @@
32483257
"moduleName": "native-promise-only",
32493258
"replacements": ["Promise"]
32503259
},
3260+
"node-abort-controller": {
3261+
"type": "module",
3262+
"moduleName": "node-abort-controller",
3263+
"replacements": ["AbortController"]
3264+
},
32513265
"node-domexception": {
32523266
"type": "module",
32533267
"moduleName": "node-domexception",
@@ -3689,6 +3703,11 @@
36893703
"moduleName": "time-stamp",
36903704
"replacements": ["Intl.DateTimeFormat"]
36913705
},
3706+
"timeout-signal": {
3707+
"type": "module",
3708+
"moduleName": "timeout-signal",
3709+
"replacements": ["AbortSignal.timeout"]
3710+
},
36923711
"timezone-support": {
36933712
"type": "module",
36943713
"moduleName": "timezone-support",
@@ -3710,6 +3729,11 @@
37103729
"moduleName": "to-data-view",
37113730
"replacements": ["DataView"]
37123731
},
3732+
"to-readable-stream": {
3733+
"type": "module",
3734+
"moduleName": "to-readable-stream",
3735+
"replacements": ["Readable.from"]
3736+
},
37133737
"trim": {
37143738
"type": "module",
37153739
"moduleName": "trim",

‎manifests/preferred.json‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,18 @@
442442
"replacements": ["feathers-utils"],
443443
"url": {"type": "e18e", "id": "feathers-hooks-common"}
444444
},
445+
"fft-js": {
446+
"type": "module",
447+
"moduleName": "fft-js",
448+
"replacements": ["fft.js"],
449+
"url": {"type": "e18e", "id": "fftjs"}
450+
},
451+
"fftjs": {
452+
"type": "module",
453+
"moduleName": "fftjs",
454+
"replacements": ["fft.js"],
455+
"url": {"type": "e18e", "id": "fftjs"}
456+
},
445457
"find-cache-dir": {
446458
"type": "module",
447459
"moduleName": "find-cache-dir",
@@ -2478,6 +2490,12 @@
24782490
"replacements": ["package-manager-detector"],
24792491
"url": {"type": "e18e", "id": "detect-package-manager"}
24802492
},
2493+
"prop-types": {
2494+
"type": "module",
2495+
"moduleName": "prop-types",
2496+
"replacements": ["typescript"],
2497+
"url": {"type": "e18e", "id": "prop-types"}
2498+
},
24812499
"q": {
24822500
"type": "module",
24832501
"moduleName": "q",
@@ -3409,6 +3427,11 @@
34093427
"type": "documented",
34103428
"replacementModule": "fflate"
34113429
},
3430+
"fft.js": {
3431+
"id": "fft.js",
3432+
"type": "documented",
3433+
"replacementModule": "fft.js"
3434+
},
34123435
"find-proc": {
34133436
"id": "find-proc",
34143437
"type": "documented",

0 commit comments

Comments
 (0)