| Offset 1, 5 lines modified | Offset 1, 5 lines modified | ||
| 1 | Zip·file·size:·44 | 1 | Zip·file·size:·4457037·bytes,·number·of·entries:·3 |
| 2 | -rw-r--r--··4.5·unx·······30·bx·stor·26-Apr-12·10:15·metadata.json | 2 | -rw-r--r--··4.5·unx·······30·bx·stor·26-Apr-12·10:15·metadata.json |
| 3 | -rw-r--r--··4.5·unx··42 | 3 | -rw-r--r--··4.5·unx··4283980·bx·stor·26-Apr-12·10:15·pkg-cucumber-js-12.8.0-hfa286de_0.tar.zst |
| 4 | -rw-r--r--··4.5·unx···17 | 4 | -rw-r--r--··4.5·unx···172465·bx·stor·26-Apr-12·10:15·info-cucumber-js-12.8.0-hfa286de_0.tar.zst |
| 5 | 3·files,·44 | 5 | 3·files,·4456475·bytes·uncompressed,·4456475·bytes·compressed:··0.0% |
| Offset 19, 125 lines modified | Offset 19, 125 lines modified | ||
| 19 | 00005D·LOCAL·HEADER·#2·······04034B50 | 19 | 00005D·LOCAL·HEADER·#2·······04034B50 |
| 20 | 000061·Extract·Zip·Spec······2D·'4.5' | 20 | 000061·Extract·Zip·Spec······2D·'4.5' |
| 21 | 000062·Extract·OS············00·'MS-DOS' | 21 | 000062·Extract·OS············00·'MS-DOS' |
| 22 | 000063·General·Purpose·Flag··0000 | 22 | 000063·General·Purpose·Flag··0000 |
| 23 | 000065·Compression·Method····0000·'Stored' | 23 | 000065·Compression·Method····0000·'Stored' |
| 24 | 000067·Last·Mod·Time·········5C8C51E7·'Sun·Apr·12·10:15:14·2026' | 24 | 000067·Last·Mod·Time·········5C8C51E7·'Sun·Apr·12·10:15:14·2026' |
| 25 | 00006B·CRC··················· | 25 | 00006B·CRC···················B3B83388 |
| 26 | 00006F·Compressed·Length·····FFFFFFFF | 26 | 00006F·Compressed·Length·····FFFFFFFF |
| 27 | 000073·Uncompressed·Length···FFFFFFFF | 27 | 000073·Uncompressed·Length···FFFFFFFF |
| 28 | 000077·Filename·Length·······0029 | 28 | 000077·Filename·Length·······0029 |
| 29 | 000079·Extra·Length··········0014 | 29 | 000079·Extra·Length··········0014 |
| 30 | 00007B·Filename··············'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | 30 | 00007B·Filename··············'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX |
| 31 | ·····························XX' | 31 | ·····························XX' |
| 32 | 0000A4·Extra·ID·#0001········0001·'ZIP64' | 32 | 0000A4·Extra·ID·#0001········0001·'ZIP64' |
| 33 | 0000A6···Length··············0010 | 33 | 0000A6···Length··············0010 |
| 34 | 0000A8···Uncompressed·Size···000000000041 | 34 | 0000A8···Uncompressed·Size···0000000000415E4C |
| 35 | 0000B0···Compressed·Size·····000000000041 | 35 | 0000B0···Compressed·Size·····0000000000415E4C |
| 36 | 0000B8·PAYLOAD | 36 | 0000B8·PAYLOAD |
| 37 | 41 | 37 | 415F04·LOCAL·HEADER·#3·······04034B50 |
| 38 | 41 | 38 | 415F08·Extract·Zip·Spec······2D·'4.5' |
| 39 | 41 | 39 | 415F09·Extract·OS············00·'MS-DOS' |
| 40 | 41 | 40 | 415F0A·General·Purpose·Flag··0000 |
| 41 | 41 | 41 | 415F0C·Compression·Method····0000·'Stored' |
| 42 | 41 | 42 | 415F0E·Last·Mod·Time·········5C8C51E7·'Sun·Apr·12·10:15:14·2026' |
| 43 | 41 | 43 | 415F12·CRC···················C113473C |
| 44 | 41 | 44 | 415F16·Compressed·Length·····FFFFFFFF |
| 45 | 41 | 45 | 415F1A·Uncompressed·Length···FFFFFFFF |
| 46 | 41 | 46 | 415F1E·Filename·Length·······002A |
| 47 | 41 | 47 | 415F20·Extra·Length··········0014 |
| 48 | 41 | 48 | 415F22·Filename··············'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX |
| 49 | ·····························XXX' | 49 | ·····························XXX' |
| 50 | 41 | 50 | 415F4C·Extra·ID·#0001········0001·'ZIP64' |
| 51 | 41 | 51 | 415F4E···Length··············0010 |
| 52 | 41 | 52 | 415F50···Uncompressed·Size···000000000002A1B1 |
| 53 | 41 | 53 | 415F58···Compressed·Size·····000000000002A1B1 |
| 54 | 41 | 54 | 415F60·PAYLOAD |
| 55 | 44 | 55 | 440111·CENTRAL·HEADER·#1·····02014B50 |
| 56 | 44 | 56 | 440115·Created·Zip·Spec······2D·'4.5' |
| 57 | 44 | 57 | 440116·Created·OS············03·'Unix' |
| 58 | 441 | 58 | 440117·Extract·Zip·Spec······2D·'4.5' |
| 59 | 44 | 59 | 440118·Extract·OS············00·'MS-DOS' |
| 60 | 44 | 60 | 440119·General·Purpose·Flag··0000 |
| 61 | 44 | 61 | 44011B·Compression·Method····0000·'Stored' |
| 62 | 44 | 62 | 44011D·Last·Mod·Time·········5C8C51E7·'Sun·Apr·12·10:15:14·2026' |
| 63 | 44 | 63 | 440121·CRC···················2E6500CB |
| 64 | 44 | 64 | 440125·Compressed·Length·····FFFFFFFF |
| 65 | 44 | 65 | 440129·Uncompressed·Length···FFFFFFFF |
| 66 | 44 | 66 | 44012D·Filename·Length·······000D |
| 67 | 44 | 67 | 44012F·Extra·Length··········0014 |
| 68 | 44 | 68 | 440131·Comment·Length········0000 |
| 69 | 44 | 69 | 440133·Disk·Start············0000 |
| 70 | 44 | 70 | 440135·Int·File·Attributes···0000 |
| 71 | ·······[Bit·0]···············0·'Binary·Data' | 71 | ·······[Bit·0]···············0·'Binary·Data' |
| 72 | 44 | 72 | 440137·Ext·File·Attributes···81A40000 |
| 73 | 44 | 73 | 44013B·Local·Header·Offset···00000000 |
| 74 | 44 | 74 | 44013F·Filename··············'XXXXXXXXXXXXX' |
| 75 | 44 | 75 | 44014C·Extra·ID·#0001········0001·'ZIP64' |
| 76 | 44 | 76 | 44014E···Length··············0010 |
| 77 | 44 | 77 | 440150···Uncompressed·Size···000000000000001E |
| 78 | 44 | 78 | 440158···Compressed·Size·····000000000000001E |
| 79 | 44 | 79 | 440160·CENTRAL·HEADER·#2·····02014B50 |
| 80 | 44 | 80 | 440164·Created·Zip·Spec······2D·'4.5' |
| 81 | 44 | 81 | 440165·Created·OS············03·'Unix' |
| 82 | 44 | 82 | 440166·Extract·Zip·Spec······2D·'4.5' |
| 83 | 44 | 83 | 440167·Extract·OS············00·'MS-DOS' |
| 84 | 44 | 84 | 440168·General·Purpose·Flag··0000 |
| 85 | 44 | 85 | 44016A·Compression·Method····0000·'Stored' |
| 86 | 44 | 86 | 44016C·Last·Mod·Time·········5C8C51E7·'Sun·Apr·12·10:15:14·2026' |
| 87 | 44 | 87 | 440170·CRC···················B3B83388 |
| 88 | 44 | 88 | 440174·Compressed·Length·····FFFFFFFF |
| 89 | 44 | 89 | 440178·Uncompressed·Length···FFFFFFFF |
| 90 | 44 | 90 | 44017C·Filename·Length·······0029 |
| 91 | 441 | 91 | 44017E·Extra·Length··········0014 |
| 92 | 44 | 92 | 440180·Comment·Length········0000 |
| 93 | 44 | 93 | 440182·Disk·Start············0000 |
| 94 | 44 | 94 | 440184·Int·File·Attributes···0000 |
| 95 | ·······[Bit·0]···············0·'Binary·Data' | 95 | ·······[Bit·0]···············0·'Binary·Data' |
| 96 | 44 | 96 | 440186·Ext·File·Attributes···81A40000 |
| 97 | 44 | 97 | 44018A·Local·Header·Offset···0000005D |
| 98 | 44 | 98 | 44018E·Filename··············'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX |
| 99 | ·····························XX' | 99 | ·····························XX' |
| 100 | 44 | 100 | 4401B7·Extra·ID·#0001········0001·'ZIP64' |
| 101 | 44 | 101 | 4401B9···Length··············0010 |
| 102 | 44 | 102 | 4401BB···Uncompressed·Size···0000000000415E4C |
| 103 | 441C | 103 | 4401C3···Compressed·Size·····0000000000415E4C |
| 104 | 441C | 104 | 4401CB·CENTRAL·HEADER·#3·····02014B50 |
| 105 | 441C | 105 | 4401CF·Created·Zip·Spec······2D·'4.5' |
| 106 | 44 | 106 | 4401D0·Created·OS············03·'Unix' |
| 107 | 44 | 107 | 4401D1·Extract·Zip·Spec······2D·'4.5' |
| 108 | 44 | 108 | 4401D2·Extract·OS············00·'MS-DOS' |
| 109 | 441 | 109 | 4401D3·General·Purpose·Flag··0000 |
| 110 | 44 | 110 | 4401D5·Compression·Method····0000·'Stored' |
| 111 | 44 | 111 | 4401D7·Last·Mod·Time·········5C8C51E7·'Sun·Apr·12·10:15:14·2026' |
| 112 | 44 | 112 | 4401DB·CRC···················C113473C |
| Max diff block lines reached; 1271/8866 bytes (14.34%) of diff not shown. | |||
| Offset 2108, 36 lines modified | Offset 2108, 46 lines modified | ||
| 2108 | -rw-r--r--···0········0········0····58538·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/commonjs/index.d.ts | 2108 | -rw-r--r--···0········0········0····58538·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/commonjs/index.d.ts |
| 2109 | -rw-r--r--···0········0········0····15009·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/commonjs/index.d.ts.map | 2109 | -rw-r--r--···0········0········0····15009·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/commonjs/index.d.ts.map |
| 2110 | -rw-r--r--···0········0········0····61256·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/commonjs/index.js | 2110 | -rw-r--r--···0········0········0····61256·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/commonjs/index.js |
| 2111 | -rw-r--r--···0········0········0···153302·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/commonjs/index.js.map | 2111 | -rw-r--r--···0········0········0···153302·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/commonjs/index.js.map |
| 2112 | -rw-r--r--···0········0········0····18911·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/commonjs/index.min.js | 2112 | -rw-r--r--···0········0········0····18911·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/commonjs/index.min.js |
| 2113 | -rw-r--r--···0········0········0···132070·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/commonjs/index.min.js.map | 2113 | -rw-r--r--···0········0········0···132070·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/commonjs/index.min.js.map |
| 2114 | -rw-r--r--···0········0········0·······25·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/commonjs/package.json | 2114 | -rw-r--r--···0········0········0·······25·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/commonjs/package.json |
| 2115 | -rw-r--r--···0········0········0······361·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/browser/diagnostics-channel-browser.d.mts.map | ||
| 2116 | -rw-r--r--···0········0········0······725·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/browser/diagnostics-channel-browser.mjs.map | ||
| 2117 | -rw-r--r--···0········0········0······280·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/browser/diagnostics-channel.d.ts | ||
| 2118 | -rw-r--r--···0········0········0······157·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/browser/diagnostics-channel.js | ||
| 2119 | -rw-r--r--···0········0········0····58538·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/browser/index.d.ts | ||
| 2120 | -rw-r--r--···0········0········0····15012·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/browser/index.d.ts.map | ||
| 2121 | -rw-r--r--···0········0········0····60571·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/browser/index.js | ||
| 2122 | -rw-r--r--···0········0········0···153310·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/browser/index.js.map | ||
| 2123 | -rw-r--r--···0········0········0····18378·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/browser/index.min.js | ||
| 2124 | -rw-r--r--···0········0········0···131773·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/browser/index.min.js.map | ||
| 2115 | -rw-r--r--···0········0········0······350·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/diagnostics-channel-esm.d.mts.map | 2125 | -rw-r--r--···0········0········0······350·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/diagnostics-channel-esm.d.mts.map |
| 2116 | -rw-r--r--···0········0········0·····16 | 2126 | -rw-r--r--···0········0········0·····1686·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/diagnostics-channel-esm.mjs.map |
| 2117 | -rw-r--r--···0········0········0······272·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/diagnostics-channel.d.ts | 2127 | -rw-r--r--···0········0········0······272·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/diagnostics-channel.d.ts |
| 2118 | -rw-r--r--···0········0········0······780·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/diagnostics-channel.js | 2128 | -rw-r--r--···0········0········0······780·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/diagnostics-channel.js |
| 2119 | -rw-r--r--···0········0········0····58538·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/index.d.ts | 2129 | -rw-r--r--···0········0········0····58538·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/index.d.ts |
| 2120 | -rw-r--r--···0········0········0····15009·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/index.d.ts.map | 2130 | -rw-r--r--···0········0········0····15009·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/index.d.ts.map |
| 2121 | -rw-r--r--···0········0········0····60571·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/index.js | 2131 | -rw-r--r--···0········0········0····60571·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/index.js |
| 2122 | -rw-r--r--···0········0········0···153307·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/index.js.map | 2132 | -rw-r--r--···0········0········0···153307·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/index.js.map |
| 2123 | -rw-r--r--···0········0········0····18503·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/index.min.js | 2133 | -rw-r--r--···0········0········0····18503·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/index.min.js |
| 2124 | -rw-r--r--···0········0········0···1325 | 2134 | -rw-r--r--···0········0········0···132595·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/index.min.js.map |
| 2125 | -rw-r--r--···0········0········0······351·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/node/diagnostics-channel-node.d.mts.map | 2135 | -rw-r--r--···0········0········0······351·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/node/diagnostics-channel-node.d.mts.map |
| 2126 | -rw-r--r--···0········0········0······886·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/node/diagnostics-channel-node.mjs.map | 2136 | -rw-r--r--···0········0········0······886·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/node/diagnostics-channel-node.mjs.map |
| 2127 | -rw-r--r--···0········0········0······272·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/node/diagnostics-channel.d.ts | 2137 | -rw-r--r--···0········0········0······272·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/node/diagnostics-channel.d.ts |
| 2128 | -rw-r--r--···0········0········0······403·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/node/diagnostics-channel.js | 2138 | -rw-r--r--···0········0········0······403·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/node/diagnostics-channel.js |
| 2129 | -rw-r--r--···0········0········0····58538·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/node/index.d.ts | 2139 | -rw-r--r--···0········0········0····58538·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/node/index.d.ts |
| 2130 | -rw-r--r--···0········0········0····15012·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/node/index.d.ts.map | 2140 | -rw-r--r--···0········0········0····15012·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/node/index.d.ts.map |
| 2131 | -rw-r--r--···0········0········0····60571·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/node/index.js | 2141 | -rw-r--r--···0········0········0····60571·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/node/index.js |
| 2132 | -rw-r--r--···0········0········0···153310·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/node/index.js.map | 2142 | -rw-r--r--···0········0········0···153310·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/node/index.js.map |
| 2133 | -rw-r--r--···0········0········0····18461·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/node/index.min.js | 2143 | -rw-r--r--···0········0········0····18461·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/node/index.min.js |
| 2134 | -rw-r--r--···0········0········0···131917·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/node/index.min.js.map | 2144 | -rw-r--r--···0········0········0···131917·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/node/index.min.js.map |
| 2135 | -rw-r--r--···0········0········0·······23·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/package.json | 2145 | -rw-r--r--···0········0········0·······23·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/package.json |
| 2136 | -rw-r--r--···0········0········0····· | 2146 | -rw-r--r--···0········0········0·····3424·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/package.json |
| 2137 | -rw-r--r--···0········0········0·····1076·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/luxon/LICENSE.md | 2147 | -rw-r--r--···0········0········0·····1076·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/luxon/LICENSE.md |
| 2138 | -rw-r--r--···0········0········0·····2052·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/luxon/README.md | 2148 | -rw-r--r--···0········0········0·····2052·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/luxon/README.md |
| 2139 | -rw-r--r--···0········0········0···318802·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/luxon/build/amd/luxon.js | 2149 | -rw-r--r--···0········0········0···318802·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/luxon/build/amd/luxon.js |
| 2140 | -rw-r--r--···0········0········0···547661·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/luxon/build/amd/luxon.js.map | 2150 | -rw-r--r--···0········0········0···547661·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/luxon/build/amd/luxon.js.map |
| 2141 | -rw-r--r--···0········0········0···302122·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/luxon/build/cjs-browser/luxon.js | 2151 | -rw-r--r--···0········0········0···302122·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/luxon/build/cjs-browser/luxon.js |
| 2142 | -rw-r--r--···0········0········0···547657·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/luxon/build/cjs-browser/luxon.js.map | 2152 | -rw-r--r--···0········0········0···547657·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/luxon/build/cjs-browser/luxon.js.map |
| 2143 | -rw-r--r--···0········0········0···262085·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/luxon/build/es6/luxon.mjs | 2153 | -rw-r--r--···0········0········0···262085·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/luxon/build/es6/luxon.mjs |
| Offset 2400, 433 lines modified | Offset 2410, 439 lines modified | ||
| 2400 | -rw-r--r--···0········0········0·····1443·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/property-expr/compiler.js | 2410 | -rw-r--r--···0········0········0·····1443·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/property-expr/compiler.js |
| 2401 | -rw-r--r--···0········0········0······661·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/property-expr/index.d.ts | 2411 | -rw-r--r--···0········0········0······661·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/property-expr/index.d.ts |
| 2402 | -rw-r--r--···0········0········0·····3439·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/property-expr/index.js | 2412 | -rw-r--r--···0········0········0·····3439·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/property-expr/index.js |
| 2403 | -rw-r--r--···0········0········0······700·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/property-expr/package.json | 2413 | -rw-r--r--···0········0········0······700·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/property-expr/package.json |
| 2404 | -rw-r--r--···0········0········0·····1833·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/index.d.ts | 2414 | -rw-r--r--···0········0········0·····1833·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/index.d.ts |
| 2405 | -rw-r--r--···0········0········0······626·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/index.js | 2415 | -rw-r--r--···0········0········0······626·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/index.js |
| 2406 | -rw-r--r--···0········0········0·····1117·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/license | 2416 | -rw-r--r--···0········0········0·····1117·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/license |
| 2407 | -rw-r--r--···0········0········0····12 | 2417 | -rw-r--r--···0········0········0····12928·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/index.d.ts |
| 2408 | -rw-r--r--···0········0········0·····7048·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/license-cc0 | 2418 | -rw-r--r--···0········0········0·····7048·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/license-cc0 |
| 2409 | -rw-r--r--···0········0········0·····1117·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/license-mit | 2419 | -rw-r--r--···0········0········0·····1117·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/license-mit |
| 2410 | -rw-r--r--···0········0········0·····1 | 2420 | -rw-r--r--···0········0········0·····1654·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/package.json |
| 2411 | -rw-r--r--···0········0········0····62 | 2421 | -rw-r--r--···0········0········0····62264·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/readme.md |
| 2422 | -rw-r--r--···0········0········0·····1000·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/absolute.d.ts | ||
| 2412 | -rw-r--r--···0········0········0·····3343·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/all-extend.d.ts | 2423 | -rw-r--r--···0········0········0·····3343·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/all-extend.d.ts |
| 2413 | -rw-r--r--···0········0········0·····2 | 2424 | -rw-r--r--···0········0········0·····2462·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/all-union-fields.d.ts |
| 2414 | -rw-r--r--···0········0········0·····2050·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/and-all.d.ts | 2425 | -rw-r--r--···0········0········0·····2050·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/and-all.d.ts |
| 2415 | -rw-r--r--···0········0········0·····150 | 2426 | -rw-r--r--···0········0········0·····1509·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/and.d.ts |
| 2416 | -rw-r--r--···0········0········0·····1219·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/array-element.d.ts | 2427 | -rw-r--r--···0········0········0·····1219·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/array-element.d.ts |
| 2417 | -rw-r--r--···0········0········0······737·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/array-indices.d.ts | 2428 | -rw-r--r--···0········0········0······737·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/array-indices.d.ts |
| 2418 | -rw-r--r--···0········0········0······882·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/array-length.d.ts | 2429 | -rw-r--r--···0········0········0······882·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/array-length.d.ts |
| 2419 | -rw-r--r--···0········0········0·····3170·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/array-reverse.d.ts | 2430 | -rw-r--r--···0········0········0·····3170·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/array-reverse.d.ts |
| 2420 | -rw-r--r--···0········0········0·····4320·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/array-slice.d.ts | 2431 | -rw-r--r--···0········0········0·····4320·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/array-slice.d.ts |
| 2421 | -rw-r--r--···0········0········0·····31 | 2432 | -rw-r--r--···0········0········0·····3171·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/array-splice.d.ts |
| 2422 | -rw-r--r--···0········0········0·····1873·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/array-tail.d.ts | 2433 | -rw-r--r--···0········0········0·····1873·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/array-tail.d.ts |
| 2423 | -rw-r--r--···0········0········0······660·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/array-values.d.ts | 2434 | -rw-r--r--···0········0········0······660·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/array-values.d.ts |
| 2424 | -rw-r--r--···0········0········0······668·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/arrayable.d.ts | 2435 | -rw-r--r--···0········0········0······668·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/arrayable.d.ts |
| 2425 | -rw-r--r--···0········0········0······762·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/async-return-type.d.ts | 2436 | -rw-r--r--···0········0········0······762·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/async-return-type.d.ts |
| 2426 | -rw-r--r--···0········0········0······859·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/asyncify.d.ts | 2437 | -rw-r--r--···0········0········0······859·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/asyncify.d.ts |
| 2427 | -rw-r--r--···0········0········0·····1293·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/basic.d.ts | 2438 | -rw-r--r--···0········0········0·····1293·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/basic.d.ts |
| 2428 | -rw-r--r--···0········0········0····· | 2439 | -rw-r--r--···0········0········0·····3403·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/camel-case.d.ts |
| 2429 | -rw-r--r--···0········0········0·····2 | 2440 | -rw-r--r--···0········0········0·····2942·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/camel-cased-properties-deep.d.ts |
| 2430 | -rw-r--r--···0········0········0·····1 | 2441 | -rw-r--r--···0········0········0·····1211·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/camel-cased-properties.d.ts |
| 2431 | -rw-r--r--···0········0········0·····1655·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/characters.d.ts | 2442 | -rw-r--r--···0········0········0·····1655·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/characters.d.ts |
| 2432 | -rw-r--r--···0········0········0·····1124·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/conditional-except.d.ts | 2443 | -rw-r--r--···0········0········0·····1124·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/conditional-except.d.ts |
| 2433 | -rw-r--r--···0········0········0·····1810·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/conditional-keys.d.ts | 2444 | -rw-r--r--···0········0········0·····1810·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/conditional-keys.d.ts |
| 2434 | -rw-r--r--···0········0········0·····3195·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/conditional-pick-deep.d.ts | 2445 | -rw-r--r--···0········0········0·····3195·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/conditional-pick-deep.d.ts |
| 2435 | -rw-r--r--···0········0········0·····1167·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/conditional-pick.d.ts | 2446 | -rw-r--r--···0········0········0·····1167·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/conditional-pick.d.ts |
| 2436 | -rw-r--r--···0········0········0·····1294·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/conditional-simplify-deep.d.ts | 2447 | -rw-r--r--···0········0········0·····1294·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/conditional-simplify-deep.d.ts |
| 2437 | -rw-r--r--···0········0········0·····1199·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/conditional-simplify.d.ts | 2448 | -rw-r--r--···0········0········0·····1199·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/conditional-simplify.d.ts |
| 2438 | -rw-r--r--···0········0········0·····2 | 2449 | -rw-r--r--···0········0········0·····2236·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/delimiter-case.d.ts |
| 2439 | -rw-r--r--···0········0········0·····3 | 2450 | -rw-r--r--···0········0········0·····3499·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/delimiter-cased-properties-deep.d.ts |
| 2440 | -rw-r--r--···0········0········0·····1 | 2451 | -rw-r--r--···0········0········0·····1325·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/delimiter-cased-properties.d.ts |
| 2441 | -rw-r--r--···0········0········0·····2407·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/distributed-omit.d.ts | 2452 | -rw-r--r--···0········0········0·····2407·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/distributed-omit.d.ts |
| 2442 | -rw-r--r--···0········0········0·····2248·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/distributed-pick.d.ts | 2453 | -rw-r--r--···0········0········0·····2248·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/distributed-pick.d.ts |
| 2443 | -rw-r--r--···0········0········0·····158 | 2454 | -rw-r--r--···0········0········0·····1587·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/empty-object.d.ts |
| 2444 | -rw-r--r--···0········0········0·····2 | 2455 | -rw-r--r--···0········0········0·····2495·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/entries.d.ts |
| 2445 | -rw-r--r--···0········0········0·····2 | 2456 | -rw-r--r--···0········0········0·····2769·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/entry.d.ts |
| 2446 | -rw-r--r--···0········0········0·····3473·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/exact.d.ts | 2457 | -rw-r--r--···0········0········0·····3473·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/exact.d.ts |
| 2447 | -rw-r--r--···0········0········0·····3393·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/except.d.ts | 2458 | -rw-r--r--···0········0········0·····3393·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/except.d.ts |
| 2448 | -rw-r--r--···0········0········0·····1808·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/exclude-exactly.d.ts | 2459 | -rw-r--r--···0········0········0·····1808·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/exclude-exactly.d.ts |
| 2449 | -rw-r--r--···0········0········0·····1168·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/exclude-rest-element.d.ts | 2460 | -rw-r--r--···0········0········0·····1168·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/exclude-rest-element.d.ts |
| 2450 | -rw-r--r--···0········0········0·····1781·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/exclude-strict.d.ts | 2461 | -rw-r--r--···0········0········0·····1781·2026-04-12·10:15:14.000000·lib/node_modules/@cucumber/cucumber/node_modules/read-package-up/node_modules/type-fest/source/exclude-strict.d.ts |
| Max diff block lines reached; 93296/113250 bytes (82.38%) of diff not shown. | |||
| Offset 1, 10 lines modified | Offset 1, 10 lines modified | ||
| 1 | { | 1 | { |
| 2 | ····"file":·"diagnostics-channel-esm.d.mts", | 2 | ····"file":·"diagnostics-channel-esm.d.mts", |
| 3 | ····"mappings":·"AA | 3 | ····"mappings":·"AAGA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,cAAc,EACpB,MAAM,0BAA0B,CAAA;AACjC,YAAY,EAAE,cAAc,EAAE,OAAO,EAAE,CAAA;AAavC,eAAO,IAAI,OAAO,EAAY,OAAO,CAAC,OAAO,CAAC,CAAA;AAC9C,eAAO,IAAI,OAAO,EAAY,cAAc,CAAC,OAAO,CAAC,CAAA", |
| 4 | ····"names":·[], | 4 | ····"names":·[], |
| 5 | ····"sourceRoot":·"", | 5 | ····"sourceRoot":·"", |
| 6 | ····"sources":·[ | 6 | ····"sources":·[ |
| 7 | ········"../../src/diagnostics-channel-esm.mts" | 7 | ········"../../src/diagnostics-channel-esm.mts" |
| 8 | ····], | 8 | ····], |
| 9 | ····"version":·3 | 9 | ····"version":·3 |
| 10 | } | 10 | } |
| Offset 1, 13 lines modified | Offset 1, 13 lines modified | ||
| 1 | { | 1 | { |
| 2 | ····"file":·"diagnostics-channel-esm.mjs", | 2 | ····"file":·"diagnostics-channel-esm.mjs", |
| 3 | ····"mappings":·"AA | 3 | ····"mappings":·"AASA;;;;;GAKG;AAEH,uEAAuE;AACvE,4EAA4E;AAC5E,oBAAoB;AACpB,MAAM,KAAK,GAAG,EAAE,cAAc,EAAE,KAAK,EAAE,CAAA;AACvC,MAAM,CAAC,IAAI,OAAO,GAAG,KAAyB,CAAA;AAC9C,MAAM,CAAC,IAAI,OAAO,GAAG,KAAgC,CAAA;AACrD,MAAM,CAAC,0BAA0B,CAAC;KAC/B,IAAI,CAAC,EAAE,CAAC,EAAE;IACT,OAAO,GAAG,EAAE,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAA;IACzC,OAAO,GAAG,EAAE,CAAC,cAAc,CAAC,WAAW,CAAC,CAAA;AAC1C,CAAC,CAAC;KACD,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA", |
| 4 | ····"names":·[], | 4 | ····"names":·[], |
| 5 | ····"sourceRoot":·"", | 5 | ····"sourceRoot":·"", |
| 6 | ····"sources":·[ | 6 | ····"sources":·[ |
| 7 | ········"../../src/diagnostics-channel-esm.mts" | 7 | ········"../../src/diagnostics-channel-esm.mts" |
| 8 | ····], | 8 | ····], |
| 9 | ····"sourcesContent":·[ | 9 | ····"sourcesContent":·[ |
| 10 | ········"//·this·is·used·in·ESM·environments· | 10 | ········"//·this·is·used·in·ESM·environments·that·do·not·follow·the·'node'·import\n//·condition.·So,·`node:diagnostics_channel`·MAY·be·present,·but·might·not.\n//·Eg:·browsers,·webpack,·react-native,·etc.\nimport·{\n··type·Channel,\n··type·TracingChannel,\n}·from·'node:diagnostics_channel'\nexport·ty[·...·truncated·by·diffoscope;·len:·474,·SHA:·1a12ff0b7822e8e0eb8258771c0c182c8153a05afc79ba6f937590059b80a43d·...·]·check\n/*·v8·ignore·next·*/\nconst·dummy·=·{·hasSubscribers:·false·}\nexport·let·metrics·=·dummy·as·Channel<unknown>\nexport·let·tracing·=·dummy·as·TracingChannel<unknown>\nimport('node:diagnostics_channel')\n··.then(dc·=>·{\n····metrics·=·dc.channel('lru-cache:metrics')\n····tracing·=·dc.tracingChannel('lru-cache')\n··})\n··.catch(()·=>·{})\n" |
| 11 | ····], | 11 | ····], |
| 12 | ····"version":·3 | 12 | ····"version":·3 |
| 13 | } | 13 | } |
| Offset 20, 15 lines modified | Offset 20, 15 lines modified | ||
| 00000130:·7920·696d·706f·7274·2066·726f·6d20·6469··y·import·from·di | 00000130:·7920·696d·706f·7274·2066·726f·6d20·6469··y·import·from·di | ||
| 00000140:·6167·6e6f·7374·6963·5f63·6861·6e6e·656c··agnostic_channel | 00000140:·6167·6e6f·7374·6963·5f63·6861·6e6e·656c··agnostic_channel | ||
| 00000150:·2c20·6661·6c6c·2062·6163·6b20·746f·2064··,·fall·back·to·d | 00000150:·2c20·6661·6c6c·2062·6163·6b20·746f·2064··,·fall·back·to·d | ||
| 00000160:·756d·6d79·6669·6c6c·0a2f·2f20·616c·6c20··ummyfill.//·all· | 00000160:·756d·6d79·6669·6c6c·0a2f·2f20·616c·6c20··ummyfill.//·all· | ||
| 00000170:·7765·2061·6374·7561·6c6c·7920·6861·7665··we·actually·have | 00000170:·7765·2061·6374·7561·6c6c·7920·6861·7665··we·actually·have | ||
| 00000180:·2074·6f20·6d6f·636b·2069·7320·7468·6520···to·mock·is·the· | 00000180:·2074·6f20·6d6f·636b·2069·7320·7468·6520···to·mock·is·the· | ||
| 00000190:·6861·7353·7562·7363·7269·6265·7273·2c20··hasSubscribers,· | 00000190:·6861·7353·7562·7363·7269·6265·7273·2c20··hasSubscribers,· | ||
| 000001a0:·7369·6e63·6520·7765·2061·6c77·617 | 000001a0:·7369·6e63·6520·7765·2061·6c77·6179·7320··since·we·always· | ||
| 000001b0:·6368·6563·6b0a·2f2a·2076·3820·6967·6e6f··check./*·v8·igno | 000001b0:·6368·6563·6b0a·2f2a·2076·3820·6967·6e6f··check./*·v8·igno | ||
| 000001c0:·7265·206e·6578·7420·2a2f·0a63·6f6e·7374··re·next·*/.const | 000001c0:·7265·206e·6578·7420·2a2f·0a63·6f6e·7374··re·next·*/.const | ||
| 000001d0:·2064·756d·6d79·203d·207b·2068·6173·5375···dummy·=·{·hasSu | 000001d0:·2064·756d·6d79·203d·207b·2068·6173·5375···dummy·=·{·hasSu | ||
| 000001e0:·6273·6372·6962·6572·733a·2066·616c·7365··bscribers:·false | 000001e0:·6273·6372·6962·6572·733a·2066·616c·7365··bscribers:·false | ||
| 000001f0:·207d·3b0a·6578·706f·7274·206c·6574·206d···};.export·let·m | 000001f0:·207d·3b0a·6578·706f·7274·206c·6574·206d···};.export·let·m | ||
| 00000200:·6574·7269·6373·203d·2064·756d·6d79·3b0a··etrics·=·dummy;. | 00000200:·6574·7269·6373·203d·2064·756d·6d79·3b0a··etrics·=·dummy;. | ||
| 00000210:·6578·706f·7274·206c·6574·2074·7261·6369··export·let·traci | 00000210:·6578·706f·7274·206c·6574·2074·7261·6369··export·let·traci |
| Offset 1, 9 lines modified | Offset 1, 9 lines modified | ||
| 1 | { | 1 | { |
| 2 | ····"mappings":·"AA | 2 | ····"mappings":·"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", |
| 3 | ····"names":·[ | 3 | ····"names":·[ |
| 4 | ········"dummy", | 4 | ········"dummy", |
| 5 | ········"metrics", | 5 | ········"metrics", |
| 6 | ········"tracing", | 6 | ········"tracing", |
| 7 | ········"dc", | 7 | ········"dc", |
| 8 | ········"hasSubscribers", | 8 | ········"hasSubscribers", |
| 9 | ········"metrics", | 9 | ········"metrics", |
| Offset 185, 12 lines modified | Offset 185, 12 lines modified | ||
| 185 | ········"ni" | 185 | ········"ni" |
| 186 | ····], | 186 | ····], |
| 187 | ····"sources":·[ | 187 | ····"sources":·[ |
| 188 | ········"../../src/diagnostics-channel-esm.mts", | 188 | ········"../../src/diagnostics-channel-esm.mts", |
| 189 | ········"../../src/index.ts" | 189 | ········"../../src/index.ts" |
| 190 | ····], | 190 | ····], |
| 191 | ····"sourcesContent":·[ | 191 | ····"sourcesContent":·[ |
| 192 | ········"//·this·is·used·in·ESM·environments· | 192 | ········"//·this·is·used·in·ESM·environments·that·do·not·follow·the·'node'·import\n//·condition.·So,·`node:diagnostics_channel`·MAY·be·present,·but·might·not.\n//·Eg:·browsers,·webpack,·react-native,·etc.\nimport·{\n··type·Channel,\n··type·TracingChannel,\n}·from·'node:diagnostics_channel'\nexport·ty[·...·truncated·by·diffoscope;·len:·474,·SHA:·1a12ff0b7822e8e0eb8258771c0c182c8153a05afc79ba6f937590059b80a43d·...·]·check\n/*·v8·ignore·next·*/\nconst·dummy·=·{·hasSubscribers:·false·}\nexport·let·metrics·=·dummy·as·Channel<unknown>\nexport·let·tracing·=·dummy·as·TracingChannel<unknown>\nimport('node:diagnostics_channel')\n··.then(dc·=>·{\n····metrics·=·dc.channel('lru-cache:metrics')\n····tracing·=·dc.tracingChannel('lru-cache')\n··})\n··.catch(()·=>·{})\n", |
| 193 | ········"/**\n·*·@module·LRUCache\n·*/\n\nimport·{·metrics,·tracing·}·from·'./diagnostics-channel.js'\n\nconst·hasSubscribers·=·()·=>\n··metrics.hasSubscribers·||·tracing.hasSubscribers\n\n//·module-private·names·and·types\n//·this·provides·the·default·Perf·object·source.\n//·it·can·be·passed·in·via·configuration·to·override·it\n//·for·a·single·LRU·object.\nexport·type·Perf·=·{·now:·()·=>·number·}\nconst·defaultPerf:·Perf·=\n··(\n····typeof·performance·===·'object'·&&\n····performance·&&\n····typeof·performance.now·===·'function'\n··)·?\n····performance\n··:·Date\n\nconst·warned·=·new·Set<string>()\n\n//·either·a·function·or·a·class\n//·oxlint-disable-next-line·no-explicit-any\ntype·ForC·=·((...a:·any[])·=>·any)·|·{·new·(...a:·any[]):·any·}\n\n/*·c8·ignore·start·*/\nconst·PROCESS·=·(\n··typeof·process·===·'object'·&&·!!process·?\n····process\n··:·{})·as·{·[k:·string]:·unknown·}\n/*·c8·ignore·stop·*/\n\nconst·emitWarning·=·(\n··msg:·string,\n··type:·string,\n··code:·string,\n··fn:·ForC,\n)·=>·{\n··if·(typeof·PROCESS.emitWarning·===·'function')·{\n····PROCESS.emitWarning(msg,·type,·code,·fn)\n··}·else·{\n····//oxlint-disable-next-line·no-console\n····console.error(`[${code}]·${type}:·${msg}`)\n··}\n}\nconst·shouldWarn·=·(code:·string)·=>·!warned.has(code)\n\nconst·TYPE·=·Symbol('type')\nexport·type·PosInt·=·number·&·{·[TYPE]:·'Positive·Integer'·}\nexport·type·Index·=·number·&·{·[TYPE]:·'LRUCache·Index'·}\n\nconst·isPosInt·=·(n:·unknown):·n·is·PosInt·=>\n··!!n·&&·n·===·Math.floor(n·as·number)·&&·n·>·0·&&·isFinite(n)\n\nexport·type·UintArray·=·Uint8Array·|·Uint16Array·|·Uint32Array\nexport·type·NumberArray·=·UintArray·|·number[]\n\n//·This·is·a·little·bit·ridiculous,·tbh.\n//·The·maximum·array·length·is·2^32-1·or·thereabouts·on·most·JS·impls.\n//·And·well·before·that·point,·you're·caching·the·entire·world,·I·mean,\n//·that's·~32GB·of·just·integers·for·the·next/prev·links,·plus·whatever\n//·else·to·hold·that·many·keys·and·values.··Just·filling·the·memory·with\n//·zeroes·at·init·time·is·brutal·when·you·get·that·big.\n//·But·why·not·be·complete?\n//·Maybe·in·the·future,·these·limits·will·have·expanded.\n/*·c8·ignore·start·*/\nconst·getUintArray·=·(max:·number)·=>\n··!isPosInt(max)·?·null\n··:·max·<=·Math.pow(2,·8)·?·Uint8Array\n··:·max·<=·Math.pow(2,·16)·?·Uint16Array\n··:·max·<=·Math.pow(2,·32)·?·Uint32Array\n··:·max·<=·Number.MAX_SAFE_INTEGER·?·ZeroArray\n··:·null\n/*·c8·ignore·stop·*/\n\nclass·ZeroArray·extends·Array<number>·{\n··constructor(size:·number)·{\n····super(size)\n····this.fill(0)\n··}\n}\nexport·type·{·ZeroArray·}\nexport·type·{·Stack·}\n\nexport·type·StackLike·=·Stack·|·Index[]\nclass·Stack·{\n··heap:·NumberArray\n··length:·number\n··//·private·constructor\n··static·#constructing:·boolean·=·false\n··static·create(max:·number):·StackLike·{\n····const·HeapCls·=·getUintArray(max)\n····if·(!HeapCls)·return·[]\n····Stack.#constructing·=·true\n····const·s·=·new·Stack(max,·HeapCls)\n····Stack.#constructing·=·false\n····return·s\n··}\n··constructor(max:·number,·HeapCls:·{·new·(n:·number):·NumberArray·})·{\n····/*·c8·ignore·start·*/\n····if·(!Stack.#constructing)·{\n······throw·new·TypeError('instantiate·Stack·using·Stack.create(n)')\n····}\n····/*·c8·ignore·stop·*/\n····this.heap·=·new·HeapCls(max)\n····this.length·=·0\n··}\n··push(n:·Index)·{\n····this.heap[this.length++]·=·n\n··}\n··pop():·Index·{\n····return·this.heap[--this.length]·as·Index\n··}\n}\n\n/**\n·*·Promise·representing·an·in-progress·{@link·LRUCache#fetch}·call\n·*/\nexport·type·BackgroundFetch<V>·=·Promise<V·|·undefined>·&·{\n··__returned:·BackgroundFetch<V>·|·undefined\n··__abortController:·AbortController\n··__staleWhileFetching:·V·|·undefined\n}\n\nexport·type·DisposeTask<K,·V>·=·[\n··value:·V,\n··key:·K,\n··reason:·LRUCache.DisposeReason,\n]\n\nexport·namespace·LRUCache·{\n··/**\n···*·An·integer·greater·than·0,·reflecting·the·calculated·size·of·items\n···*/\n··export·type·Size·=·number\n\n··/**\n···*·Integer·greater·than·0,·representing·some·number·of·milliseconds,·or·the\n···*·time·at·which·a·TTL·started·counting·from.\n···*/\n··export·type·Milliseconds·=·number\n\n··/**\n···*·An·integer·greater·than·0,·reflecting·a·number·of·items\n···*/\n··export·type·Count·=·number\n\n··/**\n···*·The·reason·why·an·item·was·removed·from·the·cache,·passed\n···*·to·the·{@link·Disposer}·methods.\n···*\n···*·-·`evict`:·The·item·was·evicted·because·it·is·the·least·recently·used,\n···*···and·the·cache·is·full.\n···*·-·`set`:·A·new·value·was·set,·overwriting·the·old·value·being·disposed.\n···*·-·`delete`:·The·item·was·explicitly·deleted,·either·by·calling\n···*···{@link·LRUCache#delete},·{@link·LRUCache#clear},·or\n···*···{@link·LRUCache#set}·with·an·undefined·value.\n···*·-·`expire`:·The·item·was·removed·due·to·exceeding·its·TTL.\n···*·-·`fetch`:·A·{@link·OptionsBase#fetchMethod}·operation·returned\n···*···`undefined`·or·was·aborted,·causing·the·item·to·be·deleted.\n···*/\n··export·type·DisposeReason·=\n····|·'evict'\n····|·'set'\n····|·'delete'\n····|·'expire'\n····|·'fetch'\n··/**\n···*·A·method·called·upon·item·removal,·passed·as·the\n···*·{@link·OptionsBase.dispose}·and/or\n···*·{@link·OptionsBase.disposeAfter}·options.\n···*/\n··export·type·Disposer<K,·V>·=·(\n····value:·V,\n····key:·K,\n····reason:·DisposeReason,\n··)·=>·void\n\n··/**\n···*·The·reason·why·an·item·was·added·to·the·cache,·passed\n···*·to·the·{@link·Inserter}·methods.\n···*\n···*·-·`add`:·the·item·was·not·found·in·the·cache,·and·was·added\n···*·-·`update`:·the·item·was·in·the·cache,·with·the·same·value·provided\n···*·-·`replace`:·the·item·was·in·the·cache,·and·replaced\n···*/\n··export·type·InsertReason·=·'add'·|·'update'·|·'replace'\n\n··/**\n···*·A·method·called·upon·item·insertion,·passed·as·the\n···*·{@link·OptionsBase.insert}\n···*/\n··export·type·Inserter<K,·V>·=·(\n····value:·V,\n····key:·K,\n····reason:·InsertReason,\n··)·=>·void\n\n··/**\n···*·A·function·that·returns·the·effective·calculated·size\n···*·of·an·entry·in·the·cache.\n···*/\n··export·type·SizeCalculator<K,·V>·=·(value:·V,·key:·K)·=>·Size\n\n··/**\n···*·Options·provided·to·the\n···*·{@link·OptionsBase.fetchMethod}·function.\n···*/\n··export·interface·FetcherOptions<K,·V,·FC·=·unknown>·{\n····signal:·AbortSignal\n····options:·FetcherFetchOptions<K,·V,·FC>\n····/**\n·····*·Object·provided·in·the·{@link·FetchOptions.context}·option·to\n·····*·{@link·LRUCache#fetch}\n·····*/\n····context:·FC\n··}\n\n··/**\n···*·Occasionally,·it·may·be·useful·to·track·the·internal·behavior·of·the\n···*·cache,·particularly·for·logging,·debugging,·or·for·behavior·within·the\n···*·`fetchMethod`.·To·do·this,·you·can·pass·a·`status`·object·to·the\n···*·{@link·LRUCache#fetch},·{@link·LRUCache#get},·{@link·LRUCache#set},\n···*·{@link·LRUCache#memo},·and·{@link·LRUCache#has}·methods.\n···*\n···*·The·`status`·option·should·be·a·plain·JavaScript·object.·The·following\n···*·fields·will·be·set·on·it·appropriately,·depending·on·the·situation.\n···*\n···*·These·objects·are·also·the·context·objects·passed·to·listeners·on·the\n···*·`lru-cache:metrics`·diagnostic·channel,·and·the·`lru-cache`·tracing\n···*·channels,·in·platforms·that·support·them.\n···*/\n··export·interface·Status<K,·V>·{\n····/**\n·····*·The·operation·being·performed\n·····*/\n····op?:·'get'·|·'set'·|·'memo'·|·'fetch'·|·'delete'·|·'has'·|·'peek'\n····/**\n·····*·The·status·of·a·set()·operation.\n·····*\n·····*·-·add:·the·item·was·not·found·in·the·cache,·and·was·added\n·····*·-·update:·the·item·was·in·the·cache,·with·the·same·value·provided\n·····*·-·replace:·the·item·was·in·the·cache,·and·replaced\n·····*·-·miss:·the·item·was·not·added·to·the·cache·for·some·reason\n·····*/\n····set?:·'add'·|·'update'·|·'replace'·|·'miss'·|·'deleted'\n\n····/**\n·····*·The·status·of·a·delete()·operation.\n·····*/\n····delete?:·LRUCache.DisposeReason\n\n····/**\n·····*·The·result·of·a·peek()·operation\n·····*\n·····*·-·hit:·the·item·was·found·and·returned\n·····*·-·stale:·the·item·is·in·the·cache,·but·past·its·ttl·and·not·returned\n·····*·-·miss:·item·not·in·the·cache\n·····*/\n····peek?:·'hit'·|·'miss'·|·'stale'\n\n····/**\n·····*·The·status·of·a·memo()·operation.\n·····*\n·····*·-·'hit':·the·item·was·found·in·the·cache·and·returned\n·····*·-·'miss':·the·`memoMethod`·function·was·called\n·····*/\n····memo?:·'hit'·|·'miss'\n\n····/**\n·····*·The·`context`·option·provided·to·a·memo·or·fetch·operation\n·····*\n·····*·In·practice,·of·course,·this·will·be·the·same·type·as·the·`FC`\n·····*·fetch·context·param·used·to·instantiate·the·LRUCache,·but·the\n·····*·convolutions·of·threading·that·through·would·get·quite·complicated,\n·····*·and·preclude·forcing/forbidding·the·passing·of·a·`context`·param\n·····*·where·it·is/isn't·expected,·which·is·more·valuable·for·error\n·····*·prevention.\n·····*/\n····context?:·unknown\n\n····/**\n·····*·the·ttl·stored·for·the·item,·or·undefined·if·ttls·are·not·used.\n·····*/\n····ttl?:·Milliseconds\n\n····/**\n·····*·the·start·time·for·the·item,·or·undefined·if·ttls·are·not·used.\n·····*/\n····start?:·Milliseconds\n\n····/**\n·····*·The·timestamp·used·for·TTL·calculation\n·····*/\n····now?:·Milliseconds\n\n····/**\n·····*·the·remaining·ttl·for·the·item,·or·undefined·if·ttls·are·not·used.\n·····*/\n····remainingTTL?:·Milliseconds\n\n····/**\n·····*·The·calculated·size·for·the·item,·if·sizes·are·used.\n·····*/\n····entrySize?:·Size\n\n····/**\n·····*·The·total·calculated·size·of·the·cache,·if·sizes·are·used.\n·····*/\n····totalCalculatedSize?:·Size\n\n····/**\n·····*·A·flag·indicating·that·the·item·was·not·stored,·due·to·exceeding·the\n·····*·{@link·OptionsBase.maxEntrySize}\n·····*/\n····maxEntrySizeExceeded?:·true\n\n····/**\n·····*·The·key·that·was·set·or·retrieved\n·····*/\n····key?:·K\n\n····/**\n·····*·The·value·that·was·set\n·····*/\n····value?:·V\n\n····/**\n·····*·The·old·value,·specified·in·the·case·of·`set:'replace'`\n·····*/\n····oldValue?:·V\n\n····/**\n·····*·The·results·of·a·{@link·LRUCache#has}·operation\n·····*\n·····*·-·hit:·the·item·was·found·in·the·cache\n·····*·-·stale:·the·item·was·found·in·the·cache,·but·is·stale\n·····*·-·miss:·the·item·was·not·found·in·the·cache\n·····*/\n····has?:·'hit'·|·'stale'·|·'miss'\n\n····/**\n·····*·The·status·of·a·{@link·LRUCache#fetch}·operation.\n·····*·Note·that·this·can·change·as·the·underlying·fetch()·moves·through\n·····*·various·states.\n·····*\n·····*·-·inflight:·there·is·another·fetch()·for·this·key·which·is·in·process\n·····*·-·get:·there·is·no·{@link·OptionsBase.fetchMethod},·so\n·····*···{@link·LRUCache#get}·was·called.\n·····*·-·miss:·the·item·is·not·in·cache,·and·will·be·fetched.\n·····*·-·hit:·the·item·is·in·the·cache,·and·was·resolved·immediately.\n·····*·-·stale:·the·item·is·in·the·cache,·but·stale.\n·····*·-·refresh:·the·item·is·in·the·cache,·and·not·stale,·but\n·····*···{@link·FetchOptions.forceRefresh}·was·specified.\n·····*/\n····fetch?:·'get'·|·'inflight'·|·'miss'·|·'hit'·|·'stale'·|·'refresh'\n\n····/**\n·····*·`forceRefresh`·option·was·used·for·either·a·fetch·or·memo·operation\n·····*/\n····forceRefresh?:·boolean\n\n····/**\n·····*·The·{@link·OptionsBase.fetchMethod}·was·called\n·····*/\n····fetchDispatched?:·true\n\n····/**\n·····*·The·cached·value·was·updated·after·a·successful·call·to\n·····*·{@link·OptionsBase.fetchMethod}\n·····*/\n····fetchUpdated?:·true\n\n····/**\n·····*·The·reason·for·a·fetch()·rejection.··Either·the·error·raised·by·the\n·····*·{@link·OptionsBase.fetchMethod},·or·the·reason·for·an\n·····*·AbortSignal.\n·····*/\n····fetchError?:·Error\n\n····/**\n·····*·The·fetch·received·an·abort·signal\n·····*/\n····fetchAborted?:·true\n\n····/**\n·····*·The·abort·signal·received·was·ignored,·and·the·fetch·was·allowed·to\n·····*·continue·in·the·background.\n·····*/\n····fetchAbortIgnored?:·true\n\n····/**\n·····*·The·fetchMethod·promise·resolved·successfully\n·····*/\n····fetchResolved?:·true\n\n····/**\n·····*·The·fetchMethod·promise·was·rejected\n·····*/\n····fetchRejected?:·true\n\n····/**\n·····*·The·status·of·a·{@link·LRUCache#get}·operation.\n·····*\n·····*·-·fetching:·The·item·is·currently·being·fetched.··If·a·previous·value\n·····*···is·present·and·allowed,·that·will·be·returned.\n·····*·-·stale:·The·item·is·in·the·cache,·and·is·stale.·If·it·was·returned,\n·····*···then·the·`returnedStale`·flag·will·be·set.\n·····*·-·stale-fetching:·The·value·is·being·fetched·in·the·background,·but·is\n·····*···currently·stale.·If·the·stale·value·was·returned,·then·the\n·····*···`returnedStale`·flag·will·be·set.\n·····*·-·hit:·the·item·is·in·the·cache\n·····*·-·miss:·the·item·is·not·in·the·cache\n·····*/\n····get?:·'stale'·|·'hit'·|·'miss'·|·'fetching'·|·'stale-fetching'\n\n····/**\n·····*·A·fetch·or·get·operation·returned·a·stale·value.\n·····*/\n····returnedStale?:·true\n\n····/**\n·····*·A·tracingChannel·trace·was·started·for·this·operation\n·····*/\n····trace?:·boolean\n··}\n\n··/**\n···*·options·which·override·the·options·set·in·the·LRUCache·constructor\n···*·when·calling·{@link·LRUCache#fetch}.\n···*\n···*·This·is·the·union·of·{@link·GetOptions}·and·{@link·SetOptions},·plus\n···*·{@link·OptionsBase.noDeleteOnFetchRejection},\n···*·{@link·OptionsBase.allowStaleOnFetchRejection},\n···*·{@link·FetchOptions.forceRefresh},·and\n···*·{@link·FetcherOptions.context}\n···*\n···*·Any·of·these·may·be·modified·in·the·{@link·OptionsBase.fetchMethod}\n···*·function,·but·the·{@link·GetOptions}·fields·will·of·course·have·no\n···*·effect,·as·the·{@link·LRUCache#get}·call·already·happened·by·the·time\n···*·the·fetchMethod·is·called.\n···*/\n··export·interface·FetcherFetchOptions<K,·V,·FC·=·unknown>·extends·Pick<\n····OptionsBase<K,·V,·FC>,\n····|·'allowStale'\n····|·'updateAgeOnGet'\n····|·'noDeleteOnStaleGet'\n····|·'sizeCalculation'\n····|·'ttl'\n····|·'noDisposeOnSet'\n····|·'noUpdateTTL'\n····|·'noDeleteOnFetchRejection'\n····|·'allowStaleOnFetchRejection'\n····|·'ignoreFetchAbort'\n····|·'allowStaleOnFetchAbort'\n··>·{\n····status?:·Status<K,·V>\n····size?:·Size\n··}\n\n··/**\n···*·Options·that·may·be·passed·to·the·{@link·LRUCache#fetch}·method.\n···*/\n··export·interface·FetchOptions<K,·V,·FC>·extends·FetcherFetchOptions<\n····K,\n····V,\n····FC\n··>·{\n····/**\n·····*·Set·to·true·to·force·a·re-load·of·the·existing·data,·even·if·it\n·····*·is·not·yet·stale.\n·····*/\n····forceRefresh?:·boolean\n····/**\n·····*·Context·provided·to·the·{@link·OptionsBase.fetchMethod}·as\n·····*·the·{@link·FetcherOptions.context}·param.\n·····*\n·····*·If·the·FC·type·is·specified·as·unknown·(the·default),\n·····*·undefined·or·void,·then·this·is·optional.··Otherwise,·it·will\n·····*·be·required.\n·····*/\n····context?:·FC\n····signal?:·AbortSignal\n····status?:·Status<K,·V>\n··}\n··/**\n···*·Options·provided·to·{@link·LRUCache#fetch}·when·the·FC·type·is·something\n···*·other·than·`unknown`,·`undefined`,·or·`void`\n···*/\n··export·interface·FetchOptionsWithContext<K,·V,·FC>·extends·FetchOptions<\n····K,\n····V,\n····FC\n··>·{\n····context:·FC\n··}\n··/**\n···*·Options·provided·to·{@link·LRUCache#fetch}·when·the·FC·type·is\n···*·`undefined`·or·`void`\n···*/\n··export·interface·FetchOptionsNoContext<K,·V>·extends·FetchOptions<\n····K,\n····V,\n····undefined\n··>·{\n····context?:·undefined\n··}\n\n··export·interface·MemoOptions<K,·V,·FC·=·unknown>·extends·Pick<\n····OptionsBase<K,·V,·FC>,\n····|·'allowStale'\n····|·'updateAgeOnGet'\n····|·'noDeleteOnStaleGet'\n····|·'sizeCalculation'\n····|·'ttl'\n····|·'noDisposeOnSet'\n····|·'noUpdateTTL'\n····|·'noDeleteOnFetchRejection'\n····|·'allowStaleOnFetchRejection'\n····|·'ignoreFetchAbort'\n····|·'allowStaleOnFetchAbort'\n··>·{\n····/**\n·····*·Set·to·true·to·force·a·re-load·of·the·existing·data,·even·if·it\n·····*·is·not·yet·stale.\n·····*/\n····forceRefresh?:·boolean\n····/**\n·····*·Context·provided·to·the·{@link·OptionsBase.memoMethod}·as\n·····*·the·{@link·MemoizerOptions.context}·param.\n·····*\n·····*·If·the·FC·type·is·specified·as·unknown·(the·default),\n·····*·undefined·or·void,·then·this·is·optional.··Otherwise,·it·will\n·····*·be·required.\n·····*/\n····context?:·FC\n····status?:·Status<K,·V>\n··}\n··/**\n···*·Options·provided·to·{@link·LRUCache#memo}·when·the·FC·type·is·something\n···*·other·than·`unknown`,·`undefined`,·or·`void`\n···*/\n··export·interface·MemoOptionsWithContext<K,·V,·FC>·extends·MemoOptions<\n····K,\n····V,\n····FC\n··>·{\n····context:·FC\n··}\n··/**\n···*·Options·provided·to·{@link·LRUCache#memo}·when·the·FC·type·is\n···*·`undefined`·or·`void`\n···*/\n··export·interface·MemoOptionsNoContext<K,·V>·extends·MemoOptions<\n····K,\n····V,\n····undefined\n··>·{\n····context?:·undefined\n··}\n\n··/**\n···*·Options·provided·to·the\n···*·{@link·OptionsBase.memoMethod}·function.\n···*/\n··export·interface·MemoizerOptions<K,·V,·FC·=·unknown>·{\n····options:·MemoizerMemoOptions<K,·V,·FC>\n····/**\n·····*·Object·provided·in·the·{@link·MemoOptions.context}·option·to\n·····*·{@link·LRUCache#memo}\n·····*/\n····context:·FC\n··}\n\n··/**\n···*·options·which·override·the·options·set·in·the·LRUCache·constructor\n···*·when·calling·{@link·LRUCache#memo}.\n···*\n···*·This·is·the·union·of·{@link·GetOptions}·and·{@link·SetOptions},·plus\n···*·{@link·MemoOptions.forceRefresh},·and\n···*·{@link·MemoOptions.context}\n···*\n···*·Any·of·these·may·be·modified·in·the·{@link·OptionsBase.memoMethod}\n···*·function,·but·the·{@link·GetOptions}·fields·will·of·course·have·no\n···*·effect,·as·the·{@link·LRUCache#get}·call·already·happened·by·the·time\n···*·the·memoMethod·is·called.\n···*/\n··export·interface·MemoizerMemoOptions<K,·V,·FC·=·unknown>·extends·Pick<\n····OptionsBase<K,·V,·FC>,\n····|·'allowStale'\n····|·'updateAgeOnGet'\n····|·'noDeleteOnStaleGet'\n····|·'sizeCalculation'\n····|·'ttl'\n····|·'noDisposeOnSet'\n····|·'noUpdateTTL'\n··>·{\n····status?:·Status<K,·V>\n····size?:·Size\n····start?:·Milliseconds\n··}\n\n··/**\n···*·Options·that·may·be·passed·to·the·{@link·LRUCache#has}·method.\n···*/\n··export·interface·HasOptions<K,·V,·FC>·extends·Pick<\n····OptionsBase<K,·V,·FC>,\n····'updateAgeOnHas'\n··>·{\n····status?:·Status<K,·V>\n··}\n\n··/**\n···*·Options·that·may·be·passed·to·the·{@link·LRUCache#get}·method.\n···*/\n··export·interface·GetOptions<K,·V,·FC>·extends·Pick<\n····OptionsBase<K,·V,·FC>,\n····'allowStale'·|·'updateAgeOnGet'·|·'noDeleteOnStaleGet'\n··>·{\n····status?:·Status<K,·V>\n··}\n\n··/**\n···*·Options·that·may·be·passed·to·the·{@link·LRUCache#peek}·method.\n···*/\n··export·interface·PeekOptions<K,·V,·FC>·extends·Pick<\n····OptionsBase<K,·V,·FC>,\n····'allowStale'\n··>·{\n····status?:·Status<K,·V>\n··}\n\n··/**\n···*·Options·that·may·be·passed·to·the·{@link·LRUCache#set}·method.\n···*/\n··export·interface·SetOptions<K,·V,·FC>·extends·Pick<\n····OptionsBase<K,·V,·FC>,\n····'sizeCalculation'·|·'ttl'·|·'noDisposeOnSet'·|·'noUpdateTTL'\n··>·{\n····/**\n·····*·If·size·tracking·is·enabled,·then·setting·an·explicit·size\n·····*·in·the·{@link·LRUCache#set}·call·will·prevent·calling·the\n·····*·{@link·OptionsBase.sizeCalculation}·function.\n·····*/\n····size?:·Size\n····/**\n·····*·If·TTL·tracking·is·enabled,·then·setting·an·explicit·start\n·····*·time·in·the·{@link·LRUCache#set}·call·will·override·the\n·····*·default·time·from·`performance.now()`·or·`Date.now()`.\n·····*\n·····*·Note·that·it·must·be·a·valid·value·for·whichever·time-tracking\n·····*·method·is·in·use.\n·····*/\n····start?:·Milliseconds\n····status?:·Status<K,·V>\n··}\n\n··/**\n···*·The·type·signature·for·the·{@link·OptionsBase.fetchMethod}·option.\n···*/\n··export·type·Fetcher<K,·V,·FC·=·unknown>·=·(\n····key:·K,\n····staleValue:·V·|·undefined,\n····options:·FetcherOptions<K,·V,·FC>,\n··)·=>·Promise<V·|·undefined·|·void>·|·V·|·undefined·|·void\n\n··/**\n···*·the·type·signature·for·the·{@link·OptionsBase.memoMethod}·option.\n···*/\n··export·type·Memoizer<K,·V,·FC·=·unknown>·=·(\n····key:·K,\n····staleValue:·V·|·undefined,\n····options:·MemoizerOptions<K,·V,·FC>,\n··)·=>·V\n\n··/**\n···*·Options·which·may·be·passed·to·the·{@link·LRUCache}·constructor.\n···*\n···*·Most·of·these·may·be·overridden·in·the·various·options·that·use\n···*·them.\n···*\n···*·Despite·all·being·technically·optional,·the·constructor·requires·that\n···*·a·cache·is·at·minimum·limited·by·one·or·more·of·{@link·OptionsBase.max},\n···*·{@link·OptionsBase.ttl},·or·{@link·OptionsBase.maxSize}.\n···*\n···*·If·{@link·OptionsBase.ttl}·is·used·alone,·then·it·is·strongly·advised\n···*·(and·in·fact·required·by·the·type·definitions·here)·that·the·cache\n···*·also·set·{@link·OptionsBase.ttlAutopurge},·to·prevent·potentially\n···*·unbounded·storage.\n···*\n···*·All·options·are·also·available·on·the·{@link·LRUCache}·instance,·making\n···*·it·safe·to·pass·an·LRUCache·instance·as·the·options·argumemnt·to\n···*·make·another·empty·cache·of·the·same·type.\n···*\n···*·Some·options·are·marked·as·read-only,·because·changing·them·after\n···*·instantiation·is·not·safe.·Changing·any·of·the·other·options·will·of\n···*·course·only·have·an·effect·on·subsequent·method·calls.\n···*/\n··export·interface·OptionsBase<K,·V,·FC>·{\n····/**\n·····*·The·maximum·number·of·items·to·store·in·the·cache·before·evicting\n·····*·old·entries.·This·is·read-only·on·the·{@link·LRUCache}·instance,\n·····*·and·may·not·be·overridden.\n·····*\n·····*·If·set,·then·storage·space·will·be·pre-allocated·at·construction\n·····*·time,·and·the·cache·will·perform·significantly·faster.\n·····*\n·····*·Note·that·significantly·fewer·items·may·be·stored,·if\n·····*·{@link·OptionsBase.maxSize}·and/or·{@link·OptionsBase.ttl}·are·also\n·····*·set.\n·····*\n·····*·**It·is·strongly·recommended·to·set·a·`max`·to·prevent·unbounded·growth\n·····*·of·the·cache.**\n·····*/\n····max?:·Count\n\n····/**\n·····*·Max·time·in·milliseconds·for·items·to·live·in·cache·before·they·are\n·····*·considered·stale.··Note·that·stale·items·are·NOT·preemptively·removed·by\n·····*·default,·and·MAY·live·in·the·cache,·contributing·to·its·LRU·max,·long\n·····*·after·they·have·expired,·unless·{@link·OptionsBase.ttlAutopurge}·is\n·····*·set.\n·····*\n·····*·If·set·to·`0`·(the·default·value),·then·that·means·\"do·not·track\n·····*·TTL\",·not·\"expire·immediately\".\n·····*\n·····*·Also,·as·this·cache·is·optimized·for·LRU/MRU·operations,·some·of\n·····*·the·staleness/TTL·checks·will·reduce·performance,·as·they·will·incur\n·····*·overhead·by·deleting·items.\n·····*\n·····*·This·is·not·primarily·a·TTL·cache,·and·does·not·make·strong·TTL\n·····*·guarantees.·There·is·no·pre-emptive·pruning·of·expired·items,·but·you\n·····*·_may_·set·a·TTL·on·the·cache,·and·it·will·treat·expired·items·as·missing\n·····*·when·they·are·fetched,·and·delete·them.\n·····*\n·····*·Optional,·but·must·be·a·non-negative·integer·in·ms·if·specified.\n·····*\n·····*·This·may·be·overridden·by·passing·an·options·object·to·`cache.set()`.\n·····*\n·····*·At·least·one·of·`max`,·`maxSize`,·or·`TTL`·is·required.·This·must·be·a\n·····*·positive·integer·if·set.\n·····*\n·····*·Even·if·ttl·tracking·is·enabled,·**it·is·strongly·recommended·to·set·a\n·····*·`max`·to·prevent·unbounded·growth·of·the·cache.**\n·····*\n·····*·If·ttl·tracking·is·enabled,·and·`max`·and·`maxSize`·are·not·set,\n·····*·and·`ttlAutopurge`·is·not·set,·then·a·warning·will·be·emitted\n·····*·cautioning·about·the·potential·for·unbounded·memory·consumption.\n·····*·(The·TypeScript·definitions·will·also·discourage·this.)\n·····*/\n····ttl?:·Milliseconds\n\n····/**\n·····*·Minimum·amount·of·time·in·ms·in·which·to·check·for·staleness.\n·····*·Defaults·to·1,·which·means·that·the·current·time·is·checked\n·····*·at·most·once·per·millisecond.\n·····*\n·····*·Set·to·0·to·check·the·current·time·every·time·staleness·is·tested.\n·····*·(This·reduces·performance,·and·is·theoretically·unnecessary.)\n·····*\n·····*·Setting·this·to·a·higher·value·will·improve·performance·somewhat\n·····*·while·using·ttl·tracking,·albeit·at·the·expense·of·keeping·stale\n·····*·items·around·a·bit·longer·than·their·TTLs·would·indicate.\n·····*\n·····*·@default·1\n·····*/\n····ttlResolution?:·Milliseconds\n\n····/**\n·····*·Preemptively·remove·stale·items·from·the·cache.\n·····*\n·····*·Note·that·this·may·*significantly*·degrade·performance,·especially·if\n·····*·the·cache·is·storing·a·large·number·of·items.·It·is·almost·always·best\n·····*·to·just·leave·the·stale·items·in·the·cache,·and·let·them·fall·out·as·new\n·····*·items·are·added.\n·····*\n·····*·Note·that·this·means·that·{@link·OptionsBase.allowStale}·is·a·bit\n·····*·pointless,·as·stale·items·will·be·deleted·almost·as·soon·as·they\n·····*·expire.\n·····*\n·····*·Use·with·caution!\n·····*/\n····ttlAutopurge?:·boolean\n\n····/**\n·····*·When·using·time-expiring·entries·with·`ttl`,·setting·this·to·`true`·will\n·····*·make·each·item's·age·reset·to·0·whenever·it·is·retrieved·from·cache·with\n·····*·{@link·LRUCache#get},·causing·it·to·not·expire.·(It·can·still·fall·out\n·····*·of·cache·based·on·recency·of·use,·of·course.)\n·····*\n·····*·Has·no·effect·if·{@link·OptionsBase.ttl}·is·not·set.\n·····*\n·····*·This·may·be·overridden·by·passing·an·options·object·to·`cache.get()`.\n·····*/\n····updateAgeOnGet?:·boolean\n\n····/**\n·····*·When·using·time-expiring·entries·with·`ttl`,·setting·this·to·`true`·will\n·····*·make·each·item's·age·reset·to·0·whenever·its·presence·in·the·cache·is\n·····*·checked·with·{@link·LRUCache#has},·causing·it·to·not·expire.·(It·can\n·····*·still·fall·out·of·cache·based·on·recency·of·use,·of·course.)\n·····*\n·····*·Has·no·effect·if·{@link·OptionsBase.ttl}·is·not·set.\n·····*/\n····updateAgeOnHas?:·boolean\n\n····/**\n·····*·Allow·{@link·LRUCache#get}·and·{@link·LRUCache#fetch}·calls·to·return\n·····*·stale·data,·if·available.\n·····*\n·····*·By·default,·if·you·set·`ttl`,·stale·items·will·only·be·deleted·from·the\n·····*·cache·when·you·`get(key)`.·That·is,·it's·not·preemptively·pruning·items,\n·····*·unless·{@link·OptionsBase.ttlAutopurge}·is·set.\n·····*\n·····*·If·you·set·`allowStale:true`,·it'll·return·the·stale·value·*as·well·as*\n·····*·deleting·it.·If·you·don't·set·this,·then·it'll·return·`undefined`·when\n·····*·you·try·to·get·a·stale·entry.\n·····*\n·····*·Note·that·when·a·stale·entry·is·fetched,·_even·if·it·is·returned·due·to\n·····*·`allowStale`·being·set_,·it·is·removed·from·the·cache·immediately.·You\n·····*·can·suppress·this·behavior·by·setting\n·····*·{@link·OptionsBase.noDeleteOnStaleGet},·either·in·the·constructor,·or·in\n·····*·the·options·provided·to·{@link·LRUCache#get}.\n·····*\n·····*·This·may·be·overridden·by·passing·an·options·object·to·`cache.get()`.\n·····*·The·`cache.has()`·method·will·always·return·`false`·for·stale·items.\n·····*\n·····*·Only·relevant·if·a·ttl·is·set.\n·····*/\n····allowStale?:·boolean\n\n····/**\n·····*·Function·that·is·called·on·items·when·they·are·dropped·from·the\n·····*·cache,·as·`dispose(value,·key,·reason)`.\n·····*\n·····*·This·can·be·handy·if·you·want·to·close·file·descriptors·or·do\n·····*·other·cleanup·tasks·when·items·are·no·longer·stored·in·the·cache.\n·····*\n·····*·**NOTE**:·It·is·called·_before_·the·item·has·been·fully·removed\n·····*·from·the·cache,·so·if·you·want·to·put·it·right·back·in,·you·need\n·····*·to·wait·until·the·next·tick.·If·you·try·to·add·it·back·in·during\n·····*·the·`dispose()`·function·call,·it·will·break·things·in·subtle·and\n·····*·weird·ways.\n·····*\n·····*·Unlike·several·other·options,·this·may·_not_·be·overridden·by\n·····*·passing·an·option·to·`set()`,·for·performance·reasons.\n·····*\n·····*·The·`reason`·will·be·one·of·the·following·strings,·corresponding\n·····*·to·the·reason·for·the·item's·deletion:\n·····*\n·····*·-·`evict`·Item·was·evicted·to·make·space·for·a·new·addition\n·····*·-·`set`·Item·was·overwritten·by·a·new·value\n·····*·-·`expire`·Item·expired·its·TTL\n·····*·-·`fetch`·Item·was·deleted·due·to·a·failed·or·aborted·fetch,·or·a\n·····*···fetchMethod·returning·`undefined.\n·····*·-·`delete`·Item·was·removed·by·explicit·`cache.delete(key)`,\n·····*···`cache.clear()`,·or·`cache.set(key,·undefined)`.\n·····*/\n····dispose?:·Disposer<K,·V>\n\n····/**\n·····*·Function·that·is·called·when·new·items·are·inserted·into·the·cache,\n·····*·as·`onInsert(value,·key,·reason)`.\n·····*\n·····*·This·can·be·useful·if·you·need·to·perform·actions·when·an·item·is\n·····*·added,·such·as·logging·or·tracking·insertions.\n·····*\n·····*·Unlike·some·other·options,·this·may·_not_·be·overridden·by·passing\n·····*·an·option·to·`set()`,·for·performance·and·consistency·reasons.\n·····*/\n····onInsert?:·Inserter<K,·V>\n\n····/**\n·····*·The·same·as·{@link·OptionsBase.dispose},·but·called·*after*·the·entry\n·····*·is·completely·removed·and·the·cache·is·once·again·in·a·clean·state.\n·····*\n·····*·It·is·safe·to·add·an·item·right·back·into·the·cache·at·this·point.\n·····*·However,·note·that·it·is·*very*·easy·to·inadvertently·create·infinite\n·····*·recursion·this·way.\n·····*/\n····disposeAfter?:·Disposer<K,·V>\n\n····/**\n·····*·Set·to·true·to·suppress·calling·the\n·····*·{@link·OptionsBase.dispose}·function·if·the·entry·key·is\n·····*·still·accessible·within·the·cache.\n·····*\n·····*·This·may·be·overridden·by·passing·an·options·object·to\n·····*·{@link·LRUCache#set}.\n·····*\n·····*·Only·relevant·if·`dispose`·or·`disposeAfter`·are·set.\n·····*/\n····noDisposeOnSet?:·boolean\n\n····/**\n·····*·Boolean·flag·to·tell·the·cache·to·not·update·the·TTL·when·setting·a·new\n·····*·value·for·an·existing·key·(ie,·when·updating·a·value·rather·than\n·····*·inserting·a·new·value).··Note·that·the·TTL·value·is·_always_·set·(if\n·····*·provided)·when·adding·a·new·entry·into·the·cache.\n·····*\n·····*·Has·no·effect·if·a·{@link·OptionsBase.ttl}·is·not·set.\n·····*\n·····*·May·be·passed·as·an·option·to·{@link·LRUCache#set}.\n·····*/\n····noUpdateTTL?:·boolean\n\n····/**\n·····*·Set·to·a·positive·integer·to·track·the·sizes·of·items·added·to·the\n·····*·cache,·and·automatically·evict·items·in·order·to·stay·below·this·size.\n·····*·Note·that·this·may·result·in·fewer·than·`max`·items·being·stored.\n·····*\n·····*·Attempting·to·add·an·item·to·the·cache·whose·calculated·size·is·greater\n·····*·that·this·amount·will·be·a·no-op.·The·item·will·not·be·cached,·and·no\n·····*·other·items·will·be·evicted.\n·····*\n·····*·Optional,·must·be·a·positive·integer·if·provided.\n·····*\n·····*·Sets·`maxEntrySize`·to·the·same·value,·unless·a·different·value·is\n·····*·provided·for·`maxEntrySize`.\n·····*\n·····*·At·least·one·of·`max`,·`maxSize`,·or·`TTL`·is·required.·This·must·be·a\n·····*·positive·integer·if·set.\n·····*\n·····*·Even·if·size·tracking·is·enabled,·**it·is·strongly·recommended·to·set·a\n·····*·`max`·to·prevent·unbounded·growth·of·the·cache.**\n·····*\n·····*·Note·also·that·size·tracking·can·negatively·impact·performance,\n·····*·though·for·most·cases,·only·minimally.\n·····*/\n····maxSize?:·Size\n\n····/**\n·····*·The·maximum·allowed·size·for·any·single·item·in·the·cache.\n·····*\n·····*·If·a·larger·item·is·passed·to·{@link·LRUCache#set}·or·returned·by·a\n·····*·{@link·OptionsBase.fetchMethod}·or·{@link·OptionsBase.memoMethod},·then\n·····*·it·will·not·be·stored·in·the·cache.\n·····*\n·····*·Attempting·to·add·an·item·whose·calculated·size·is·greater·than\n·····*·this·amount·will·not·cache·the·item·or·evict·any·old·items,·but\n·····*·WILL·delete·an·existing·value·if·one·is·already·present.\n·····*\n·····*·Optional,·must·be·a·positive·integer·if·provided.·Defaults·to\n·····*·the·value·of·`maxSize`·if·provided.\n·····*/\n····maxEntrySize?:·Size\n\n····/**\n·····*·A·function·that·returns·a·number·indicating·the·item's·size.\n·····*\n·····*·Requires·{@link·OptionsBase.maxSize}·to·be·set.\n·····*\n·····*·If·not·provided,·and·{@link·OptionsBase.maxSize}·or\n·····*·{@link·OptionsBase.maxEntrySize}·are·set,·then·all\n·····*·{@link·LRUCache#set}·calls·**must**·provide·an·explicit\n·····*·{@link·SetOptions.size}·or·sizeCalculation·param.\n·····*/\n····sizeCalculation?:·SizeCalculator<K,·V>\n\n····/**\n·····*·Method·that·provides·the·implementation·for·{@link·LRUCache#fetch}\n·····*\n·····*·```ts\n·····*·fetchMethod(key,·staleValue,·{·signal,·options,·context·})\n·····*·```\n·····*\n·····*·If·`fetchMethod`·is·not·provided,·then·`cache.fetch(key)`·is·equivalent\n·····*·to·`Promise.resolve(cache.get(key))`.\n·····*\n·····*·If·at·any·time,·`signal.aborted`·is·set·to·`true`,·or·if·the\n·····*·`signal.onabort`·method·is·called,·or·if·it·emits·an·`'abort'`·event\n·····*·which·you·can·listen·to·with·`addEventListener`,·then·that·means·that\n·····*·the·fetch·should·be·abandoned.·This·may·be·passed·along·to·async\n·····*·functions·aware·of·AbortController/AbortSignal·behavior.\n·····*\n·····*·The·`fetchMethod`·should·**only**·return·`undefined`·or·a·Promise\n·····*·resolving·to·`undefined`·if·the·AbortController·signaled·an·`abort`\n·····*·event.·In·all·other·cases,·it·should·return·or·resolve·to·a·value\n·····*·suitable·for·adding·to·the·cache.\n·····*\n·····*·The·`options`·object·is·a·union·of·the·options·that·may·be·provided·to\n·····*·`set()`·and·`get()`.·If·they·are·modified,·then·that·will·result·in\n·····*·modifying·the·settings·to·`cache.set()`·when·the·value·is·resolved,·and\n·····*·in·the·case·of\n·····*·{@link·OptionsBase.noDeleteOnFetchRejection}·and\n·····*·{@link·OptionsBase.allowStaleOnFetchRejection},·the·handling·of\n·····*·`fetchMethod`·failures.\n·····*\n·····*·For·example,·a·DNS·cache·may·update·the·TTL·based·on·the·value·returned\n·····*·from·a·remote·DNS·server·by·changing·`options.ttl`·in·the·`fetchMethod`.\n·····*/\n····fetchMethod?:·Fetcher<K,·V,·FC>\n\n····/**\n·····*·Method·that·provides·the·implementation·for·{@link·LRUCache#memo}\n·····*/\n····memoMethod?:·Memoizer<K,·V,·FC>\n\n····/**\n·····*·Set·to·true·to·suppress·the·deletion·of·stale·data·when·a\n·····*·{@link·OptionsBase.fetchMethod}·returns·a·rejected·promise.\n·····*/\n····noDeleteOnFetchRejection?:·boolean\n\n····/**\n·····*·Do·not·delete·stale·items·when·they·are·retrieved·with\n·····*·{@link·LRUCache#get}.\n·····*\n·····*·Note·that·the·`get`·return·value·will·still·be·`undefined`\n·····*·unless·{@link·OptionsBase.allowStale}·is·true.\n·····*\n·····*·When·using·time-expiring·entries·with·`ttl`,·by·default·stale\n·····*·items·will·be·removed·from·the·cache·when·the·key·is·accessed\n·····*·with·`cache.get()`.\n·····*\n·····*·Setting·this·option·will·cause·stale·items·to·remain·in·the·cache,·until\n·····*·they·are·explicitly·deleted·with·`cache.delete(key)`,·or·retrieved·with\n·····*·`noDeleteOnStaleGet`·set·to·`false`.\n·····*\n·····*·This·may·be·overridden·by·passing·an·options·object·to·`cache.get()`.\n·····*\n·····*·Only·relevant·if·a·ttl·is·used.\n·····*/\n····noDeleteOnStaleGet?:·boolean\n\n····/**\n·····*·Set·to·true·to·allow·returning·stale·data·when·a\n·····*·{@link·OptionsBase.fetchMethod}·throws·an·error·or·returns·a·rejected\n·····*·promise.\n·····*\n·····*·This·differs·from·using·{@link·OptionsBase.allowStale}·in·that·stale\n·····*·data·will·ONLY·be·returned·in·the·case·that·the·{@link·LRUCache#fetch}\n·····*·fails,·not·any·other·times.\n·····*\n·····*·If·a·`fetchMethod`·fails,·and·there·is·no·stale·value·available,·the\n·····*·`fetch()`·will·resolve·to·`undefined`.·Ie,·all·`fetchMethod`·errors·are\n·····*·suppressed.\n·····*\n·····*·Implies·`noDeleteOnFetchRejection`.\n·····*\n·····*·This·may·be·set·in·calls·to·`fetch()`,·or·defaulted·on·the·constructor,\n·····*·or·overridden·by·modifying·the·options·object·in·the·`fetchMethod`.\n·····*/\n····allowStaleOnFetchRejection?:·boolean\n\n····/**\n·····*·Set·to·true·to·return·a·stale·value·from·the·cache·when·the\n·····*·`AbortSignal`·passed·to·the·{@link·OptionsBase.fetchMethod}·dispatches\n·····*·an·`'abort'`·event,·whether·user-triggered,·or·due·to·internal·cache\n·····*·behavior.\n·····*\n·····*·Unless·{@link·OptionsBase.ignoreFetchAbort}·is·also·set,·the·underlying\n·····*·{@link·OptionsBase.fetchMethod}·will·still·be·considered·canceled,·and\n·····*·any·value·it·returns·will·be·ignored·and·not·cached.\n·····*\n·····*·Caveat:·since·fetches·are·aborted·when·a·new·value·is·explicitly\n·····*·set·in·the·cache,·this·can·lead·to·fetch·returning·a·stale·value,\n·····*·since·that·was·the·fallback·value·_at·the·moment·the·`fetch()`·was\n·····*·initiated_,·even·though·the·new·updated·value·is·now·present·in\n·····*·the·cache.\n·····*\n·····*·For·example:\n·····*\n·····*·```ts\n·····*·const·cache·=·new·LRUCache<string,·any>({\n·····*···ttl:·100,\n·····*···fetchMethod:·async·(url,·oldValue,·{·signal·})·=>··{\n·····*·····const·res·=·await·fetch(url,·{·signal·})\n·····*·····return·await·res.json()\n·····*···}\n·····*·})\n·····*·cache.set('https://example.com/',·{·some:·'data'·})\n·····*·//·100ms·go·by...\n·····*·const·result·=·cache.fetch('https://example.com/')\n·····*·cache.set('https://example.com/',·{·other:·'thing'·})\n·····*·console.log(await·result)·//·{·some:·'data'·}\n·····*·console.log(cache.get('https://example.com/'))·//·{·other:·'thing'·}\n·····*·```\n·····*/\n····allowStaleOnFetchAbort?:·boolean\n\n····/**\n·····*·Set·to·true·to·ignore·the·`abort`·event·emitted·by·the·`AbortSignal`\n·····*·object·passed·to·{@link·OptionsBase.fetchMethod},·and·still·cache·the\n·····*·resulting·resolution·value,·as·long·as·it·is·not·`undefined`.\n·····*\n·····*·When·used·on·its·own,·this·means·aborted·{@link·LRUCache#fetch}·calls\n·····*·are·not·immediately·resolved·or·rejected·when·they·are·aborted,·and\n·····*·instead·take·the·full·time·to·await.\n·····*\n·····*·When·used·with·{@link·OptionsBase.allowStaleOnFetchAbort},·aborted\n·····*·{@link·LRUCache#fetch}·calls·will·resolve·immediately·to·their·stale\n·····*·cached·value·or·`undefined`,·and·will·continue·to·process·and·eventually\n·····*·update·the·cache·when·they·resolve,·as·long·as·the·resulting·value·is\n·····*·not·`undefined`,·thus·supporting·a·\"return·stale·on·timeout·while\n·····*·refreshing\"·mechanism·by·passing·`AbortSignal.timeout(n)`·as·the·signal.\n·····*\n·····*·For·example:\n·····*\n·····*·```ts\n·····*·const·c·=·new·LRUCache({\n·····*···ttl:·100,\n·····*···ignoreFetchAbort:·true,\n·····*···allowStaleOnFetchAbort:·true,\n·····*···fetchMethod:·async·(key,·oldValue,·{·signal·})·=>·{\n·····*·····//·note:·do·NOT·pass·the·signal·to·fetch()!\n·····*·····//·let's·say·this·fetch·can·take·a·long·time.\n·····*·····const·res·=·await·fetch(`https://slow-backend-server/${key}`)\n·····*·····return·await·res.json()\n·····*···},\n·····*·})\n·····*\n·····*·//·this·will·return·the·stale·value·after·100ms,·while·still\n·····*·//·updating·in·the·background·for·next·time.\n·····*·const·val·=·await·c.fetch('key',·{·signal:·AbortSignal.timeout(100)·})\n·····*·```\n·····*\n·····*·**Note**:·regardless·of·this·setting,·an·`abort`·event·_is·still\n·····*·emitted·on·the·`AbortSignal`·object_,·so·may·result·in·invalid·results\n·····*·when·passed·to·other·underlying·APIs·that·use·AbortSignals.\n·····*\n·····*·This·may·be·overridden·in·the·{@link·OptionsBase.fetchMethod}·or·the\n·····*·call·to·{@link·LRUCache#fetch}.\n·····*/\n····ignoreFetchAbort?:·boolean\n\n····/**\n·····*·In·some·cases,·you·may·want·to·swap·out·the·performance/Date·object\n·····*·used·for·TTL·tracking.·This·should·almost·certainly·NOT·be·done·in\n·····*·production·environments!\n·····*\n·····*·This·value·defaults·to·`global.performance`·if·it·has·a·`now()`·method,\n·····*·or·the·`global.Date`·object·otherwise.\n·····*/\n····perf?:·Perf\n··}\n\n··export·interface·OptionsMaxLimit<K,·V,·FC>·extends·OptionsBase<\n····K,\n····V,\n····FC\n··>·{\n····max:·Count\n··}\n··export·interface·OptionsTTLLimit<K,·V,·FC>·extends·OptionsBase<\n····K,\n····V,\n····FC\n··>·{\n····ttl:·Milliseconds\n····ttlAutopurge:·boolean\n··}\n··export·interface·OptionsSizeLimit<K,·V,·FC>·extends·OptionsBase<\n····K,\n····V,\n····FC\n··>·{\n····maxSize:·Size\n··}\n\n··/**\n···*·The·valid·safe·options·for·the·{@link·LRUCache}·constructor\n···*/\n··export·type·Options<K,·V,·FC>·=\n····|·OptionsMaxLimit<K,·V,·FC>\n····|·OptionsSizeLimit<K,·V,·FC>\n····|·OptionsTTLLimit<K,·V,·FC>\n\n··/**\n···*·Entry·objects·used·by·{@link·LRUCache#load}·and·{@link·LRUCache#dump},\n···*·and·returned·by·{@link·LRUCache#info}.\n···*/\n··export·interface·Entry<V>·{\n····value:·V\n····ttl?:·Milliseconds\n····size?:·Size\n····start?:·Milliseconds\n··}\n}\n\n/**\n·*·Default·export,·the·thing·you're·using·this·module·to·get.\n·*\n·*·The·`K`·and·`V`·types·define·the·key·and·value·types,·respectively.·The\n·*·optional·`FC`·type·defines·the·type·of·the·`context`·object·passed·to\n·*·`cache.fetch()`·and·`cache.memo()`.\n·*\n·*·Keys·and·values·**must·not**·be·`null`·or·`undefined`.\n·*\n·*·All·properties·from·the·options·object·(with·the·exception·of·`max`,\n·*·`maxSize`,·`fetchMethod`,·`memoMethod`,·`dispose`·and·`disposeAfter`)·are\n·*·added·as·normal·public·members.·(The·listed·options·are·read-only·getters.)\n·*\n·*·Changing·any·of·these·will·alter·the·defaults·for·subsequent·method·calls.\n·*/\nexport·class·LRUCache<K·extends·{},·V·extends·{},·FC·=·unknown>·{\n··//·options·that·cannot·be·changed·without·disaster\n··readonly·#max:·LRUCache.Count\n··readonly·#maxSize:·LRUCache.Size\n··readonly·#dispose?:·LRUCache.Disposer<K,·V>\n··readonly·#onInsert?:·LRUCache.Inserter<K,·V>\n··readonly·#disposeAfter?:·LRUCache.Disposer<K,·V>\n··readonly·#fetchMethod?:·LRUCache.Fetcher<K,·V,·FC>\n··readonly·#memoMethod?:·LRUCache.Memoizer<K,·V,·FC>\n··readonly·#perf:·Perf\n\n··/**\n···*·{@link·LRUCache.OptionsBase.perf}\n···*/\n··get·perf()·{\n····return·this.#perf\n··}\n\n··/**\n···*·{@link·LRUCache.OptionsBase.ttl}\n···*/\n··ttl:·LRUCache.Milliseconds\n\n··/**\n···*·{@link·LRUCache.OptionsBase.ttlResolution}\n···*/\n··ttlResolution:·LRUCache.Milliseconds\n··/**\n···*·{@link·LRUCache.OptionsBase.ttlAutopurge}\n···*/\n··ttlAutopurge:·boolean\n··/**\n···*·{@link·LRUCache.OptionsBase.updateAgeOnGet}\n···*/\n··updateAgeOnGet:·boolean\n··/**\n···*·{@link·LRUCache.OptionsBase.updateAgeOnHas}\n···*/\n··updateAgeOnHas:·boolean\n··/**\n···*·{@link·LRUCache.OptionsBase.allowStale}\n···*/\n··allowStale:·boolean\n\n··/**\n···*·{@link·LRUCache.OptionsBase.noDisposeOnSet}\n···*/\n··noDisposeOnSet:·boolean\n··/**\n···*·{@link·LRUCache.OptionsBase.noUpdateTTL}\n···*/\n··noUpdateTTL:·boolean\n··/**\n···*·{@link·LRUCache.OptionsBase.maxEntrySize}\n···*/\n··maxEntrySize:·LRUCache.Size\n··/**\n···*·{@link·LRUCache.OptionsBase.sizeCalculation}\n···*/\n··sizeCalculation?:·LRUCache.SizeCalculator<K,·V>\n··/**\n···*·{@link·LRUCache.OptionsBase.noDeleteOnFetchRejection}\n···*/\n··noDeleteOnFetchRejection:·boolean\n··/**\n···*·{@link·LRUCache.OptionsBase.noDeleteOnStaleGet}\n···*/\n··noDeleteOnStaleGet:·boolean\n··/**\n···*·{@link·LRUCache.OptionsBase.allowStaleOnFetchAbort}\n···*/\n··allowStaleOnFetchAbort:·boolean\n··/**\n···*·{@link·LRUCache.OptionsBase.allowStaleOnFetchRejection}\n···*/\n··allowStaleOnFetchRejection:·boolean\n··/**\n···*·{@link·LRUCache.OptionsBase.ignoreFetchAbort}\n···*/\n··ignoreFetchAbort:·boolean\n\n··//·computed·properties\n··#size:·LRUCache.Count\n··#calculatedSize:·LRUCache.Size\n··#keyMap:·Map<K,·Index>\n··#keyList:·(K·|·undefined)[]\n··#valList:·(V·|·BackgroundFetch<V>·|·undefined)[]\n··#next:·NumberArray\n··#prev:·NumberArray\n··#head:·Index\n··#tail:·Index\n··#free:·StackLike\n··#disposed?:·DisposeTask<K,·V>[]\n··#sizes?:·ZeroArray\n··#starts?:·ZeroArray\n··#ttls?:·ZeroArray\n··#autopurgeTimers?:·(undefined·|·ReturnType<typeof·setTimeout>)[]\n\n··#hasDispose:·boolean\n··#hasFetchMethod:·boolean\n··#hasDisposeAfter:·boolean\n··#hasOnInsert:·boolean\n\n··/**\n···*·Do·not·call·this·method·unless·you·need·to·inspect·the\n···*·inner·workings·of·the·cache.··If·anything·returned·by·this\n···*·object·is·modified·in·any·way,·strange·breakage·may·occur.\n···*\n···*·These·fields·are·private·for·a·reason!\n···*\n···*·@internal\n···*/\n··static·unsafeExposeInternals<\n····K·extends·{},\n····V·extends·{},\n····FC·extends·unknown·=·unknown,\n··>(c:·LRUCache<K,·V,·FC>)·{\n····return·{\n······//·properties\n······starts:·c.#starts,\n······ttls:·c.#ttls,\n······autopurgeTimers:·c.#autopurgeTimers,\n······sizes:·c.#sizes,\n······keyMap:·c.#keyMap·as·Map<K,·number>,\n······keyList:·c.#keyList,\n······valList:·c.#valList,\n······next:·c.#next,\n······prev:·c.#prev,\n······get·head()·{\n········return·c.#head\n······},\n······get·tail()·{\n········return·c.#tail\n······},\n······free:·c.#free,\n······//·methods\n······isBackgroundFetch:·(p:·unknown)·=>·c.#isBackgroundFetch(p),\n······backgroundFetch:·(\n········k:·K,\n········index:·number·|·undefined,\n········options:·LRUCache.FetchOptions<K,·V,·FC>,\n········context:·unknown,\n······):·BackgroundFetch<V>·=>\n········c.#backgroundFetch(\n··········k,\n··········index·as·Index·|·undefined,\n··········options,\n··········context·as·FC,\n········),\n······moveToTail:·(index:·number):·void·=>·c.#moveToTail(index·as·Index),\n······indexes:·(options?:·{·allowStale:·boolean·})·=>·c.#indexes(options),\n······rindexes:·(options?:·{·allowStale:·boolean·})·=>\n········c.#rindexes(options),\n······isStale:·(index:·number·|·undefined)·=>·c.#isStale(index·as·Index),\n····}\n··}\n\n··//·Protected·read-only·members\n\n··/**\n···*·{@link·LRUCache.OptionsBase.max}·(read-only)\n···*/\n··get·max():·LRUCache.Count·{\n····return·this.#max\n··}\n··/**\n···*·{@link·LRUCache.OptionsBase.maxSize}·(read-only)\n···*/\n··get·maxSize():·LRUCache.Count·{\n····return·this.#maxSize\n··}\n··/**\n···*·The·total·computed·size·of·items·in·the·cache·(read-only)\n···*/\n··get·calculatedSize():·LRUCache.Size·{\n····return·this.#calculatedSize\n··}\n··/**\n···*·The·number·of·items·stored·in·the·cache·(read-only)\n···*/\n··get·size():·LRUCache.Count·{\n····return·this.#size\n··}\n··/**\n···*·{@link·LRUCache.OptionsBase.fetchMethod}·(read-only)\n···*/\n··get·fetchMethod():·LRUCache.Fetcher<K,·V,·FC>·|·undefined·{\n····return·this.#fetchMethod\n··}\n··get·memoMethod():·LRUCache.Memoizer<K,·V,·FC>·|·undefined·{\n····return·this.#memoMethod\n··}\n··/**\n···*·{@link·LRUCache.OptionsBase.dispose}·(read-only)\n···*/\n··get·dispose()·{\n····return·this.#dispose\n··}\n··/**\n···*·{@link·LRUCache.OptionsBase.onInsert}·(read-only)\n···*/\n··get·onInsert()·{\n····return·this.#onInsert\n··}\n··/**\n···*·{@link·LRUCache.OptionsBase.disposeAfter}·(read-only)\n···*/\n··get·disposeAfter()·{\n····return·this.#disposeAfter\n··}\n\n··constructor(options:·LRUCache.Options<K,·V,·FC>·|·LRUCache<K,·V,·FC>)·{\n····const·{\n······max·=·0,\n······ttl,\n······ttlResolution·=·1,\n······ttlAutopurge,\n······updateAgeOnGet,\n······updateAgeOnHas,\n······allowStale,\n······dispose,\n······onInsert,\n······disposeAfter,\n······noDisposeOnSet,\n······noUpdateTTL,\n······maxSize·=·0,\n······maxEntrySize·=·0,\n······sizeCalculation,\n······fetchMethod,\n······memoMethod,\n······noDeleteOnFetchRejection,\n······noDeleteOnStaleGet,\n······allowStaleOnFetchRejection,\n······allowStaleOnFetchAbort,\n······ignoreFetchAbort,\n······perf,\n····}·=·options\n\n····if·(perf·!==·undefined)·{\n······if·(typeof·perf?.now·!==·'function')·{\n········throw·new·TypeError(\n··········'perf·option·must·have·a·now()·method·if·specified',\n········)\n······}\n····}\n\n····this.#perf·=·perf·??·defaultPerf\n\n····if·(max·!==·0·&&·!isPosInt(max))·{\n······throw·new·TypeError('max·option·must·be·a·nonnegative·integer')\n····}\n\n····const·UintArray·=·max·?·getUintArray(max)·:·Array\n····if·(!UintArray)·{\n······throw·new·Error('invalid·max·value:·'·+·max)\n····}\n\n····this.#max·=·max\n····this.#maxSize·=·maxSize\n····this.maxEntrySize·=·maxEntrySize·||·this.#maxSize\n····this.sizeCalculation·=·sizeCalculation\n····if·(this.sizeCalculation)·{\n······if·(!this.#maxSize·&&·!this.maxEntrySize)·{\n········throw·new·TypeError(\n··········'cannot·set·sizeCalculation·without·setting·maxSize·or·maxEntrySize',\n········)\n······}\n······if·(typeof·this.sizeCalculation·!==·'function')·{\n········throw·new·TypeError('sizeCalculation·set·to·non-function')\n······}\n····}\n\n····if·(memoMethod·!==·undefined·&&·typeof·memoMethod·!==·'function')·{\n······throw·new·TypeError('memoMethod·must·be·a·function·if·defined')\n····}\n····this.#memoMethod·=·memoMethod\n\n····if·(fetchMethod·!==·undefined·&&·typeof·fetchMethod·!==·'function')·{\n······throw·new·TypeError('fetchMethod·must·be·a·function·if·specified')\n····}\n····this.#fetchMethod·=·fetchMethod\n····this.#hasFetchMethod·=·!!fetchMethod\n\n····this.#keyMap·=·new·Map()\n····this.#keyList·=·Array.from({·length:·max·}).fill(undefined)·as·(\n······|·K\n······|·undefined\n····)[]\n····this.#valList·=·Array.from({·length:·max·}).fill(undefined)·as·(\n······|·V\n······|·undefined\n····)[]\n····this.#next·=·new·UintArray(max)\n····this.#prev·=·new·UintArray(max)\n····this.#head·=·0·as·Index\n····this.#tail·=·0·as·Index\n····this.#free·=·Stack.create(max)\n····this.#size·=·0\n····this.#calculatedSize·=·0\n\n····if·(typeof·dispose·===·'function')·{\n······this.#dispose·=·dispose\n····}\n····if·(typeof·onInsert·===·'function')·{\n······this.#onInsert·=·onInsert\n····}\n····if·(typeof·disposeAfter·===·'function')·{\n······this.#disposeAfter·=·disposeAfter\n······this.#disposed·=·[]\n····}·else·{\n······this.#disposeAfter·=·undefined\n······this.#disposed·=·undefined\n····}\n····this.#hasDispose·=·!!this.#dispose\n····this.#hasOnInsert·=·!!this.#onInsert\n····this.#hasDisposeAfter·=·!!this.#disposeAfter\n\n····this.noDisposeOnSet·=·!!noDisposeOnSet\n····this.noUpdateTTL·=·!!noUpdateTTL\n····this.noDeleteOnFetchRejection·=·!!noDeleteOnFetchRejection\n····this.allowStaleOnFetchRejection·=·!!allowStaleOnFetchRejection\n····this.allowStaleOnFetchAbort·=·!!allowStaleOnFetchAbort\n····this.ignoreFetchAbort·=·!!ignoreFetchAbort\n\n····//·NB:·maxEntrySize·is·set·to·maxSize·if·it's·set\n····if·(this.maxEntrySize·!==·0)·{\n······if·(this.#maxSize·!==·0)·{\n········if·(!isPosInt(this.#maxSize))·{\n··········throw·new·TypeError(\n············'maxSize·must·be·a·positive·integer·if·specified',\n··········)\n········}\n······}\n······if·(!isPosInt(this.maxEntrySize))·{\n········throw·new·TypeError(\n··········'maxEntrySize·must·be·a·positive·integer·if·specified',\n········)\n······}\n······this.#initializeSizeTracking()\n····}\n\n····this.allowStale·=·!!allowStale\n····this.noDeleteOnStaleGet·=·!!noDeleteOnStaleGet\n····this.updateAgeOnGet·=·!!updateAgeOnGet\n····this.updateAgeOnHas·=·!!updateAgeOnHas\n····this.ttlResolution·=\n······isPosInt(ttlResolution)·||·ttlResolution·===·0·?·ttlResolution·:·1\n····this.ttlAutopurge·=·!!ttlAutopurge\n····this.ttl·=·ttl·||·0\n····if·(this.ttl)·{\n······if·(!isPosInt(this.ttl))·{\n········throw·new·TypeError('ttl·must·be·a·positive·integer·if·specified')\n······}\n······this.#initializeTTLTracking()\n····}\n\n····//·do·not·allow·completely·unbounded·caches\n····if·(this.#max·===·0·&&·this.ttl·===·0·&&·this.#maxSize·===·0)·{\n······throw·new·TypeError(\n········'At·least·one·of·max,·maxSize,·or·ttl·is·required',\n······)\n····}\n····if·(!this.ttlAutopurge·&&·!this.#max·&&·!this.#maxSize)·{\n······const·code·=·'LRU_CACHE_UNBOUNDED'\n······if·(shouldWarn(code))·{\n········warned.add(code)\n········const·msg·=\n··········'TTL·caching·without·ttlAutopurge,·max,·or·maxSize·can·'·+\n··········'result·in·unbounded·memory·consumption.'\n········emitWarning(msg,·'UnboundedCacheWarning',·code,·LRUCache)\n······}\n····}\n··}\n\n··/**\n···*·Return·the·number·of·ms·left·in·the·item's·TTL.·If·item·is·not·in·cache,\n···*·returns·`0`.·Returns·`Infinity`·if·item·is·in·cache·without·a·defined·TTL.\n···*/\n··getRemainingTTL(key:·K)·{\n····return·this.#keyMap.has(key)·?·Infinity·:·0\n··}\n\n··#initializeTTLTracking()·{\n····const·ttls·=·new·ZeroArray(this.#max)\n····const·starts·=·new·ZeroArray(this.#max)\n····this.#ttls·=·ttls\n····this.#starts·=·starts\n····const·purgeTimers·=\n······this.ttlAutopurge·?\n········Array.from<undefined·|·ReturnType<typeof·setTimeout>>({\n··········length:·this.#max,\n········})\n······:·undefined\n····this.#autopurgeTimers·=·purgeTimers\n\n····this.#setItemTTL·=·(index,·ttl,·start·=·this.#perf.now())·=>·{\n······starts[index]·=·ttl·!==·0·?·start·:·0\n······ttls[index]·=·ttl\n······setPurgetTimer(index,·ttl)\n····}\n\n····this.#updateItemAge·=·index·=>·{\n······starts[index]·=·ttls[index]·!==·0·?·this.#perf.now()·:·0\n······setPurgetTimer(index,·ttls[index])\n····}\n\n····//·clear·out·the·purge·timer·if·we're·setting·TTL·to·0,·and\n····//·previously·had·a·ttl·purge·timer·running,·so·it·doesn't\n····//·fire·unnecessarily.·Don't·need·to·do·this·if·we're·not·doing\n····//·autopurge.\n····const·setPurgetTimer·=\n······!this.ttlAutopurge·?\n········()·=>·{}\n······:·(index:·Index,·ttl?:·number)·=>·{\n··········if·(purgeTimers?.[index])·{\n············clearTimeout(purgeTimers[index])\n············purgeTimers[index]·=·undefined\n··········}\n··········if·(ttl·&&·ttl·!==·0·&&·purgeTimers)·{\n············const·t·=·setTimeout(()·=>·{\n··············if·(this.#isStale(index))·{\n················this.#delete(this.#keyList[index]·as·K,·'expire')\n··············}\n············},·ttl·+·1)\n············//·unref()·not·supported·on·all·platforms\n············/*·c8·ignore·start·*/\n············if·(t.unref)·{\n··············t.unref()\n············}\n············/*·c8·ignore·stop·*/\n············purgeTimers[index]·=·t\n··········}\n········}\n\n····this.#statusTTL·=·(status,·index)·=>·{\n······if·(ttls[index])·{\n········const·ttl·=·ttls[index]\n········const·start·=·starts[index]\n········/*·c8·ignore·start·*/\n········if·(!ttl·||·!start)·{\n··········return\n········}\n········/*·c8·ignore·stop·*/\n········status.ttl·=·ttl\n········status.start·=·start\n········status.now·=·cachedNow·||·getNow()\n········const·age·=·status.now·-·start\n········status.remainingTTL·=·ttl·-·age\n······}\n····}\n\n····//·debounce·calls·to·perf.now()·to·1s·so·we're·not·hitting\n····//·that·costly·call·repeatedly.\n····let·cachedNow·=·0\n····const·getNow·=·()·=>·{\n······const·n·=·this.#perf.now()\n······if·(this.ttlResolution·>·0)·{\n········cachedNow·=·n\n········const·t·=·setTimeout(()·=>·(cachedNow·=·0),·this.ttlResolution)\n········//·not·available·on·all·platforms\n········/*·c8·ignore·start·*/\n········if·(t.unref)·{\n··········t.unref()\n········}\n········/*·c8·ignore·stop·*/\n······}\n······return·n\n····}\n\n····this.getRemainingTTL·=·key·=>·{\n······const·index·=·this.#keyMap.get(key)\n······if·(index·===·undefined)·{\n········return·0\n······}\n······const·ttl·=·ttls[index]\n······const·start·=·starts[index]\n······if·(!ttl·||·!start)·{\n········return·Infinity\n······}\n······const·age·=·(cachedNow·||·getNow())·-·start\n······return·ttl·-·age\n····}\n\n····this.#isStale·=·index·=>·{\n······const·s·=·starts[index]\n······const·t·=·ttls[index]\n······return·!!t·&&·!!s·&&·(cachedNow·||·getNow())·-·s·>·t\n····}\n··}\n\n··//·conditionally·set·private·methods·related·to·TTL\n··#updateItemAge:·(index:·Index)·=>·void·=·()·=>·{}\n··#statusTTL:·(status:·LRUCache.Status<K,·V>,·index:·Index)·=>·void·=\n····()·=>·{}\n··#setItemTTL:·(\n····index:·Index,\n····ttl:·LRUCache.Milliseconds,\n····start?:·LRUCache.Milliseconds,\n····//·ignore·because·we·never·call·this·if·we're·not·already·in·TTL·mode\n····/*·c8·ignore·start·*/\n··)·=>·void·=·()·=>·{}\n··/*·c8·ignore·stop·*/\n\n··#isStale:·(index:·Index)·=>·boolean·=·()·=>·false\n\n··#initializeSizeTracking()·{\n····const·sizes·=·new·ZeroArray(this.#max)\n····this.#calculatedSize·=·0\n····this.#sizes·=·sizes\n····this.#removeItemSize·=·index·=>·{\n······this.#calculatedSize·-=·sizes[index]·as·number\n······sizes[index]·=·0\n····}\n····this.#requireSize·=·(k,·v,·size,·sizeCalculation)·=>·{\n······//·provisionally·accept·background·fetches.\n······//·actual·value·size·will·be·checked·when·they·return.\n······if·(this.#isBackgroundFetch(v))·{\n········return·0\n······}\n······if·(!isPosInt(size))·{\n········if·(sizeCalculation)·{\n··········if·(typeof·sizeCalculation·!==·'function')·{\n············throw·new·TypeError('sizeCalculation·must·be·a·function')\n··········}\n··········size·=·sizeCalculation(v,·k)\n··········if·(!isPosInt(size))·{\n············throw·new·TypeError(\n··············'sizeCalculation·return·invalid·(expect·positive·integer)',\n············)\n··········}\n········}·else·{\n··········throw·new·TypeError(\n············'invalid·size·value·(must·be·positive·integer).·'·+\n··············'When·maxSize·or·maxEntrySize·is·used,·sizeCalculation·'·+\n··············'or·size·must·be·set.',\n··········)\n········}\n······}\n······return·size\n····}\n\n····this.#addItemSize·=·(\n······index:·Index,\n······size:·LRUCache.Size,\n······status?:·LRUCache.Status<K,·V>,\n····)·=>·{\n······sizes[index]·=·size\n······if·(this.#maxSize)·{\n········const·maxSize·=·this.#maxSize·-·(sizes[index]·as·number)\n········while·(this.#calculatedSize·>·maxSize)·{\n··········this.#evict(true)\n········}\n······}\n······this.#calculatedSize·+=·sizes[index]·as·number\n······if·(status)·{\n········status.entrySize·=·size\n········status.totalCalculatedSize·=·this.#calculatedSize\n······}\n····}\n··}\n\n··#removeItemSize:·(index:·Index)·=>·void·=·_i·=>·{}\n\n··#addItemSize:·(\n····index:·Index,\n····size:·LRUCache.Size,\n····status?:·LRUCache.Status<K,·V>,\n··)·=>·void·=·(_i,·_s,·_st)·=>·{}\n\n··#requireSize:·(\n····k:·K,\n····v:·V·|·BackgroundFetch<V>,\n····size?:·LRUCache.Size,\n····sizeCalculation?:·LRUCache.SizeCalculator<K,·V>,\n····status?:·LRUCache.Status<K,·V>,\n··)·=>·LRUCache.Size·=·(\n····_k:·K,\n····_v:·V·|·BackgroundFetch<V>,\n····size?:·LRUCache.Size,\n····sizeCalculation?:·LRUCache.SizeCalculator<K,·V>,\n··)·=>·{\n····if·(size·||·sizeCalculation)·{\n······throw·new·TypeError(\n········'cannot·set·size·without·setting·maxSize·or·maxEntrySize·on·cache',\n······)\n····}\n····return·0\n··};\n\n··*#indexes({·allowStale·=·this.allowStale·}·=·{})·{\n····if·(this.#size)·{\n······for·(let·i·=·this.#tail;·this.#isValidIndex(i);·)·{\n········if·(allowStale·||·!this.#isStale(i))·{\n··········yield·i\n········}\n········if·(i·===·this.#head)·{\n··········break\n········}·else·{\n··········i·=·this.#prev[i]·as·Index\n········}\n······}\n····}\n··}\n\n··*#rindexes({·allowStale·=·this.allowStale·}·=·{})·{\n····if·(this.#size)·{\n······for·(let·i·=·this.#head;·this.#isValidIndex(i);·)·{\n········if·(allowStale·||·!this.#isStale(i))·{\n··········yield·i\n········}\n········if·(i·===·this.#tail)·{\n··········break\n········}·else·{\n··········i·=·this.#next[i]·as·Index\n········}\n······}\n····}\n··}\n\n··#isValidIndex(index:·Index)·{\n····return·(\n······index·!==·undefined·&&\n······this.#keyMap.get(this.#keyList[index]·as·K)·===·index\n····)\n··}\n\n··/**\n···*·Return·a·generator·yielding·`[key,·value]`·pairs,\n···*·in·order·from·most·recently·used·to·least·recently·used.\n···*/\n··*entries()·{\n····for·(const·i·of·this.#indexes())·{\n······if·(\n········this.#valList[i]·!==·undefined·&&\n········this.#keyList[i]·!==·undefined·&&\n········!this.#isBackgroundFetch(this.#valList[i])\n······)·{\n········yield·[this.#keyList[i],·this.#valList[i]]·as·[K,·V]\n······}\n····}\n··}\n\n··/**\n···*·Inverse·order·version·of·{@link·LRUCache.entries}\n···*\n···*·Return·a·generator·yielding·`[key,·value]`·pairs,\n···*·in·order·from·least·recently·used·to·most·recently·used.\n···*/\n··*rentries()·{\n····for·(const·i·of·this.#rindexes())·{\n······if·(\n········this.#valList[i]·!==·undefined·&&\n········this.#keyList[i]·!==·undefined·&&\n········!this.#isBackgroundFetch(this.#valList[i])\n······)·{\n········yield·[this.#keyList[i],·this.#valList[i]]\n······}\n····}\n··}\n\n··/**\n···*·Return·a·generator·yielding·the·keys·in·the·cache,\n···*·in·order·from·most·recently·used·to·least·recently·used.\n···*/\n··*keys()·{\n····for·(const·i·of·this.#indexes())·{\n······const·k·=·this.#keyList[i]\n······if·(k·!==·undefined·&&·!this.#isBackgroundFetch(this.#valList[i]))·{\n········yield·k\n······}\n····}\n··}\n\n··/**\n···*·Inverse·order·version·of·{@link·LRUCache.keys}\n···*\n···*·Return·a·generator·yielding·the·keys·in·the·cache,\n···*·in·order·from·least·recently·used·to·most·recently·used.\n···*/\n··*rkeys()·{\n····for·(const·i·of·this.#rindexes())·{\n······const·k·=·this.#keyList[i]\n······if·(k·!==·undefined·&&·!this.#isBackgroundFetch(this.#valList[i]))·{\n········yield·k\n······}\n····}\n··}\n\n··/**\n···*·Return·a·generator·yielding·the·values·in·the·cache,\n···*·in·order·from·most·recently·used·to·least·recently·used.\n···*/\n··*values()·{\n····for·(const·i·of·this.#indexes())·{\n······const·v·=·this.#valList[i]\n······if·(v·!==·undefined·&&·!this.#isBackgroundFetch(this.#valList[i]))·{\n········yield·this.#valList[i]·as·V\n······}\n····}\n··}\n\n··/**\n···*·Inverse·order·version·of·{@link·LRUCache.values}\n···*\n···*·Return·a·generator·yielding·the·values·in·the·cache,\n···*·in·order·from·least·recently·used·to·most·recently·used.\n···*/\n··*rvalues()·{\n····for·(const·i·of·this.#rindexes())·{\n······const·v·=·this.#valList[i]\n······if·(v·!==·undefined·&&·!this.#isBackgroundFetch(this.#valList[i]))·{\n········yield·this.#valList[i]\n······}\n····}\n··}\n\n··/**\n···*·Iterating·over·the·cache·itself·yields·the·same·results·as\n···*·{@link·LRUCache.entries}\n···*/\n··[Symbol.iterator]()·{\n····return·this.entries()\n··}\n\n··/**\n···*·A·String·value·that·is·used·in·the·creation·of·the·default·string\n···*·description·of·an·object.·Called·by·the·built-in·method\n···*·`Object.prototype.toString`.\n···*/\n··[Symbol.toStringTag]·=·'LRUCache'\n\n··/**\n···*·Find·a·value·for·which·the·supplied·fn·method·returns·a·truthy·value,\n···*·similar·to·`Array.find()`.·fn·is·called·as·`fn(value,·key,·cache)`.\n···*/\n··find(\n····fn:·(v:·V,·k:·K,·self:·LRUCache<K,·V,·FC>)·=>·boolean,\n····getOptions:·LRUCache.GetOptions<K,·V,·FC>·=·{},\n··)·{\n····for·(const·i·of·this.#indexes())·{\n······const·v·=·this.#valList[i]\n······const·value·=·this.#isBackgroundFetch(v)·?·v.__staleWhileFetching·:·v\n······if·(value·===·undefined)·continue\n······if·(fn(value,·this.#keyList[i]·as·K,·this))·{\n········return·this.#get(this.#keyList[i]·as·K,·getOptions)\n······}\n····}\n··}\n\n··/**\n···*·Call·the·supplied·function·on·each·item·in·the·cache,·in·order·from·most\n···*·recently·used·to·least·recently·used.\n···*\n···*·`fn`·is·called·as·`fn(value,·key,·cache)`.\n···*\n···*·If·`thisp`·is·provided,·function·will·be·called·in·the·`this`-context·of\n···*·the·provided·object,·or·the·cache·if·no·`thisp`·object·is·provided.\n···*\n···*·Does·not·update·age·or·recenty·of·use,·or·iterate·over·stale·values.\n···*/\n··forEach(\n····fn:·(v:·V,·k:·K,·self:·LRUCache<K,·V,·FC>)·=>·unknown,\n····thisp:·unknown·=·this,\n··)·{\n····for·(const·i·of·this.#indexes())·{\n······const·v·=·this.#valList[i]\n······const·value·=·this.#isBackgroundFetch(v)·?·v.__staleWhileFetching·:·v\n······if·(value·===·undefined)·continue\n······fn.call(thisp,·value,·this.#keyList[i]·as·K,·this)\n····}\n··}\n\n··/**\n···*·The·same·as·{@link·LRUCache.forEach}·but·items·are·iterated·over·in\n···*·reverse·order.··(ie,·less·recently·used·items·are·iterated·over·first.)\n···*/\n··rforEach(\n····fn:·(v:·V,·k:·K,·self:·LRUCache<K,·V,·FC>)·=>·unknown,\n····thisp:·unknown·=·this,\n··)·{\n····for·(const·i·of·this.#rindexes())·{\n······const·v·=·this.#valList[i]\n······const·value·=·this.#isBackgroundFetch(v)·?·v.__staleWhileFetching·:·v\n······if·(value·===·undefined)·continue\n······fn.call(thisp,·value,·this.#keyList[i]·as·K,·this)\n····}\n··}\n\n··/**\n···*·Delete·any·stale·entries.·Returns·true·if·anything·was·removed,\n···*·false·otherwise.\n···*/\n··purgeStale()·{\n····let·deleted·=·false\n····for·(const·i·of·this.#rindexes({·allowStale:·true·}))·{\n······if·(this.#isStale(i))·{\n········this.#delete(this.#keyList[i]·as·K,·'expire')\n········deleted·=·true\n······}\n····}\n····return·deleted\n··}\n\n··/**\n···*·Get·the·extended·info·about·a·given·entry,·to·get·its·value,·size,·and\n···*·TTL·info·simultaneously.·Returns·`undefined`·if·the·key·is·not·present.\n···*\n···*·Unlike·{@link·LRUCache#dump},·which·is·designed·to·be·portable·and·survive\n···*·serialization,·the·`start`·value·is·always·the·current·timestamp,·and·the\n···*·`ttl`·is·a·calculated·remaining·time·to·live·(negative·if·expired).\n···*\n···*·Always·returns·stale·values,·if·their·info·is·found·in·the·cache,·so·be\n···*·sure·to·check·for·expirations·(ie,·a·negative·{@link·LRUCache.Entry#ttl})\n···*·if·relevant.\n···*/\n··info(key:·K):·LRUCache.Entry<V>·|·undefined·{\n····const·i·=·this.#keyMap.get(key)\n····if·(i·===·undefined)·return·undefined\n····const·v·=·this.#valList[i]\n····/*·c8·ignore·start·-·this·isn't·tested·for·the·info·function,\n·····*·but·it's·the·same·logic·as·found·in·other·places.·*/\n····const·value:·V·|·undefined·=\n······this.#isBackgroundFetch(v)·?·v.__staleWhileFetching·:·v\n····if·(value·===·undefined)·return·undefined\n····/*·c8·ignore·stop·*/\n····const·entry:·LRUCache.Entry<V>·=·{·value·}\n····if·(this.#ttls·&&·this.#starts)·{\n······const·ttl·=·this.#ttls[i]\n······const·start·=·this.#starts[i]\n······if·(ttl·&&·start)·{\n········const·remain·=·ttl·-·(this.#perf.now()·-·start)\n········entry.ttl·=·remain\n········entry.start·=·Date.now()\n······}\n····}\n····if·(this.#sizes)·{\n······entry.size·=·this.#sizes[i]\n····}\n····return·entry\n··}\n\n··/**\n···*·Return·an·array·of·[key,·{@link·LRUCache.Entry}]·tuples·which·can·be\n···*·passed·to·{@link·LRUCache#load}.\n···*\n···*·The·`start`·fields·are·calculated·relative·to·a·portable·`Date.now()`\n···*·timestamp,·even·if·`performance.now()`·is·available.\n···*\n···*·Stale·entries·are·always·included·in·the·`dump`,·even·if\n···*·{@link·LRUCache.OptionsBase.allowStale}·is·false.\n···*\n···*·Note:·this·returns·an·actual·array,·not·a·generator,·so·it·can·be·more\n···*·easily·passed·around.\n···*/\n··dump()·{\n····const·arr:·[K,·LRUCache.Entry<V>][]·=·[]\n····for·(const·i·of·this.#indexes({·allowStale:·true·}))·{\n······const·key·=·this.#keyList[i]\n······const·v·=·this.#valList[i]\n······const·value:·V·|·undefined·=\n········this.#isBackgroundFetch(v)·?·v.__staleWhileFetching·:·v\n······if·(value·===·undefined·||·key·===·undefined)·continue\n······const·entry:·LRUCache.Entry<V>·=·{·value·}\n······if·(this.#ttls·&&·this.#starts)·{\n········entry.ttl·=·this.#ttls[i]\n········//·always·dump·the·start·relative·to·a·portable·timestamp\n········//·it's·ok·for·this·to·be·a·bit·slow,·it's·a·rare·operation.\n········const·age·=·this.#perf.now()·-·(this.#starts[i]·as·number)\n········entry.start·=·Math.floor(Date.now()·-·age)\n······}\n······if·(this.#sizes)·{\n········entry.size·=·this.#sizes[i]\n······}\n······arr.unshift([key,·entry])\n····}\n····return·arr\n··}\n\n··/**\n···*·Reset·the·cache·and·load·in·the·items·in·entries·in·the·order·listed.\n···*\n···*·The·shape·of·the·resulting·cache·may·be·different·if·the·same·options·are\n···*·not·used·in·both·caches.\n···*\n···*·The·`start`·fields·are·assumed·to·be·calculated·relative·to·a·portable\n···*·`Date.now()`·timestamp,·even·if·`performance.now()`·is·available.\n···*/\n··load(arr:·[K,·LRUCache.Entry<V>][])·{\n····this.clear()\n····for·(const·[key,·entry]·of·arr)·{\n······if·(entry.start)·{\n········//·entry.start·is·a·portable·timestamp,·but·we·may·be·using\n········//·node's·performance.now(),·so·calculate·the·offset,·so·that\n········//·we·get·the·intended·remaining·TTL,·no·matter·how·long·it's\n········//·been·on·ice.\n········//\n········//·it's·ok·for·this·to·be·a·bit·slow,·it's·a·rare·operation.\n········const·age·=·Date.now()·-·entry.start\n········entry.start·=·this.#perf.now()·-·age\n······}\n······this.#set(key,·entry.value,·entry)\n····}\n··}\n\n··/**\n···*·Add·a·value·to·the·cache.\n···*\n···*·Note:·if·`undefined`·is·specified·as·a·value,·this·is·an·alias·for\n···*·{@link·LRUCache#delete}\n···*\n···*·Fields·on·the·{@link·LRUCache.SetOptions}·options·param·will·override\n···*·their·corresponding·values·in·the·constructor·options·for·the·scope\n···*·of·this·single·`set()`·operation.\n···*\n···*·If·`start`·is·provided,·then·that·will·set·the·effective·start\n···*·time·for·the·TTL·calculation.·Note·that·this·must·be·a·previous\n···*·value·of·`performance.now()`·if·supported,·or·a·previous·value·of\n···*·`Date.now()`·if·not.\n···*\n···*·Options·object·may·also·include·`size`,·which·will·prevent\n···*·calling·the·`sizeCalculation`·function·and·just·use·the·specified\n···*·number·if·it·is·a·positive·integer,·and·`noDisposeOnSet`·which\n···*·will·prevent·calling·a·`dispose`·function·in·the·case·of\n···*·overwrites.\n···*\n···*·If·the·`size`·(or·return·value·of·`sizeCalculation`)·for·a·given\n···*·entry·is·greater·than·`maxEntrySize`,·then·the·item·will·not·be\n···*·added·to·the·cache.\n···*\n···*·Will·update·the·recency·of·the·entry.\n···*\n···*·If·the·value·is·`undefined`,·then·this·is·an·alias·for\n···*·`cache.delete(key)`.·`undefined`·is·never·stored·in·the·cache.\n···*/\n··set(\n····k:·K,\n····v:·V·|·undefined,\n····setOptions:·LRUCache.SetOptions<K,·V,·FC>·=·{},\n··)·{\n····const·{·status·=·metrics.hasSubscribers·?·{}·:·undefined·}·=·setOptions\n····setOptions.status·=·status\n····if·(status)·{\n······status.op·=·'set'\n······status.key·=·k\n······if·(v·!==·undefined)·status.value·=·v\n····}\n····const·result·=·this.#set(k,·v,·setOptions)\n····if·(status·&&·metrics.hasSubscribers)·{\n······metrics.publish(status)\n····}\n····return·result\n··}\n\n··#set(\n····k:·K,\n····v:·V·|·BackgroundFetch<V>·|·undefined,\n····setOptions:·LRUCache.SetOptions<K,·V,·FC>·=·{},\n··)·{\n····const·{\n······ttl·=·this.ttl,\n······start,\n······noDisposeOnSet·=·this.noDisposeOnSet,\n······sizeCalculation·=·this.sizeCalculation,\n······status,\n····}·=·setOptions\n\n····if·(v·===·undefined)·{\n······if·(status)·status.set·=·'deleted'\n······this.delete(k)\n······return·this\n····}\n····let·{·noUpdateTTL·=·this.noUpdateTTL·}·=·setOptions\n\n····if·(status·&&·!this.#isBackgroundFetch(v))·status.value·=·v\n\n····const·size·=·this.#requireSize(\n······k,\n······v,\n······setOptions.size·||·0,\n······sizeCalculation,\n······status,\n····)\n····//·if·the·item·doesn't·fit,·don't·do·anything\n····//·NB:·maxEntrySize·set·to·maxSize·by·default\n····if·(this.maxEntrySize·&&·size·>·this.maxEntrySize)·{\n······//·have·to·delete,·in·case·something·is·there·already.\n······this.#delete(k,·'set')\n······if·(status)·{\n········status.set·=·'miss'\n········status.maxEntrySizeExceeded·=·true\n······}\n······return·this\n····}\n····let·index·=·this.#size·===·0·?·undefined·:·this.#keyMap.get(k)\n····if·(index·===·undefined)·{\n······//·addition\n······index·=·(\n········this.#size·===·0·?·this.#tail\n········:·this.#free.length·!==·0·?·this.#free.pop()\n········:·this.#size·===·this.#max·?·this.#evict(false)\n········:·this.#size)·as·Index\n······this.#keyList[index]·=·k\n······this.#valList[index]·=·v\n······this.#keyMap.set(k,·index)\n······this.#next[this.#tail]·=·index\n······this.#prev[index]·=·this.#tail\n······this.#tail·=·index\n······this.#size++\n······this.#addItemSize(index,·size,·status)\n······if·(status)·status.set·=·'add'\n······noUpdateTTL·=·false\n······if·(this.#hasOnInsert)·{\n········this.#onInsert?.(v·as·V,·k,·'add')\n······}\n····}·else·{\n······//·update\n······this.#moveToTail(index)\n······const·oldVal·=·this.#valList[index]·as·V·|·BackgroundFetch<V>\n······if·(v·!==·oldVal)·{\n········if·(this.#hasFetchMethod·&&·this.#isBackgroundFetch(oldVal))·{\n··········oldVal.__abortController.abort(new·Error('replaced'))\n··········const·{·__staleWhileFetching:·s·}·=·oldVal\n··········if·(s·!==·undefined·&&·!noDisposeOnSet)·{\n············if·(this.#hasDispose)·{\n··············this.#dispose?.(s·as·V,·k,·'set')\n············}\n············if·(this.#hasDisposeAfter)·{\n··············this.#disposed?.push([s·as·V,·k,·'set'])\n············}\n··········}\n········}·else·if·(!noDisposeOnSet)·{\n··········if·(this.#hasDispose)·{\n············this.#dispose?.(oldVal·as·V,·k,·'set')\n··········}\n··········if·(this.#hasDisposeAfter)·{\n············this.#disposed?.push([oldVal·as·V,·k,·'set'])\n··········}\n········}\n········this.#removeItemSize(index)\n········this.#addItemSize(index,·size,·status)\n········this.#valList[index]·=·v\n········if·(status)·{\n··········status.set·=·'replace'\n··········const·oldValue·=\n············oldVal·&&·this.#isBackgroundFetch(oldVal)·?\n··············oldVal.__staleWhileFetching\n············:·oldVal\n··········if·(oldValue·!==·undefined)·status.oldValue·=·oldValue\n········}\n······}·else·if·(status)·{\n········status.set·=·'update'\n······}\n\n······if·(this.#hasOnInsert)·{\n········this.onInsert?.(v·as·V,·k,·v·===·oldVal·?·'update'·:·'replace')\n······}\n····}\n····if·(ttl·!==·0·&&·!this.#ttls)·{\n······this.#initializeTTLTracking()\n····}\n····if·(this.#ttls)·{\n······if·(!noUpdateTTL)·{\n········this.#setItemTTL(index,·ttl,·start)\n······}\n······if·(status)·this.#statusTTL(status,·index)\n····}\n····if·(!noDisposeOnSet·&&·this.#hasDisposeAfter·&&·this.#disposed)·{\n······const·dt·=·this.#disposed\n······let·task:·DisposeTask<K,·V>·|·undefined\n······while·((task·=·dt?.shift()))·{\n········this.#disposeAfter?.(...task)\n······}\n····}\n····return·this\n··}\n\n··/**\n···*·Evict·the·least·recently·used·item,·returning·its·value·or\n···*·`undefined`·if·cache·is·empty.\n···*/\n··pop():·V·|·undefined·{\n····try·{\n······while·(this.#size)·{\n········const·val·=·this.#valList[this.#head]\n········this.#evict(true)\n········if·(this.#isBackgroundFetch(val))·{\n··········if·(val.__staleWhileFetching)·{\n············return·val.__staleWhileFetching\n··········}\n········}·else·if·(val·!==·undefined)·{\n··········return·val\n········}\n······}\n····}·finally·{\n······if·(this.#hasDisposeAfter·&&·this.#disposed)·{\n········const·dt·=·this.#disposed\n········let·task:·DisposeTask<K,·V>·|·undefined\n········while·((task·=·dt?.shift()))·{\n··········this.#disposeAfter?.(...task)\n········}\n······}\n····}\n··}\n\n··#evict(free:·boolean)·{\n····const·head·=·this.#head\n····const·k·=·this.#keyList[head]·as·K\n····const·v·=·this.#valList[head]·as·V\n····if·(this.#hasFetchMethod·&&·this.#isBackgroundFetch(v))·{\n······v.__abortController.abort(new·Error('evicted'))\n····}·else·if·(this.#hasDispose·||·this.#hasDisposeAfter)·{\n······if·(this.#hasDispose)·{\n········this.#dispose?.(v,·k,·'evict')\n······}\n······if·(this.#hasDisposeAfter)·{\n········this.#disposed?.push([v,·k,·'evict'])\n······}\n····}\n····this.#removeItemSize(head)\n····if·(this.#autopurgeTimers?.[head])·{\n······clearTimeout(this.#autopurgeTimers[head])\n······this.#autopurgeTimers[head]·=·undefined\n····}\n····//·if·we·aren't·about·to·use·the·index,·then·null·these·out\n····if·(free)·{\n······this.#keyList[head]·=·undefined\n······this.#valList[head]·=·undefined\n······this.#free.push(head)\n····}\n····if·(this.#size·===·1)·{\n······this.#head·=·this.#tail·=·0·as·Index\n······this.#free.length·=·0\n····}·else·{\n······this.#head·=·this.#next[head]·as·Index\n····}\n····this.#keyMap.delete(k)\n····this.#size--\n····return·head\n··}\n\n··/**\n···*·Check·if·a·key·is·in·the·cache,·without·updating·the·recency·of·use.\n···*·Will·return·false·if·the·item·is·stale,·even·though·it·is·technically\n···*·in·the·cache.\n···*\n···*·Check·if·a·key·is·in·the·cache,·without·updating·the·recency·of\n···*·use.·Age·is·updated·if·{@link·LRUCache.OptionsBase.updateAgeOnHas}·is·set\n···*·to·`true`·in·either·the·options·or·the·constructor.\n···*\n···*·Will·return·`false`·if·the·item·is·stale,·even·though·it·is·technically·in\n···*·the·cache.·The·difference·can·be·determined·(if·it·matters)·by·using·a\n···*·`status`·argument,·and·inspecting·the·`has`·field.\n···*\n···*·Will·not·update·item·age·unless\n···*·{@link·LRUCache.OptionsBase.updateAgeOnHas}·is·set.\n···*/\n··has(k:·K,·hasOptions:·LRUCache.HasOptions<K,·V,·FC>·=·{})·{\n····const·{·status·=·metrics.hasSubscribers·?·{}·:·undefined·}·=·hasOptions\n····hasOptions.status·=·status\n····if·(status)·{\n······status.op·=·'has'\n······status.key·=·k\n····}\n····const·result·=·this.#has(k,·hasOptions)\n····if·(metrics.hasSubscribers)·metrics.publish(status)\n····return·result\n··}\n··#has(k:·K,·hasOptions:·LRUCache.HasOptions<K,·V,·FC>·=·{})·{\n····const·{·updateAgeOnHas·=·this.updateAgeOnHas,·status·}·=·hasOptions\n····const·index·=·this.#keyMap.get(k)\n····if·(index·!==·undefined)·{\n······const·v·=·this.#valList[index]\n······if·(\n········this.#isBackgroundFetch(v)·&&\n········v.__staleWhileFetching·===·undefined\n······)·{\n········return·false\n······}\n······if·(!this.#isStale(index))·{\n········if·(updateAgeOnHas)·{\n··········this.#updateItemAge(index)\n········}\n········if·(status)·{\n··········status.has·=·'hit'\n··········this.#statusTTL(status,·index)\n········}\n········return·true\n······}·else·if·(status)·{\n········status.has·=·'stale'\n········this.#statusTTL(status,·index)\n······}\n····}·else·if·(status)·{\n······status.has·=·'miss'\n····}\n····return·false\n··}\n\n··/**\n···*·Like·{@link·LRUCache#get}·but·doesn't·update·recency·or·delete·stale\n···*·items.\n···*\n···*·Returns·`undefined`·if·the·item·is·stale,·unless\n···*·{@link·LRUCache.OptionsBase.allowStale}·is·set.\n···*/\n··peek(k:·K,·peekOptions:·LRUCache.PeekOptions<K,·V,·FC>·=·{})·{\n····const·{·status·=·hasSubscribers()·?·{}·:·undefined·}·=·peekOptions\n····if·(status)·{\n······status.op·=·'peek'\n······status.key·=·k\n····}\n····peekOptions.status·=·status\n····const·result·=·this.#peek(k,·peekOptions)\n····if·(metrics.hasSubscribers)·{\n······metrics.publish(status)\n····}\n····return·result\n··}\n··#peek(k:·K,·peekOptions:·LRUCache.PeekOptions<K,·V,·FC>)·{\n····const·{·status,·allowStale·=·this.allowStale·}·=·peekOptions\n····const·index·=·this.#keyMap.get(k)\n····if·(index·===·undefined·||·(!allowStale·&&·this.#isStale(index)))·{\n······if·(status)·status.peek·=·index·===·undefined·?·'miss'·:·'stale'\n······return·undefined\n····}\n····const·v·=·this.#valList[index]\n····const·val·=·this.#isBackgroundFetch(v)·?·v.__staleWhileFetching·:·v\n····if·(status)·{\n······if·(val·!==·undefined)·{\n········status.peek·=·'hit'\n········status.value·=·val\n······}·else·{\n········status.peek·=·'miss'\n······}\n····}\n····return·val\n··}\n\n··#backgroundFetch(\n····k:·K,\n····index:·Index·|·undefined,\n····options:·LRUCache.FetchOptions<K,·V,·FC>,\n····context:·FC,\n··):·BackgroundFetch<V>·{\n····const·v·=·index·===·undefined·?·undefined·:·this.#valList[index]\n····if·(this.#isBackgroundFetch(v))·{\n······return·v\n····}\n\n····const·ac·=·new·AbortController()\n····const·{·signal·}·=·options\n····//·when/if·our·AC·signals,·then·stop·listening·to·theirs.\n····signal?.addEventListener('abort',·()·=>·ac.abort(signal.reason),·{\n······signal:·ac.signal,\n····})\n\n····const·fetchOpts·=·{\n······signal:·ac.signal,\n······options,\n······context,\n····}\n\n····const·cb·=·(v:·V·|·undefined,·updateCache·=·false):·V·|·undefined·=>·{\n······const·{·aborted·}·=·ac.signal\n······const·ignoreAbort·=·options.ignoreFetchAbort·&&·v·!==·undefined\n······const·proceed·=\n········options.ignoreFetchAbort·||\n········!!(options.allowStaleOnFetchAbort·&&·v·!==·undefined)\n······if·(options.status)·{\n········if·(aborted·&&·!updateCache)·{\n··········options.status.fetchAborted·=·true\n··········options.status.fetchError·=·ac.signal.reason\n··········if·(ignoreAbort)·options.status.fetchAbortIgnored·=·true\n········}·else·{\n··········options.status.fetchResolved·=·true\n········}\n······}\n······if·(aborted·&&·!ignoreAbort·&&·!updateCache)·{\n········return·fetchFail(ac.signal.reason,·proceed)\n······}\n······//·either·we·didn't·abort,·and·are·still·here,·or·we·did,·and·ignored\n······const·bf·=·p·as·BackgroundFetch<V>\n······//·if·nothing·else·has·been·written·there·but·we're·set·to·update·the\n······//·cache·and·ignore·the·abort,·or·if·it's·still·pending·on·this·specific\n······//·background·request,·then·write·it·to·the·cache.\n······const·vl·=·this.#valList[index·as·Index]\n······if·(vl·===·p·||·(vl·===·undefined·&&·ignoreAbort·&&·updateCache))·{\n········if·(v·===·undefined)·{\n··········if·(bf.__staleWhileFetching·!==·undefined)·{\n············this.#valList[index·as·Index]·=·bf.__staleWhileFetching\n··········}·else·{\n············this.#delete(k,·'fetch')\n··········}\n········}·else·{\n··········if·(options.status)·options.status.fetchUpdated·=·true\n··········this.#set(k,·v,·fetchOpts.options)\n········}\n······}\n······return·v\n····}\n\n····const·eb·=·(er:·unknown)·=>·{\n······if·(options.status)·{\n········options.status.fetchRejected·=·true\n········options.status.fetchError·=·er·as·Error\n······}\n······//·do·not·pass·go,·do·not·collect·$200\n······return·fetchFail(er,·false)\n····}\n\n····const·fetchFail·=·(er:·unknown,·proceed:·boolean):·V·|·undefined·=>·{\n······const·{·aborted·}·=·ac.signal\n······const·allowStaleAborted·=·aborted·&&·options.allowStaleOnFetchAbort\n······const·allowStale·=\n········allowStaleAborted·||·options.allowStaleOnFetchRejection\n······const·noDelete·=·allowStale·||·options.noDeleteOnFetchRejection\n······const·bf·=·p·as·BackgroundFetch<V>\n······if·(this.#valList[index·as·Index]·===·p)·{\n········//·if·we·allow·stale·on·fetch·rejections,·then·we·need·to·ensure·that\n········//·the·stale·value·is·not·removed·from·the·cache·when·the·fetch·fails.\n········const·del·=\n··········!noDelete·||·(!proceed·&&·bf.__staleWhileFetching·===·undefined)\n········if·(del)·{\n··········this.#delete(k,·'fetch')\n········}·else·if·(!allowStaleAborted)·{\n··········//·still·replace·the·*promise*·with·the·stale·value,\n··········//·since·we·are·done·with·the·promise·at·this·point.\n··········//·leave·it·untouched·if·we're·still·waiting·for·an\n··········//·aborted·background·fetch·that·hasn't·yet·returned.\n··········this.#valList[index·as·Index]·=·bf.__staleWhileFetching\n········}\n······}\n······if·(allowStale)·{\n········if·(options.status·&&·bf.__staleWhileFetching·!==·undefined)·{\n··········options.status.returnedStale·=·true\n········}\n········return·bf.__staleWhileFetching\n······}·else·if·(bf.__returned·===·bf)·{\n········throw·er\n······}\n····}\n\n····const·pcall·=·(\n······res:·(v:·V·|·undefined)·=>·void,\n······rej:·(e:·unknown)·=>·void,\n····)·=>·{\n······const·fmp·=·this.#fetchMethod?.(k,·v,·fetchOpts)\n······if·(fmp·&&·fmp·instanceof·Promise)·{\n········fmp.then(v·=>·res(v·===·undefined·?·undefined·:·v),·rej)\n······}\n······//·ignored,·we·go·until·we·finish,·regardless.\n······//·defer·check·until·we·are·actually·aborting,\n······//·so·fetchMethod·can·override.\n······ac.signal.addEventListener('abort',·()·=>·{\n········if·(!options.ignoreFetchAbort·||·options.allowStaleOnFetchAbort)·{\n··········res(undefined)\n··········//·when·it·eventually·resolves,·update·the·cache.\n··········if·(options.allowStaleOnFetchAbort)·{\n············res·=·v·=>·cb(v,·true)\n··········}\n········}\n······})\n····}\n\n····if·(options.status)·options.status.fetchDispatched·=·true\n····const·p·=·new·Promise(pcall).then(cb,·eb)\n····const·bf:·BackgroundFetch<V>·=·Object.assign(p,·{\n······__abortController:·ac,\n······__staleWhileFetching:·v,\n······__returned:·undefined,\n····})\n\n····if·(index·===·undefined)·{\n······//·internal,·don't·expose·status.\n······this.#set(k,·bf,·{·...fetchOpts.options,·status:·undefined·})\n······index·=·this.#keyMap.get(k)\n····}·else·{\n······this.#valList[index]·=·bf\n····}\n····return·bf\n··}\n\n··#isBackgroundFetch(p:·unknown):·p·is·BackgroundFetch<V>·{\n····if·(!this.#hasFetchMethod)·return·false\n····const·b·=·p·as·BackgroundFetch<V>\n····return·(\n······!!b·&&\n······b·instanceof·Promise·&&\n······b.hasOwnProperty('__staleWhileFetching')·&&\n······b.__abortController·instanceof·AbortController\n····)\n··}\n\n··/**\n···*·Make·an·asynchronous·cached·fetch·using·the\n···*·{@link·LRUCache.OptionsBase.fetchMethod}·function.\n···*\n···*·If·the·value·is·in·the·cache·and·not·stale,·then·the·returned\n···*·Promise·resolves·to·the·value.\n···*\n···*·If·not·in·the·cache,·or·beyond·its·TTL·staleness,·then\n···*·`fetchMethod(key,·staleValue,·{·options,·signal,·context·})`·is\n···*·called,·and·the·value·returned·will·be·added·to·the·cache·once\n···*·resolved.\n···*\n···*·If·called·with·`allowStale`,·and·an·asynchronous·fetch·is\n···*·currently·in·progress·to·reload·a·stale·value,·then·the·former\n···*·stale·value·will·be·returned.\n···*\n···*·If·called·with·`forceRefresh`,·then·the·cached·item·will·be\n···*·re-fetched,·even·if·it·is·not·stale.·However,·if·`allowStale`·is·also\n···*·set,·then·the·old·value·will·still·be·returned.·This·is·useful\n···*·in·cases·where·you·want·to·force·a·reload·of·a·cached·value.·If\n···*·a·background·fetch·is·already·in·progress,·then·`forceRefresh`\n···*·has·no·effect.\n···*\n···*·If·multiple·fetches·for·the·same·key·are·issued,·then·they·will·all·be\n···*·coalesced·into·a·single·call·to·fetchMethod.\n···*\n···*·Note·that·this·means·that·handling·options·such·as\n···*·{@link·LRUCache.OptionsBase.allowStaleOnFetchAbort},\n···*·{@link·LRUCache.FetchOptions.signal},\n···*·and·{@link·LRUCache.OptionsBase.allowStaleOnFetchRejection}·will·be\n···*·determined·by·the·FIRST·fetch()·call·for·a·given·key.\n···*\n···*·This·is·a·known·(fixable)·shortcoming·which·will·be·addresed·on·when\n···*·someone·complains·about·it,·as·the·fix·would·involve·added·complexity·and\n···*·may·not·be·worth·the·costs·for·this·edge·case.\n···*\n···*·If·{@link·LRUCache.OptionsBase.fetchMethod}·is·not·specified,·then·this·is\n···*·effectively·an·alias·for·`Promise.resolve(cache.get(key))`.\n···*\n···*·When·the·fetch·method·resolves·to·a·value,·if·the·fetch·has·not\n···*·been·aborted·due·to·deletion,·eviction,·or·being·overwritten,\n···*·then·it·is·added·to·the·cache·using·the·options·provided.\n···*\n···*·If·the·key·is·evicted·or·deleted·before·the·`fetchMethod`\n···*·resolves,·then·the·AbortSignal·passed·to·the·`fetchMethod`·will\n···*·receive·an·`abort`·event,·and·the·promise·returned·by·`fetch()`\n···*·will·reject·with·the·reason·for·the·abort.\n···*\n···*·If·a·`signal`·is·passed·to·the·`fetch()`·call,·then·aborting·the\n···*·signal·will·abort·the·fetch·and·cause·the·`fetch()`·promise·to\n···*·reject·with·the·reason·provided.\n···*\n···*·**Setting·`context`**\n···*\n···*·If·an·`FC`·type·is·set·to·a·type·other·than·`unknown`,·`void`,·or\n···*·`undefined`·in·the·{@link·LRUCache}·constructor,·then·all\n···*·calls·to·`cache.fetch()`·_must_·provide·a·`context`·option.·If\n···*·set·to·`undefined`·or·`void`,·then·calls·to·fetch·_must·not_\n···*·provide·a·`context`·option.\n···*\n···*·The·`context`·param·allows·you·to·provide·arbitrary·data·that\n···*·might·be·relevant·in·the·course·of·fetching·the·data.·It·is·only\n···*·relevant·for·the·course·of·a·single·`fetch()`·operation,·and\n···*·discarded·afterwards.\n···*\n···*·**Note:·`fetch()`·calls·are·inflight-unique**\n···*\n···*·If·you·call·`fetch()`·multiple·times·with·the·same·key·value,\n···*·then·every·call·after·the·first·will·resolve·on·the·same\n···*·promise<sup>1</sup>,\n···*·_even·if·they·have·different·settings·that·would·otherwise·change\n···*·the·behavior·of·the·fetch_,·such·as·`noDeleteOnFetchRejection`\n···*·or·`ignoreFetchAbort`.\n···*\n···*·In·most·cases,·this·is·not·a·problem·(in·fact,·only·fetching\n···*·something·once·is·what·you·probably·want,·if·you're·caching·in\n···*·the·first·place).·If·you·are·changing·the·fetch()·options\n···*·dramatically·between·runs,·there's·a·good·chance·that·you·might\n···*·be·trying·to·fit·divergent·semantics·into·a·single·object,·and\n···*·would·be·better·off·with·multiple·cache·instances.\n···*\n···*·**1**:·Ie,·they're·not·the·\"same·Promise\",·but·they·resolve·at\n···*·the·same·time,·because·they're·both·waiting·on·the·same\n···*·underlying·fetchMethod·response.\n···*/\n\n··fetch(\n····k:·K,\n····fetchOptions:·unknown·extends·FC·?·LRUCache.FetchOptions<K,·V,·FC>\n····:·FC·extends·undefined·|·void·?·LRUCache.FetchOptionsNoContext<K,·V>\n····:·LRUCache.FetchOptionsWithContext<K,·V,·FC>,\n··):·Promise<undefined·|·V>\n\n··//·this·overload·not·allowed·if·context·is·required\n··fetch(\n····k:·unknown·extends·FC·?·K\n····:·FC·extends·undefined·|·void·?·K\n····:·never,\n····fetchOptions?:·unknown·extends·FC·?·LRUCache.FetchOptions<K,·V,·FC>\n····:·FC·extends·undefined·|·void·?·LRUCache.FetchOptionsNoContext<K,·V>\n····:·never,\n··):·Promise<undefined·|·V>\n··fetch(\n····k:·K,\n····fetchOptions:·LRUCache.FetchOptions<K,·V,·FC>·=·{},\n··):·Promise<undefined·|·V>·{\n····const·ths·=·tracing.hasSubscribers\n····const·{·status·=·hasSubscribers()·?·{}·:·undefined·}·=·fetchOptions\n····fetchOptions.status·=·status\n····if·(status·&&·fetchOptions.context)·{\n······status.context·=·fetchOptions.context\n····}\n····const·p·=·this.#fetch(k,·fetchOptions)\n····if·(status·&&·hasSubscribers())·{\n······if·(ths)·{\n········status.trace·=·true\n········tracing.tracePromise(()·=>·p,·status).catch(()·=>·{})\n······}\n····}\n····return·p\n··}\n\n··async·#fetch(\n····k:·K,\n····fetchOptions:·LRUCache.FetchOptions<K,·V,·FC>·=·{},\n··):·Promise<undefined·|·V>·{\n····const·{\n······//·get·options\n······allowStale·=·this.allowStale,\n······updateAgeOnGet·=·this.updateAgeOnGet,\n······noDeleteOnStaleGet·=·this.noDeleteOnStaleGet,\n······//·set·options\n······ttl·=·this.ttl,\n······noDisposeOnSet·=·this.noDisposeOnSet,\n······size·=·0,\n······sizeCalculation·=·this.sizeCalculation,\n······noUpdateTTL·=·this.noUpdateTTL,\n······//·fetch·exclusive·options\n······noDeleteOnFetchRejection·=·this.noDeleteOnFetchRejection,\n······allowStaleOnFetchRejection·=·this.allowStaleOnFetchRejection,\n······ignoreFetchAbort·=·this.ignoreFetchAbort,\n······allowStaleOnFetchAbort·=·this.allowStaleOnFetchAbort,\n······context,\n······forceRefresh·=·false,\n······status,\n······signal,\n····}·=·fetchOptions\n····if·(status)·{\n······status.op·=·'fetch'\n······status.key·=·k\n······if·(forceRefresh)·status.forceRefresh·=·true\n····}\n\n····if·(!this.#hasFetchMethod)·{\n······if·(status)·status.fetch·=·'get'\n······return·this.#get(k,·{\n········allowStale,\n········updateAgeOnGet,\n········noDeleteOnStaleGet,\n········status,\n······})\n····}\n\n····const·options·=·{\n······allowStale,\n······updateAgeOnGet,\n······noDeleteOnStaleGet,\n······ttl,\n······noDisposeOnSet,\n······size,\n······sizeCalculation,\n······noUpdateTTL,\n······noDeleteOnFetchRejection,\n······allowStaleOnFetchRejection,\n······allowStaleOnFetchAbort,\n······ignoreFetchAbort,\n······status,\n······signal,\n····}\n\n····let·index·=·this.#keyMap.get(k)\n····if·(index·===·undefined)·{\n······if·(status)·status.fetch·=·'miss'\n······const·p·=·this.#backgroundFetch(k,·index,·options,·context·as·FC)\n······return·(p.__returned·=·p)\n····}·else·{\n······//·in·cache,·maybe·already·fetching\n······const·v·=·this.#valList[index]\n······if·(this.#isBackgroundFetch(v))·{\n········const·stale·=·allowStale·&&·v.__staleWhileFetching·!==·undefined\n········if·(status)·{\n··········status.fetch·=·'inflight'\n··········if·(stale)·status.returnedStale·=·true\n········}\n········return·stale·?·v.__staleWhileFetching·:·(v.__returned·=·v)\n······}\n\n······//·if·we·force·a·refresh,·that·means·do·NOT·serve·the·cached·value,\n······//·unless·we·are·already·in·the·process·of·refreshing·the·cache.\n······const·isStale·=·this.#isStale(index)\n······if·(!forceRefresh·&&·!isStale)·{\n········if·(status)·status.fetch·=·'hit'\n········this.#moveToTail(index)\n········if·(updateAgeOnGet)·{\n··········this.#updateItemAge(index)\n········}\n········if·(status)·this.#statusTTL(status,·index)\n········return·v\n······}\n\n······//·ok,·it·is·stale·or·a·forced·refresh,·and·not·already·fetching.\n······//·refresh·the·cache.\n······const·p·=·this.#backgroundFetch(k,·index,·options,·context·as·FC)\n······const·hasStale·=·p.__staleWhileFetching·!==·undefined\n······const·staleVal·=·hasStale·&&·allowStale\n······if·(status)·{\n········status.fetch·=·isStale·?·'stale'·:·'refresh'\n········if·(staleVal·&&·isStale)·status.returnedStale·=·true\n······}\n······return·staleVal·?·p.__staleWhileFetching·:·(p.__returned·=·p)\n····}\n··}\n\n··/**\n···*·In·some·cases,·`cache.fetch()`·may·resolve·to·`undefined`,·either·because\n···*·a·{@link·LRUCache.OptionsBase#fetchMethod}·was·not·provided·(turning\n···*·`cache.fetch(k)`·into·just·an·async·wrapper·around·`cache.get(k)`)·or\n···*·because·`ignoreFetchAbort`·was·specified·(either·to·the·constructor·or\n···*·in·the·{@link·LRUCache.FetchOptions}).·Also,·the\n···*·{@link·LRUCache.OptionsBase.fetchMethod}·may·return·`undefined`·or·`void`,·making\n···*·the·test·even·more·complicated.\n···*\n···*·Because·inferring·the·cases·where·`undefined`·might·be·returned·are·so\n···*·cumbersome,·but·testing·for·`undefined`·can·also·be·annoying,·this·method\n···*·can·be·used,·which·will·reject·if·`this.fetch()`·resolves·to·undefined.\n···*/\n··forceFetch(\n····k:·K,\n····fetchOptions:·unknown·extends·FC·?·LRUCache.FetchOptions<K,·V,·FC>\n····:·FC·extends·undefined·|·void·?·LRUCache.FetchOptionsNoContext<K,·V>\n····:·LRUCache.FetchOptionsWithContext<K,·V,·FC>,\n··):·Promise<V>\n··//·this·overload·not·allowed·if·context·is·required\n··forceFetch(\n····k:·unknown·extends·FC·?·K\n····:·FC·extends·undefined·|·void·?·K\n····:·never,\n····fetchOptions?:·unknown·extends·FC·?·LRUCache.FetchOptions<K,·V,·FC>\n····:·FC·extends·undefined·|·void·?·LRUCache.FetchOptionsNoContext<K,·V>\n····:·never,\n··):·Promise<V>\n··forceFetch(\n····k:·K,\n····fetchOptions:·LRUCache.FetchOptions<K,·V,·FC>·=·{},\n··):·Promise<V>·{\n····const·ths·=·tracing.hasSubscribers\n····const·{·status·=·hasSubscribers()·?·{}·:·undefined·}·=·fetchOptions\n····fetchOptions.status·=·status\n····if·(status·&&·fetchOptions.context)·{\n······status.context·=·fetchOptions.context\n····}\n····const·p·=·this.#forceFetch(k,·fetchOptions)\n····if·(status·&&·hasSubscribers())·{\n······if·(ths)·{\n········status.trace·=·true\n········tracing.tracePromise(()·=>·p,·status).catch(()·=>·{})\n······}\n····}\n····return·p\n··}\n\n··async·#forceFetch(\n····k:·K,\n····fetchOptions:·LRUCache.FetchOptions<K,·V,·FC>·=·{},\n··)·{\n····const·v·=·await·this.#fetch(\n······k,\n······fetchOptions·as·unknown·extends·FC·?·LRUCache.FetchOptions<K,·V,·FC>\n······:·FC·extends·undefined·|·void·?·LRUCache.FetchOptionsNoContext<K,·V>\n······:·LRUCache.FetchOptionsWithContext<K,·V,·FC>,\n····)\n····if·(v·===·undefined)·throw·new·Error('fetch()·returned·undefined')\n····return·v\n··}\n\n··/**\n···*·If·the·key·is·found·in·the·cache,·then·this·is·equivalent·to\n···*·{@link·LRUCache#get}.·If·not,·in·the·cache,·then·calculate·the·value·using\n···*·the·{@link·LRUCache.OptionsBase.memoMethod},·and·add·it·to·the·cache.\n···*\n···*·If·an·`FC`·type·is·set·to·a·type·other·than·`unknown`,·`void`,·or\n···*·`undefined`·in·the·LRUCache·constructor,·then·all·calls·to·`cache.memo()`\n···*·_must_·provide·a·`context`·option.·If·set·to·`undefined`·or·`void`,·then\n···*·calls·to·memo·_must·not_·provide·a·`context`·option.\n···*\n···*·The·`context`·param·allows·you·to·provide·arbitrary·data·that·might·be\n···*·relevant·in·the·course·of·fetching·the·data.·It·is·only·relevant·for·the\n···*·course·of·a·single·`memo()`·operation,·and·discarded·afterwards.\n···*/\n··memo(\n····k:·K,\n····memoOptions:·unknown·extends·FC·?·LRUCache.MemoOptions<K,·V,·FC>\n····:·FC·extends·undefined·|·void·?·LRUCache.MemoOptionsNoContext<K,·V>\n····:·LRUCache.MemoOptionsWithContext<K,·V,·FC>,\n··):·V\n··//·this·overload·not·allowed·if·context·is·required\n··memo(\n····k:·unknown·extends·FC·?·K\n····:·FC·extends·undefined·|·void·?·K\n····:·never,\n····memoOptions?:·unknown·extends·FC·?·LRUCache.MemoOptions<K,·V,·FC>\n····:·FC·extends·undefined·|·void·?·LRUCache.MemoOptionsNoContext<K,·V>\n····:·never,\n··):·V\n··memo(k:·K,·memoOptions:·LRUCache.MemoOptions<K,·V,·FC>·=·{})·{\n····const·{·status·=·metrics.hasSubscribers·?·{}·:·undefined·}·=\n······memoOptions\n····memoOptions.status·=·status\n····if·(status)·{\n······status.op·=·'memo'\n······status.key·=·k\n······if·(memoOptions.context)·{\n········status.context·=·memoOptions.context\n······}\n····}\n····const·result·=·this.#memo(k,·memoOptions)\n····if·(status)·status.value·=·result\n····if·(metrics.hasSubscribers)·metrics.publish(status)\n····return·result\n··}\n··#memo(k:·K,·memoOptions:·LRUCache.MemoOptions<K,·V,·FC>·=·{})·{\n····const·memoMethod·=·this.#memoMethod\n····if·(!memoMethod)·{\n······throw·new·Error('no·memoMethod·provided·to·constructor')\n····}\n····const·{·context,·status,·forceRefresh,·...options·}·=·memoOptions\n····if·(status·&&·forceRefresh)·status.forceRefresh·=·true\n····const·v·=·this.#get(k,·options)\n····const·refresh·=·forceRefresh·||·v·===·undefined\n····if·(status)·{\n······status.memo·=·refresh·?·'miss'·:·'hit'\n······if·(!refresh)·status.value·=·v\n····}\n····if·(!refresh)·return·v\n····const·vv·=·memoMethod(k,·v,·{\n······options,\n······context,\n····}·as·LRUCache.MemoizerOptions<K,·V,·FC>)\n····if·(status)·status.value·=·vv\n····this.#set(k,·vv,·options)\n····return·vv\n··}\n\n··/**\n···*·Return·a·value·from·the·cache.·Will·update·the·recency·of·the·cache\n···*·entry·found.\n···*\n···*·If·the·key·is·not·found,·get()·will·return·`undefined`.\n···*/\n··get(k:·K,·getOptions:·LRUCache.GetOptions<K,·V,·FC>·=·{})·{\n····const·{·status·=·metrics.hasSubscribers·?·{}·:·undefined·}·=·getOptions\n····getOptions.status·=·status\n····if·(status)·{\n······status.op·=·'get'\n······status.key·=·k\n····}\n····const·result·=·this.#get(k,·getOptions)\n····if·(status)·{\n······if·(result·!==·undefined)·status.value·=·result\n······if·(metrics.hasSubscribers)·metrics.publish(status)\n····}\n····return·result\n··}\n\n··#get(k:·K,·getOptions:·LRUCache.GetOptions<K,·V,·FC>·=·{})·{\n····const·{\n······allowStale·=·this.allowStale,\n······updateAgeOnGet·=·this.updateAgeOnGet,\n······noDeleteOnStaleGet·=·this.noDeleteOnStaleGet,\n······status,\n····}·=·getOptions\n····const·index·=·this.#keyMap.get(k)\n····if·(index·===·undefined)·{\n······if·(status)·status.get·=·'miss'\n······return·undefined\n····}\n····const·value·=·this.#valList[index]\n····const·fetching·=·this.#isBackgroundFetch(value)\n····if·(status)·this.#statusTTL(status,·index)\n····if·(this.#isStale(index))·{\n······//·delete·only·if·not·an·in-flight·background·fetch\n······if·(!fetching)·{\n········if·(!noDeleteOnStaleGet)·{\n··········this.#delete(k,·'expire')\n········}\n········if·(status)·status.get·=·'stale'\n········if·(allowStale)·{\n··········if·(status)·status.returnedStale·=·true\n··········return·value\n········}\n········return·undefined\n······}\n······if·(status)·status.get·=·'stale-fetching'\n······if·(allowStale·&&·value.__staleWhileFetching·!==·undefined)·{\n········if·(status)·status.returnedStale·=·true\n········return·value.__staleWhileFetching\n······}\n······return·undefined\n····}\n····//·not·stale\n····if·(status)·status.get·=·fetching·?·'fetching'·:·'hit'\n····//·if·we're·currently·fetching·it,·we·don't·actually·have·it·yet\n····//·it's·not·stale,·which·means·this·isn't·a·staleWhileRefetching.\n····//·If·it's·not·stale,·and·fetching,·AND·has·a·__staleWhileFetching\n····//·value,·then·that·means·the·user·fetched·with·{forceRefresh:true},\n····//·so·it's·safe·to·return·that·value.\n····this.#moveToTail(index)\n····if·(updateAgeOnGet)·{\n······this.#updateItemAge(index)\n····}\n····return·fetching·?·value.__staleWhileFetching·:·value\n··}\n\n··#connect(p:·Index,·n:·Index)·{\n····this.#prev[n]·=·p\n····this.#next[p]·=·n\n··}\n\n··#moveToTail(index:·Index):·void·{\n····//·if·tail·already,·nothing·to·do\n····//·if·head,·move·head·to·next[index]\n····//·else\n····//···move·next[prev[index]]·to·next[index]·(head·has·no·prev)\n····//···move·prev[next[index]]·to·prev[index]\n····//·prev[index]·=·tail\n····//·next[tail]·=·index\n····//·tail·=·index\n····if·(index·!==·this.#tail)·{\n······if·(index·===·this.#head)·{\n········this.#head·=·this.#next[index]·as·Index\n······}·else·{\n········this.#connect(\n··········this.#prev[index]·as·Index,\n··········this.#next[index]·as·Index,\n········)\n······}\n······this.#connect(this.#tail,·index)\n······this.#tail·=·index\n····}\n··}\n\n··/**\n···*·Deletes·a·key·out·of·the·cache.\n···*\n···*·Returns·true·if·the·key·was·deleted,·false·otherwise.\n···*/\n··delete(k:·K)·{\n····return·this.#delete(k,·'delete')\n··}\n\n··#delete(k:·K,·reason:·LRUCache.DisposeReason)·{\n····if·(metrics.hasSubscribers)·{\n······metrics.publish({\n········op:·'delete',\n········delete:·reason,\n········key:·k,\n······})\n····}\n····let·deleted·=·false\n····if·(this.#size·!==·0)·{\n······const·index·=·this.#keyMap.get(k)\n······if·(index·!==·undefined)·{\n········if·(this.#autopurgeTimers?.[index])·{\n··········clearTimeout(this.#autopurgeTimers?.[index])\n··········this.#autopurgeTimers[index]·=·undefined\n········}\n········deleted·=·true\n········if·(this.#size·===·1)·{\n··········this.#clear(reason)\n········}·else·{\n··········this.#removeItemSize(index)\n··········const·v·=·this.#valList[index]\n··········if·(this.#isBackgroundFetch(v))·{\n············v.__abortController.abort(new·Error('deleted'))\n··········}·else·if·(this.#hasDispose·||·this.#hasDisposeAfter)·{\n············if·(this.#hasDispose)·{\n··············this.#dispose?.(v·as·V,·k,·reason)\n············}\n············if·(this.#hasDisposeAfter)·{\n··············this.#disposed?.push([v·as·V,·k,·reason])\n············}\n··········}\n··········this.#keyMap.delete(k)\n··········this.#keyList[index]·=·undefined\n··········this.#valList[index]·=·undefined\n··········if·(index·===·this.#tail)·{\n············this.#tail·=·this.#prev[index]·as·Index\n··········}·else·if·(index·===·this.#head)·{\n············this.#head·=·this.#next[index]·as·Index\n··········}·else·{\n············const·pi·=·this.#prev[index]·as·number\n············this.#next[pi]·=·this.#next[index]·as·number\n············const·ni·=·this.#next[index]·as·number\n············this.#prev[ni]·=·this.#prev[index]·as·number\n··········}\n··········this.#size--\n··········this.#free.push(index)\n········}\n······}\n····}\n····if·(this.#hasDisposeAfter·&&·this.#disposed?.length)·{\n······const·dt·=·this.#disposed\n······let·task:·DisposeTask<K,·V>·|·undefined\n······while·((task·=·dt?.shift()))·{\n········this.#disposeAfter?.(...task)\n······}\n····}\n····return·deleted\n··}\n\n··/**\n···*·Clear·the·cache·entirely,·throwing·away·all·values.\n···*/\n··clear()·{\n····return·this.#clear('delete')\n··}\n··#clear(reason:·LRUCache.DisposeReason)·{\n····for·(const·index·of·this.#rindexes({·allowStale:·true·}))·{\n······const·v·=·this.#valList[index]\n······if·(this.#isBackgroundFetch(v))·{\n········v.__abortController.abort(new·Error('deleted'))\n······}·else·{\n········const·k·=·this.#keyList[index]\n········if·(this.#hasDispose)·{\n··········this.#dispose?.(v·as·V,·k·as·K,·reason)\n········}\n········if·(this.#hasDisposeAfter)·{\n··········this.#disposed?.push([v·as·V,·k·as·K,·reason])\n········}\n······}\n····}\n\n····this.#keyMap.clear()\n····this.#valList.fill(undefined)\n····this.#keyList.fill(undefined)\n····if·(this.#ttls·&&·this.#starts)·{\n······this.#ttls.fill(0)\n······this.#starts.fill(0)\n······for·(const·t·of·this.#autopurgeTimers·??·[])·{\n········if·(t·!==·undefined)·clearTimeout(t)\n······}\n······this.#autopurgeTimers?.fill(undefined)\n····}\n····if·(this.#sizes)·{\n······this.#sizes.fill(0)\n····}\n····this.#head·=·0·as·Index\n····this.#tail·=·0·as·Index\n····this.#free.length·=·0\n····this.#calculatedSize·=·0\n····this.#size·=·0\n····if·(this.#hasDisposeAfter·&&·this.#disposed)·{\n······const·dt·=·this.#disposed\n······let·task:·DisposeTask<K,·V>·|·undefined\n······while·((task·=·dt?.shift()))·{\n········this.#disposeAfter?.(...task)\n······}\n····}\n··}\n}\n" | 193 | ········"/**\n·*·@module·LRUCache\n·*/\n\nimport·{·metrics,·tracing·}·from·'./diagnostics-channel.js'\n\nconst·hasSubscribers·=·()·=>\n··metrics.hasSubscribers·||·tracing.hasSubscribers\n\n//·module-private·names·and·types\n//·this·provides·the·default·Perf·object·source.\n//·it·can·be·passed·in·via·configuration·to·override·it\n//·for·a·single·LRU·object.\nexport·type·Perf·=·{·now:·()·=>·number·}\nconst·defaultPerf:·Perf·=\n··(\n····typeof·performance·===·'object'·&&\n····performance·&&\n····typeof·performance.now·===·'function'\n··)·?\n····performance\n··:·Date\n\nconst·warned·=·new·Set<string>()\n\n//·either·a·function·or·a·class\n//·oxlint-disable-next-line·no-explicit-any\ntype·ForC·=·((...a:·any[])·=>·any)·|·{·new·(...a:·any[]):·any·}\n\n/*·c8·ignore·start·*/\nconst·PROCESS·=·(\n··typeof·process·===·'object'·&&·!!process·?\n····process\n··:·{})·as·{·[k:·string]:·unknown·}\n/*·c8·ignore·stop·*/\n\nconst·emitWarning·=·(\n··msg:·string,\n··type:·string,\n··code:·string,\n··fn:·ForC,\n)·=>·{\n··if·(typeof·PROCESS.emitWarning·===·'function')·{\n····PROCESS.emitWarning(msg,·type,·code,·fn)\n··}·else·{\n····//oxlint-disable-next-line·no-console\n····console.error(`[${code}]·${type}:·${msg}`)\n··}\n}\nconst·shouldWarn·=·(code:·string)·=>·!warned.has(code)\n\nconst·TYPE·=·Symbol('type')\nexport·type·PosInt·=·number·&·{·[TYPE]:·'Positive·Integer'·}\nexport·type·Index·=·number·&·{·[TYPE]:·'LRUCache·Index'·}\n\nconst·isPosInt·=·(n:·unknown):·n·is·PosInt·=>\n··!!n·&&·n·===·Math.floor(n·as·number)·&&·n·>·0·&&·isFinite(n)\n\nexport·type·UintArray·=·Uint8Array·|·Uint16Array·|·Uint32Array\nexport·type·NumberArray·=·UintArray·|·number[]\n\n//·This·is·a·little·bit·ridiculous,·tbh.\n//·The·maximum·array·length·is·2^32-1·or·thereabouts·on·most·JS·impls.\n//·And·well·before·that·point,·you're·caching·the·entire·world,·I·mean,\n//·that's·~32GB·of·just·integers·for·the·next/prev·links,·plus·whatever\n//·else·to·hold·that·many·keys·and·values.··Just·filling·the·memory·with\n//·zeroes·at·init·time·is·brutal·when·you·get·that·big.\n//·But·why·not·be·complete?\n//·Maybe·in·the·future,·these·limits·will·have·expanded.\n/*·c8·ignore·start·*/\nconst·getUintArray·=·(max:·number)·=>\n··!isPosInt(max)·?·null\n··:·max·<=·Math.pow(2,·8)·?·Uint8Array\n··:·max·<=·Math.pow(2,·16)·?·Uint16Array\n··:·max·<=·Math.pow(2,·32)·?·Uint32Array\n··:·max·<=·Number.MAX_SAFE_INTEGER·?·ZeroArray\n··:·null\n/*·c8·ignore·stop·*/\n\nclass·ZeroArray·extends·Array<number>·{\n··constructor(size:·number)·{\n····super(size)\n····this.fill(0)\n··}\n}\nexport·type·{·ZeroArray·}\nexport·type·{·Stack·}\n\nexport·type·StackLike·=·Stack·|·Index[]\nclass·Stack·{\n··heap:·NumberArray\n··length:·number\n··//·private·constructor\n··static·#constructing:·boolean·=·false\n··static·create(max:·number):·StackLike·{\n····const·HeapCls·=·getUintArray(max)\n····if·(!HeapCls)·return·[]\n····Stack.#constructing·=·true\n····const·s·=·new·Stack(max,·HeapCls)\n····Stack.#constructing·=·false\n····return·s\n··}\n··constructor(max:·number,·HeapCls:·{·new·(n:·number):·NumberArray·})·{\n····/*·c8·ignore·start·*/\n····if·(!Stack.#constructing)·{\n······throw·new·TypeError('instantiate·Stack·using·Stack.create(n)')\n····}\n····/*·c8·ignore·stop·*/\n····this.heap·=·new·HeapCls(max)\n····this.length·=·0\n··}\n··push(n:·Index)·{\n····this.heap[this.length++]·=·n\n··}\n··pop():·Index·{\n····return·this.heap[--this.length]·as·Index\n··}\n}\n\n/**\n·*·Promise·representing·an·in-progress·{@link·LRUCache#fetch}·call\n·*/\nexport·type·BackgroundFetch<V>·=·Promise<V·|·undefined>·&·{\n··__returned:·BackgroundFetch<V>·|·undefined\n··__abortController:·AbortController\n··__staleWhileFetching:·V·|·undefined\n}\n\nexport·type·DisposeTask<K,·V>·=·[\n··value:·V,\n··key:·K,\n··reason:·LRUCache.DisposeReason,\n]\n\nexport·namespace·LRUCache·{\n··/**\n···*·An·integer·greater·than·0,·reflecting·the·calculated·size·of·items\n···*/\n··export·type·Size·=·number\n\n··/**\n···*·Integer·greater·than·0,·representing·some·number·of·milliseconds,·or·the\n···*·time·at·which·a·TTL·started·counting·from.\n···*/\n··export·type·Milliseconds·=·number\n\n··/**\n···*·An·integer·greater·than·0,·reflecting·a·number·of·items\n···*/\n··export·type·Count·=·number\n\n··/**\n···*·The·reason·why·an·item·was·removed·from·the·cache,·passed\n···*·to·the·{@link·Disposer}·methods.\n···*\n···*·-·`evict`:·The·item·was·evicted·because·it·is·the·least·recently·used,\n···*···and·the·cache·is·full.\n···*·-·`set`:·A·new·value·was·set,·overwriting·the·old·value·being·disposed.\n···*·-·`delete`:·The·item·was·explicitly·deleted,·either·by·calling\n···*···{@link·LRUCache#delete},·{@link·LRUCache#clear},·or\n···*···{@link·LRUCache#set}·with·an·undefined·value.\n···*·-·`expire`:·The·item·was·removed·due·to·exceeding·its·TTL.\n···*·-·`fetch`:·A·{@link·OptionsBase#fetchMethod}·operation·returned\n···*···`undefined`·or·was·aborted,·causing·the·item·to·be·deleted.\n···*/\n··export·type·DisposeReason·=\n····|·'evict'\n····|·'set'\n····|·'delete'\n····|·'expire'\n····|·'fetch'\n··/**\n···*·A·method·called·upon·item·removal,·passed·as·the\n···*·{@link·OptionsBase.dispose}·and/or\n···*·{@link·OptionsBase.disposeAfter}·options.\n···*/\n··export·type·Disposer<K,·V>·=·(\n····value:·V,\n····key:·K,\n····reason:·DisposeReason,\n··)·=>·void\n\n··/**\n···*·The·reason·why·an·item·was·added·to·the·cache,·passed\n···*·to·the·{@link·Inserter}·methods.\n···*\n···*·-·`add`:·the·item·was·not·found·in·the·cache,·and·was·added\n···*·-·`update`:·the·item·was·in·the·cache,·with·the·same·value·provided\n···*·-·`replace`:·the·item·was·in·the·cache,·and·replaced\n···*/\n··export·type·InsertReason·=·'add'·|·'update'·|·'replace'\n\n··/**\n···*·A·method·called·upon·item·insertion,·passed·as·the\n···*·{@link·OptionsBase.insert}\n···*/\n··export·type·Inserter<K,·V>·=·(\n····value:·V,\n····key:·K,\n····reason:·InsertReason,\n··)·=>·void\n\n··/**\n···*·A·function·that·returns·the·effective·calculated·size\n···*·of·an·entry·in·the·cache.\n···*/\n··export·type·SizeCalculator<K,·V>·=·(value:·V,·key:·K)·=>·Size\n\n··/**\n···*·Options·provided·to·the\n···*·{@link·OptionsBase.fetchMethod}·function.\n···*/\n··export·interface·FetcherOptions<K,·V,·FC·=·unknown>·{\n····signal:·AbortSignal\n····options:·FetcherFetchOptions<K,·V,·FC>\n····/**\n·····*·Object·provided·in·the·{@link·FetchOptions.context}·option·to\n·····*·{@link·LRUCache#fetch}\n·····*/\n····context:·FC\n··}\n\n··/**\n···*·Occasionally,·it·may·be·useful·to·track·the·internal·behavior·of·the\n···*·cache,·particularly·for·logging,·debugging,·or·for·behavior·within·the\n···*·`fetchMethod`.·To·do·this,·you·can·pass·a·`status`·object·to·the\n···*·{@link·LRUCache#fetch},·{@link·LRUCache#get},·{@link·LRUCache#set},\n···*·{@link·LRUCache#memo},·and·{@link·LRUCache#has}·methods.\n···*\n···*·The·`status`·option·should·be·a·plain·JavaScript·object.·The·following\n···*·fields·will·be·set·on·it·appropriately,·depending·on·the·situation.\n···*\n···*·These·objects·are·also·the·context·objects·passed·to·listeners·on·the\n···*·`lru-cache:metrics`·diagnostic·channel,·and·the·`lru-cache`·tracing\n···*·channels,·in·platforms·that·support·them.\n···*/\n··export·interface·Status<K,·V>·{\n····/**\n·····*·The·operation·being·performed\n·····*/\n····op?:·'get'·|·'set'·|·'memo'·|·'fetch'·|·'delete'·|·'has'·|·'peek'\n····/**\n·····*·The·status·of·a·set()·operation.\n·····*\n·····*·-·add:·the·item·was·not·found·in·the·cache,·and·was·added\n·····*·-·update:·the·item·was·in·the·cache,·with·the·same·value·provided\n·····*·-·replace:·the·item·was·in·the·cache,·and·replaced\n·····*·-·miss:·the·item·was·not·added·to·the·cache·for·some·reason\n·····*/\n····set?:·'add'·|·'update'·|·'replace'·|·'miss'·|·'deleted'\n\n····/**\n·····*·The·status·of·a·delete()·operation.\n·····*/\n····delete?:·LRUCache.DisposeReason\n\n····/**\n·····*·The·result·of·a·peek()·operation\n·····*\n·····*·-·hit:·the·item·was·found·and·returned\n·····*·-·stale:·the·item·is·in·the·cache,·but·past·its·ttl·and·not·returned\n·····*·-·miss:·item·not·in·the·cache\n·····*/\n····peek?:·'hit'·|·'miss'·|·'stale'\n\n····/**\n·····*·The·status·of·a·memo()·operation.\n·····*\n·····*·-·'hit':·the·item·was·found·in·the·cache·and·returned\n·····*·-·'miss':·the·`memoMethod`·function·was·called\n·····*/\n····memo?:·'hit'·|·'miss'\n\n····/**\n·····*·The·`context`·option·provided·to·a·memo·or·fetch·operation\n·····*\n·····*·In·practice,·of·course,·this·will·be·the·same·type·as·the·`FC`\n·····*·fetch·context·param·used·to·instantiate·the·LRUCache,·but·the\n·····*·convolutions·of·threading·that·through·would·get·quite·complicated,\n·····*·and·preclude·forcing/forbidding·the·passing·of·a·`context`·param\n·····*·where·it·is/isn't·expected,·which·is·more·valuable·for·error\n·····*·prevention.\n·····*/\n····context?:·unknown\n\n····/**\n·····*·the·ttl·stored·for·the·item,·or·undefined·if·ttls·are·not·used.\n·····*/\n····ttl?:·Milliseconds\n\n····/**\n·····*·the·start·time·for·the·item,·or·undefined·if·ttls·are·not·used.\n·····*/\n····start?:·Milliseconds\n\n····/**\n·····*·The·timestamp·used·for·TTL·calculation\n·····*/\n····now?:·Milliseconds\n\n····/**\n·····*·the·remaining·ttl·for·the·item,·or·undefined·if·ttls·are·not·used.\n·····*/\n····remainingTTL?:·Milliseconds\n\n····/**\n·····*·The·calculated·size·for·the·item,·if·sizes·are·used.\n·····*/\n····entrySize?:·Size\n\n····/**\n·····*·The·total·calculated·size·of·the·cache,·if·sizes·are·used.\n·····*/\n····totalCalculatedSize?:·Size\n\n····/**\n·····*·A·flag·indicating·that·the·item·was·not·stored,·due·to·exceeding·the\n·····*·{@link·OptionsBase.maxEntrySize}\n·····*/\n····maxEntrySizeExceeded?:·true\n\n····/**\n·····*·The·key·that·was·set·or·retrieved\n·····*/\n····key?:·K\n\n····/**\n·····*·The·value·that·was·set\n·····*/\n····value?:·V\n\n····/**\n·····*·The·old·value,·specified·in·the·case·of·`set:'replace'`\n·····*/\n····oldValue?:·V\n\n····/**\n·····*·The·results·of·a·{@link·LRUCache#has}·operation\n·····*\n·····*·-·hit:·the·item·was·found·in·the·cache\n·····*·-·stale:·the·item·was·found·in·the·cache,·but·is·stale\n·····*·-·miss:·the·item·was·not·found·in·the·cache\n·····*/\n····has?:·'hit'·|·'stale'·|·'miss'\n\n····/**\n·····*·The·status·of·a·{@link·LRUCache#fetch}·operation.\n·····*·Note·that·this·can·change·as·the·underlying·fetch()·moves·through\n·····*·various·states.\n·····*\n·····*·-·inflight:·there·is·another·fetch()·for·this·key·which·is·in·process\n·····*·-·get:·there·is·no·{@link·OptionsBase.fetchMethod},·so\n·····*···{@link·LRUCache#get}·was·called.\n·····*·-·miss:·the·item·is·not·in·cache,·and·will·be·fetched.\n·····*·-·hit:·the·item·is·in·the·cache,·and·was·resolved·immediately.\n·····*·-·stale:·the·item·is·in·the·cache,·but·stale.\n·····*·-·refresh:·the·item·is·in·the·cache,·and·not·stale,·but\n·····*···{@link·FetchOptions.forceRefresh}·was·specified.\n·····*/\n····fetch?:·'get'·|·'inflight'·|·'miss'·|·'hit'·|·'stale'·|·'refresh'\n\n····/**\n·····*·`forceRefresh`·option·was·used·for·either·a·fetch·or·memo·operation\n·····*/\n····forceRefresh?:·boolean\n\n····/**\n·····*·The·{@link·OptionsBase.fetchMethod}·was·called\n·····*/\n····fetchDispatched?:·true\n\n····/**\n·····*·The·cached·value·was·updated·after·a·successful·call·to\n·····*·{@link·OptionsBase.fetchMethod}\n·····*/\n····fetchUpdated?:·true\n\n····/**\n·····*·The·reason·for·a·fetch()·rejection.··Either·the·error·raised·by·the\n·····*·{@link·OptionsBase.fetchMethod},·or·the·reason·for·an\n·····*·AbortSignal.\n·····*/\n····fetchError?:·Error\n\n····/**\n·····*·The·fetch·received·an·abort·signal\n·····*/\n····fetchAborted?:·true\n\n····/**\n·····*·The·abort·signal·received·was·ignored,·and·the·fetch·was·allowed·to\n·····*·continue·in·the·background.\n·····*/\n····fetchAbortIgnored?:·true\n\n····/**\n·····*·The·fetchMethod·promise·resolved·successfully\n·····*/\n····fetchResolved?:·true\n\n····/**\n·····*·The·fetchMethod·promise·was·rejected\n·····*/\n····fetchRejected?:·true\n\n····/**\n·····*·The·status·of·a·{@link·LRUCache#get}·operation.\n·····*\n·····*·-·fetching:·The·item·is·currently·being·fetched.··If·a·previous·value\n·····*···is·present·and·allowed,·that·will·be·returned.\n·····*·-·stale:·The·item·is·in·the·cache,·and·is·stale.·If·it·was·returned,\n·····*···then·the·`returnedStale`·flag·will·be·set.\n·····*·-·stale-fetching:·The·value·is·being·fetched·in·the·background,·but·is\n·····*···currently·stale.·If·the·stale·value·was·returned,·then·the\n·····*···`returnedStale`·flag·will·be·set.\n·····*·-·hit:·the·item·is·in·the·cache\n·····*·-·miss:·the·item·is·not·in·the·cache\n·····*/\n····get?:·'stale'·|·'hit'·|·'miss'·|·'fetching'·|·'stale-fetching'\n\n····/**\n·····*·A·fetch·or·get·operation·returned·a·stale·value.\n·····*/\n····returnedStale?:·true\n\n····/**\n·····*·A·tracingChannel·trace·was·started·for·this·operation\n·····*/\n····trace?:·boolean\n··}\n\n··/**\n···*·options·which·override·the·options·set·in·the·LRUCache·constructor\n···*·when·calling·{@link·LRUCache#fetch}.\n···*\n···*·This·is·the·union·of·{@link·GetOptions}·and·{@link·SetOptions},·plus\n···*·{@link·OptionsBase.noDeleteOnFetchRejection},\n···*·{@link·OptionsBase.allowStaleOnFetchRejection},\n···*·{@link·FetchOptions.forceRefresh},·and\n···*·{@link·FetcherOptions.context}\n···*\n···*·Any·of·these·may·be·modified·in·the·{@link·OptionsBase.fetchMethod}\n···*·function,·but·the·{@link·GetOptions}·fields·will·of·course·have·no\n···*·effect,·as·the·{@link·LRUCache#get}·call·already·happened·by·the·time\n···*·the·fetchMethod·is·called.\n···*/\n··export·interface·FetcherFetchOptions<K,·V,·FC·=·unknown>·extends·Pick<\n····OptionsBase<K,·V,·FC>,\n····|·'allowStale'\n····|·'updateAgeOnGet'\n····|·'noDeleteOnStaleGet'\n····|·'sizeCalculation'\n····|·'ttl'\n····|·'noDisposeOnSet'\n····|·'noUpdateTTL'\n····|·'noDeleteOnFetchRejection'\n····|·'allowStaleOnFetchRejection'\n····|·'ignoreFetchAbort'\n····|·'allowStaleOnFetchAbort'\n··>·{\n····status?:·Status<K,·V>\n····size?:·Size\n··}\n\n··/**\n···*·Options·that·may·be·passed·to·the·{@link·LRUCache#fetch}·method.\n···*/\n··export·interface·FetchOptions<K,·V,·FC>·extends·FetcherFetchOptions<\n····K,\n····V,\n····FC\n··>·{\n····/**\n·····*·Set·to·true·to·force·a·re-load·of·the·existing·data,·even·if·it\n·····*·is·not·yet·stale.\n·····*/\n····forceRefresh?:·boolean\n····/**\n·····*·Context·provided·to·the·{@link·OptionsBase.fetchMethod}·as\n·····*·the·{@link·FetcherOptions.context}·param.\n·····*\n·····*·If·the·FC·type·is·specified·as·unknown·(the·default),\n·····*·undefined·or·void,·then·this·is·optional.··Otherwise,·it·will\n·····*·be·required.\n·····*/\n····context?:·FC\n····signal?:·AbortSignal\n····status?:·Status<K,·V>\n··}\n··/**\n···*·Options·provided·to·{@link·LRUCache#fetch}·when·the·FC·type·is·something\n···*·other·than·`unknown`,·`undefined`,·or·`void`\n···*/\n··export·interface·FetchOptionsWithContext<K,·V,·FC>·extends·FetchOptions<\n····K,\n····V,\n····FC\n··>·{\n····context:·FC\n··}\n··/**\n···*·Options·provided·to·{@link·LRUCache#fetch}·when·the·FC·type·is\n···*·`undefined`·or·`void`\n···*/\n··export·interface·FetchOptionsNoContext<K,·V>·extends·FetchOptions<\n····K,\n····V,\n····undefined\n··>·{\n····context?:·undefined\n··}\n\n··export·interface·MemoOptions<K,·V,·FC·=·unknown>·extends·Pick<\n····OptionsBase<K,·V,·FC>,\n····|·'allowStale'\n····|·'updateAgeOnGet'\n····|·'noDeleteOnStaleGet'\n····|·'sizeCalculation'\n····|·'ttl'\n····|·'noDisposeOnSet'\n····|·'noUpdateTTL'\n····|·'noDeleteOnFetchRejection'\n····|·'allowStaleOnFetchRejection'\n····|·'ignoreFetchAbort'\n····|·'allowStaleOnFetchAbort'\n··>·{\n····/**\n·····*·Set·to·true·to·force·a·re-load·of·the·existing·data,·even·if·it\n·····*·is·not·yet·stale.\n·····*/\n····forceRefresh?:·boolean\n····/**\n·····*·Context·provided·to·the·{@link·OptionsBase.memoMethod}·as\n·····*·the·{@link·MemoizerOptions.context}·param.\n·····*\n·····*·If·the·FC·type·is·specified·as·unknown·(the·default),\n·····*·undefined·or·void,·then·this·is·optional.··Otherwise,·it·will\n·····*·be·required.\n·····*/\n····context?:·FC\n····status?:·Status<K,·V>\n··}\n··/**\n···*·Options·provided·to·{@link·LRUCache#memo}·when·the·FC·type·is·something\n···*·other·than·`unknown`,·`undefined`,·or·`void`\n···*/\n··export·interface·MemoOptionsWithContext<K,·V,·FC>·extends·MemoOptions<\n····K,\n····V,\n····FC\n··>·{\n····context:·FC\n··}\n··/**\n···*·Options·provided·to·{@link·LRUCache#memo}·when·the·FC·type·is\n···*·`undefined`·or·`void`\n···*/\n··export·interface·MemoOptionsNoContext<K,·V>·extends·MemoOptions<\n····K,\n····V,\n····undefined\n··>·{\n····context?:·undefined\n··}\n\n··/**\n···*·Options·provided·to·the\n···*·{@link·OptionsBase.memoMethod}·function.\n···*/\n··export·interface·MemoizerOptions<K,·V,·FC·=·unknown>·{\n····options:·MemoizerMemoOptions<K,·V,·FC>\n····/**\n·····*·Object·provided·in·the·{@link·MemoOptions.context}·option·to\n·····*·{@link·LRUCache#memo}\n·····*/\n····context:·FC\n··}\n\n··/**\n···*·options·which·override·the·options·set·in·the·LRUCache·constructor\n···*·when·calling·{@link·LRUCache#memo}.\n···*\n···*·This·is·the·union·of·{@link·GetOptions}·and·{@link·SetOptions},·plus\n···*·{@link·MemoOptions.forceRefresh},·and\n···*·{@link·MemoOptions.context}\n···*\n···*·Any·of·these·may·be·modified·in·the·{@link·OptionsBase.memoMethod}\n···*·function,·but·the·{@link·GetOptions}·fields·will·of·course·have·no\n···*·effect,·as·the·{@link·LRUCache#get}·call·already·happened·by·the·time\n···*·the·memoMethod·is·called.\n···*/\n··export·interface·MemoizerMemoOptions<K,·V,·FC·=·unknown>·extends·Pick<\n····OptionsBase<K,·V,·FC>,\n····|·'allowStale'\n····|·'updateAgeOnGet'\n····|·'noDeleteOnStaleGet'\n····|·'sizeCalculation'\n····|·'ttl'\n····|·'noDisposeOnSet'\n····|·'noUpdateTTL'\n··>·{\n····status?:·Status<K,·V>\n····size?:·Size\n····start?:·Milliseconds\n··}\n\n··/**\n···*·Options·that·may·be·passed·to·the·{@link·LRUCache#has}·method.\n···*/\n··export·interface·HasOptions<K,·V,·FC>·extends·Pick<\n····OptionsBase<K,·V,·FC>,\n····'updateAgeOnHas'\n··>·{\n····status?:·Status<K,·V>\n··}\n\n··/**\n···*·Options·that·may·be·passed·to·the·{@link·LRUCache#get}·method.\n···*/\n··export·interface·GetOptions<K,·V,·FC>·extends·Pick<\n····OptionsBase<K,·V,·FC>,\n····'allowStale'·|·'updateAgeOnGet'·|·'noDeleteOnStaleGet'\n··>·{\n····status?:·Status<K,·V>\n··}\n\n··/**\n···*·Options·that·may·be·passed·to·the·{@link·LRUCache#peek}·method.\n···*/\n··export·interface·PeekOptions<K,·V,·FC>·extends·Pick<\n····OptionsBase<K,·V,·FC>,\n····'allowStale'\n··>·{\n····status?:·Status<K,·V>\n··}\n\n··/**\n···*·Options·that·may·be·passed·to·the·{@link·LRUCache#set}·method.\n···*/\n··export·interface·SetOptions<K,·V,·FC>·extends·Pick<\n····OptionsBase<K,·V,·FC>,\n····'sizeCalculation'·|·'ttl'·|·'noDisposeOnSet'·|·'noUpdateTTL'\n··>·{\n····/**\n·····*·If·size·tracking·is·enabled,·then·setting·an·explicit·size\n·····*·in·the·{@link·LRUCache#set}·call·will·prevent·calling·the\n·····*·{@link·OptionsBase.sizeCalculation}·function.\n·····*/\n····size?:·Size\n····/**\n·····*·If·TTL·tracking·is·enabled,·then·setting·an·explicit·start\n·····*·time·in·the·{@link·LRUCache#set}·call·will·override·the\n·····*·default·time·from·`performance.now()`·or·`Date.now()`.\n·····*\n·····*·Note·that·it·must·be·a·valid·value·for·whichever·time-tracking\n·····*·method·is·in·use.\n·····*/\n····start?:·Milliseconds\n····status?:·Status<K,·V>\n··}\n\n··/**\n···*·The·type·signature·for·the·{@link·OptionsBase.fetchMethod}·option.\n···*/\n··export·type·Fetcher<K,·V,·FC·=·unknown>·=·(\n····key:·K,\n····staleValue:·V·|·undefined,\n····options:·FetcherOptions<K,·V,·FC>,\n··)·=>·Promise<V·|·undefined·|·void>·|·V·|·undefined·|·void\n\n··/**\n···*·the·type·signature·for·the·{@link·OptionsBase.memoMethod}·option.\n···*/\n··export·type·Memoizer<K,·V,·FC·=·unknown>·=·(\n····key:·K,\n····staleValue:·V·|·undefined,\n····options:·MemoizerOptions<K,·V,·FC>,\n··)·=>·V\n\n··/**\n···*·Options·which·may·be·passed·to·the·{@link·LRUCache}·constructor.\n···*\n···*·Most·of·these·may·be·overridden·in·the·various·options·that·use\n···*·them.\n···*\n···*·Despite·all·being·technically·optional,·the·constructor·requires·that\n···*·a·cache·is·at·minimum·limited·by·one·or·more·of·{@link·OptionsBase.max},\n···*·{@link·OptionsBase.ttl},·or·{@link·OptionsBase.maxSize}.\n···*\n···*·If·{@link·OptionsBase.ttl}·is·used·alone,·then·it·is·strongly·advised\n···*·(and·in·fact·required·by·the·type·definitions·here)·that·the·cache\n···*·also·set·{@link·OptionsBase.ttlAutopurge},·to·prevent·potentially\n···*·unbounded·storage.\n···*\n···*·All·options·are·also·available·on·the·{@link·LRUCache}·instance,·making\n···*·it·safe·to·pass·an·LRUCache·instance·as·the·options·argumemnt·to\n···*·make·another·empty·cache·of·the·same·type.\n···*\n···*·Some·options·are·marked·as·read-only,·because·changing·them·after\n···*·instantiation·is·not·safe.·Changing·any·of·the·other·options·will·of\n···*·course·only·have·an·effect·on·subsequent·method·calls.\n···*/\n··export·interface·OptionsBase<K,·V,·FC>·{\n····/**\n·····*·The·maximum·number·of·items·to·store·in·the·cache·before·evicting\n·····*·old·entries.·This·is·read-only·on·the·{@link·LRUCache}·instance,\n·····*·and·may·not·be·overridden.\n·····*\n·····*·If·set,·then·storage·space·will·be·pre-allocated·at·construction\n·····*·time,·and·the·cache·will·perform·significantly·faster.\n·····*\n·····*·Note·that·significantly·fewer·items·may·be·stored,·if\n·····*·{@link·OptionsBase.maxSize}·and/or·{@link·OptionsBase.ttl}·are·also\n·····*·set.\n·····*\n·····*·**It·is·strongly·recommended·to·set·a·`max`·to·prevent·unbounded·growth\n·····*·of·the·cache.**\n·····*/\n····max?:·Count\n\n····/**\n·····*·Max·time·in·milliseconds·for·items·to·live·in·cache·before·they·are\n·····*·considered·stale.··Note·that·stale·items·are·NOT·preemptively·removed·by\n·····*·default,·and·MAY·live·in·the·cache,·contributing·to·its·LRU·max,·long\n·····*·after·they·have·expired,·unless·{@link·OptionsBase.ttlAutopurge}·is\n·····*·set.\n·····*\n·····*·If·set·to·`0`·(the·default·value),·then·that·means·\"do·not·track\n·····*·TTL\",·not·\"expire·immediately\".\n·····*\n·····*·Also,·as·this·cache·is·optimized·for·LRU/MRU·operations,·some·of\n·····*·the·staleness/TTL·checks·will·reduce·performance,·as·they·will·incur\n·····*·overhead·by·deleting·items.\n·····*\n·····*·This·is·not·primarily·a·TTL·cache,·and·does·not·make·strong·TTL\n·····*·guarantees.·There·is·no·pre-emptive·pruning·of·expired·items,·but·you\n·····*·_may_·set·a·TTL·on·the·cache,·and·it·will·treat·expired·items·as·missing\n·····*·when·they·are·fetched,·and·delete·them.\n·····*\n·····*·Optional,·but·must·be·a·non-negative·integer·in·ms·if·specified.\n·····*\n·····*·This·may·be·overridden·by·passing·an·options·object·to·`cache.set()`.\n·····*\n·····*·At·least·one·of·`max`,·`maxSize`,·or·`TTL`·is·required.·This·must·be·a\n·····*·positive·integer·if·set.\n·····*\n·····*·Even·if·ttl·tracking·is·enabled,·**it·is·strongly·recommended·to·set·a\n·····*·`max`·to·prevent·unbounded·growth·of·the·cache.**\n·····*\n·····*·If·ttl·tracking·is·enabled,·and·`max`·and·`maxSize`·are·not·set,\n·····*·and·`ttlAutopurge`·is·not·set,·then·a·warning·will·be·emitted\n·····*·cautioning·about·the·potential·for·unbounded·memory·consumption.\n·····*·(The·TypeScript·definitions·will·also·discourage·this.)\n·····*/\n····ttl?:·Milliseconds\n\n····/**\n·····*·Minimum·amount·of·time·in·ms·in·which·to·check·for·staleness.\n·····*·Defaults·to·1,·which·means·that·the·current·time·is·checked\n·····*·at·most·once·per·millisecond.\n·····*\n·····*·Set·to·0·to·check·the·current·time·every·time·staleness·is·tested.\n·····*·(This·reduces·performance,·and·is·theoretically·unnecessary.)\n·····*\n·····*·Setting·this·to·a·higher·value·will·improve·performance·somewhat\n·····*·while·using·ttl·tracking,·albeit·at·the·expense·of·keeping·stale\n·····*·items·around·a·bit·longer·than·their·TTLs·would·indicate.\n·····*\n·····*·@default·1\n·····*/\n····ttlResolution?:·Milliseconds\n\n····/**\n·····*·Preemptively·remove·stale·items·from·the·cache.\n·····*\n·····*·Note·that·this·may·*significantly*·degrade·performance,·especially·if\n·····*·the·cache·is·storing·a·large·number·of·items.·It·is·almost·always·best\n·····*·to·just·leave·the·stale·items·in·the·cache,·and·let·them·fall·out·as·new\n·····*·items·are·added.\n·····*\n·····*·Note·that·this·means·that·{@link·OptionsBase.allowStale}·is·a·bit\n·····*·pointless,·as·stale·items·will·be·deleted·almost·as·soon·as·they\n·····*·expire.\n·····*\n·····*·Use·with·caution!\n·····*/\n····ttlAutopurge?:·boolean\n\n····/**\n·····*·When·using·time-expiring·entries·with·`ttl`,·setting·this·to·`true`·will\n·····*·make·each·item's·age·reset·to·0·whenever·it·is·retrieved·from·cache·with\n·····*·{@link·LRUCache#get},·causing·it·to·not·expire.·(It·can·still·fall·out\n·····*·of·cache·based·on·recency·of·use,·of·course.)\n·····*\n·····*·Has·no·effect·if·{@link·OptionsBase.ttl}·is·not·set.\n·····*\n·····*·This·may·be·overridden·by·passing·an·options·object·to·`cache.get()`.\n·····*/\n····updateAgeOnGet?:·boolean\n\n····/**\n·····*·When·using·time-expiring·entries·with·`ttl`,·setting·this·to·`true`·will\n·····*·make·each·item's·age·reset·to·0·whenever·its·presence·in·the·cache·is\n·····*·checked·with·{@link·LRUCache#has},·causing·it·to·not·expire.·(It·can\n·····*·still·fall·out·of·cache·based·on·recency·of·use,·of·course.)\n·····*\n·····*·Has·no·effect·if·{@link·OptionsBase.ttl}·is·not·set.\n·····*/\n····updateAgeOnHas?:·boolean\n\n····/**\n·····*·Allow·{@link·LRUCache#get}·and·{@link·LRUCache#fetch}·calls·to·return\n·····*·stale·data,·if·available.\n·····*\n·····*·By·default,·if·you·set·`ttl`,·stale·items·will·only·be·deleted·from·the\n·····*·cache·when·you·`get(key)`.·That·is,·it's·not·preemptively·pruning·items,\n·····*·unless·{@link·OptionsBase.ttlAutopurge}·is·set.\n·····*\n·····*·If·you·set·`allowStale:true`,·it'll·return·the·stale·value·*as·well·as*\n·····*·deleting·it.·If·you·don't·set·this,·then·it'll·return·`undefined`·when\n·····*·you·try·to·get·a·stale·entry.\n·····*\n·····*·Note·that·when·a·stale·entry·is·fetched,·_even·if·it·is·returned·due·to\n·····*·`allowStale`·being·set_,·it·is·removed·from·the·cache·immediately.·You\n·····*·can·suppress·this·behavior·by·setting\n·····*·{@link·OptionsBase.noDeleteOnStaleGet},·either·in·the·constructor,·or·in\n·····*·the·options·provided·to·{@link·LRUCache#get}.\n·····*\n·····*·This·may·be·overridden·by·passing·an·options·object·to·`cache.get()`.\n·····*·The·`cache.has()`·method·will·always·return·`false`·for·stale·items.\n·····*\n·····*·Only·relevant·if·a·ttl·is·set.\n·····*/\n····allowStale?:·boolean\n\n····/**\n·····*·Function·that·is·called·on·items·when·they·are·dropped·from·the\n·····*·cache,·as·`dispose(value,·key,·reason)`.\n·····*\n·····*·This·can·be·handy·if·you·want·to·close·file·descriptors·or·do\n·····*·other·cleanup·tasks·when·items·are·no·longer·stored·in·the·cache.\n·····*\n·····*·**NOTE**:·It·is·called·_before_·the·item·has·been·fully·removed\n·····*·from·the·cache,·so·if·you·want·to·put·it·right·back·in,·you·need\n·····*·to·wait·until·the·next·tick.·If·you·try·to·add·it·back·in·during\n·····*·the·`dispose()`·function·call,·it·will·break·things·in·subtle·and\n·····*·weird·ways.\n·····*\n·····*·Unlike·several·other·options,·this·may·_not_·be·overridden·by\n·····*·passing·an·option·to·`set()`,·for·performance·reasons.\n·····*\n·····*·The·`reason`·will·be·one·of·the·following·strings,·corresponding\n·····*·to·the·reason·for·the·item's·deletion:\n·····*\n·····*·-·`evict`·Item·was·evicted·to·make·space·for·a·new·addition\n·····*·-·`set`·Item·was·overwritten·by·a·new·value\n·····*·-·`expire`·Item·expired·its·TTL\n·····*·-·`fetch`·Item·was·deleted·due·to·a·failed·or·aborted·fetch,·or·a\n·····*···fetchMethod·returning·`undefined.\n·····*·-·`delete`·Item·was·removed·by·explicit·`cache.delete(key)`,\n·····*···`cache.clear()`,·or·`cache.set(key,·undefined)`.\n·····*/\n····dispose?:·Disposer<K,·V>\n\n····/**\n·····*·Function·that·is·called·when·new·items·are·inserted·into·the·cache,\n·····*·as·`onInsert(value,·key,·reason)`.\n·····*\n·····*·This·can·be·useful·if·you·need·to·perform·actions·when·an·item·is\n·····*·added,·such·as·logging·or·tracking·insertions.\n·····*\n·····*·Unlike·some·other·options,·this·may·_not_·be·overridden·by·passing\n·····*·an·option·to·`set()`,·for·performance·and·consistency·reasons.\n·····*/\n····onInsert?:·Inserter<K,·V>\n\n····/**\n·····*·The·same·as·{@link·OptionsBase.dispose},·but·called·*after*·the·entry\n·····*·is·completely·removed·and·the·cache·is·once·again·in·a·clean·state.\n·····*\n·····*·It·is·safe·to·add·an·item·right·back·into·the·cache·at·this·point.\n·····*·However,·note·that·it·is·*very*·easy·to·inadvertently·create·infinite\n·····*·recursion·this·way.\n·····*/\n····disposeAfter?:·Disposer<K,·V>\n\n····/**\n·····*·Set·to·true·to·suppress·calling·the\n·····*·{@link·OptionsBase.dispose}·function·if·the·entry·key·is\n·····*·still·accessible·within·the·cache.\n·····*\n·····*·This·may·be·overridden·by·passing·an·options·object·to\n·····*·{@link·LRUCache#set}.\n·····*\n·····*·Only·relevant·if·`dispose`·or·`disposeAfter`·are·set.\n·····*/\n····noDisposeOnSet?:·boolean\n\n····/**\n·····*·Boolean·flag·to·tell·the·cache·to·not·update·the·TTL·when·setting·a·new\n·····*·value·for·an·existing·key·(ie,·when·updating·a·value·rather·than\n·····*·inserting·a·new·value).··Note·that·the·TTL·value·is·_always_·set·(if\n·····*·provided)·when·adding·a·new·entry·into·the·cache.\n·····*\n·····*·Has·no·effect·if·a·{@link·OptionsBase.ttl}·is·not·set.\n·····*\n·····*·May·be·passed·as·an·option·to·{@link·LRUCache#set}.\n·····*/\n····noUpdateTTL?:·boolean\n\n····/**\n·····*·Set·to·a·positive·integer·to·track·the·sizes·of·items·added·to·the\n·····*·cache,·and·automatically·evict·items·in·order·to·stay·below·this·size.\n·····*·Note·that·this·may·result·in·fewer·than·`max`·items·being·stored.\n·····*\n·····*·Attempting·to·add·an·item·to·the·cache·whose·calculated·size·is·greater\n·····*·that·this·amount·will·be·a·no-op.·The·item·will·not·be·cached,·and·no\n·····*·other·items·will·be·evicted.\n·····*\n·····*·Optional,·must·be·a·positive·integer·if·provided.\n·····*\n·····*·Sets·`maxEntrySize`·to·the·same·value,·unless·a·different·value·is\n·····*·provided·for·`maxEntrySize`.\n·····*\n·····*·At·least·one·of·`max`,·`maxSize`,·or·`TTL`·is·required.·This·must·be·a\n·····*·positive·integer·if·set.\n·····*\n·····*·Even·if·size·tracking·is·enabled,·**it·is·strongly·recommended·to·set·a\n·····*·`max`·to·prevent·unbounded·growth·of·the·cache.**\n·····*\n·····*·Note·also·that·size·tracking·can·negatively·impact·performance,\n·····*·though·for·most·cases,·only·minimally.\n·····*/\n····maxSize?:·Size\n\n····/**\n·····*·The·maximum·allowed·size·for·any·single·item·in·the·cache.\n·····*\n·····*·If·a·larger·item·is·passed·to·{@link·LRUCache#set}·or·returned·by·a\n·····*·{@link·OptionsBase.fetchMethod}·or·{@link·OptionsBase.memoMethod},·then\n·····*·it·will·not·be·stored·in·the·cache.\n·····*\n·····*·Attempting·to·add·an·item·whose·calculated·size·is·greater·than\n·····*·this·amount·will·not·cache·the·item·or·evict·any·old·items,·but\n·····*·WILL·delete·an·existing·value·if·one·is·already·present.\n·····*\n·····*·Optional,·must·be·a·positive·integer·if·provided.·Defaults·to\n·····*·the·value·of·`maxSize`·if·provided.\n·····*/\n····maxEntrySize?:·Size\n\n····/**\n·····*·A·function·that·returns·a·number·indicating·the·item's·size.\n·····*\n·····*·Requires·{@link·OptionsBase.maxSize}·to·be·set.\n·····*\n·····*·If·not·provided,·and·{@link·OptionsBase.maxSize}·or\n·····*·{@link·OptionsBase.maxEntrySize}·are·set,·then·all\n·····*·{@link·LRUCache#set}·calls·**must**·provide·an·explicit\n·····*·{@link·SetOptions.size}·or·sizeCalculation·param.\n·····*/\n····sizeCalculation?:·SizeCalculator<K,·V>\n\n····/**\n·····*·Method·that·provides·the·implementation·for·{@link·LRUCache#fetch}\n·····*\n·····*·```ts\n·····*·fetchMethod(key,·staleValue,·{·signal,·options,·context·})\n·····*·```\n·····*\n·····*·If·`fetchMethod`·is·not·provided,·then·`cache.fetch(key)`·is·equivalent\n·····*·to·`Promise.resolve(cache.get(key))`.\n·····*\n·····*·If·at·any·time,·`signal.aborted`·is·set·to·`true`,·or·if·the\n·····*·`signal.onabort`·method·is·called,·or·if·it·emits·an·`'abort'`·event\n·····*·which·you·can·listen·to·with·`addEventListener`,·then·that·means·that\n·····*·the·fetch·should·be·abandoned.·This·may·be·passed·along·to·async\n·····*·functions·aware·of·AbortController/AbortSignal·behavior.\n·····*\n·····*·The·`fetchMethod`·should·**only**·return·`undefined`·or·a·Promise\n·····*·resolving·to·`undefined`·if·the·AbortController·signaled·an·`abort`\n·····*·event.·In·all·other·cases,·it·should·return·or·resolve·to·a·value\n·····*·suitable·for·adding·to·the·cache.\n·····*\n·····*·The·`options`·object·is·a·union·of·the·options·that·may·be·provided·to\n·····*·`set()`·and·`get()`.·If·they·are·modified,·then·that·will·result·in\n·····*·modifying·the·settings·to·`cache.set()`·when·the·value·is·resolved,·and\n·····*·in·the·case·of\n·····*·{@link·OptionsBase.noDeleteOnFetchRejection}·and\n·····*·{@link·OptionsBase.allowStaleOnFetchRejection},·the·handling·of\n·····*·`fetchMethod`·failures.\n·····*\n·····*·For·example,·a·DNS·cache·may·update·the·TTL·based·on·the·value·returned\n·····*·from·a·remote·DNS·server·by·changing·`options.ttl`·in·the·`fetchMethod`.\n·····*/\n····fetchMethod?:·Fetcher<K,·V,·FC>\n\n····/**\n·····*·Method·that·provides·the·implementation·for·{@link·LRUCache#memo}\n·····*/\n····memoMethod?:·Memoizer<K,·V,·FC>\n\n····/**\n·····*·Set·to·true·to·suppress·the·deletion·of·stale·data·when·a\n·····*·{@link·OptionsBase.fetchMethod}·returns·a·rejected·promise.\n·····*/\n····noDeleteOnFetchRejection?:·boolean\n\n····/**\n·····*·Do·not·delete·stale·items·when·they·are·retrieved·with\n·····*·{@link·LRUCache#get}.\n·····*\n·····*·Note·that·the·`get`·return·value·will·still·be·`undefined`\n·····*·unless·{@link·OptionsBase.allowStale}·is·true.\n·····*\n·····*·When·using·time-expiring·entries·with·`ttl`,·by·default·stale\n·····*·items·will·be·removed·from·the·cache·when·the·key·is·accessed\n·····*·with·`cache.get()`.\n·····*\n·····*·Setting·this·option·will·cause·stale·items·to·remain·in·the·cache,·until\n·····*·they·are·explicitly·deleted·with·`cache.delete(key)`,·or·retrieved·with\n·····*·`noDeleteOnStaleGet`·set·to·`false`.\n·····*\n·····*·This·may·be·overridden·by·passing·an·options·object·to·`cache.get()`.\n·····*\n·····*·Only·relevant·if·a·ttl·is·used.\n·····*/\n····noDeleteOnStaleGet?:·boolean\n\n····/**\n·····*·Set·to·true·to·allow·returning·stale·data·when·a\n·····*·{@link·OptionsBase.fetchMethod}·throws·an·error·or·returns·a·rejected\n·····*·promise.\n·····*\n·····*·This·differs·from·using·{@link·OptionsBase.allowStale}·in·that·stale\n·····*·data·will·ONLY·be·returned·in·the·case·that·the·{@link·LRUCache#fetch}\n·····*·fails,·not·any·other·times.\n·····*\n·····*·If·a·`fetchMethod`·fails,·and·there·is·no·stale·value·available,·the\n·····*·`fetch()`·will·resolve·to·`undefined`.·Ie,·all·`fetchMethod`·errors·are\n·····*·suppressed.\n·····*\n·····*·Implies·`noDeleteOnFetchRejection`.\n·····*\n·····*·This·may·be·set·in·calls·to·`fetch()`,·or·defaulted·on·the·constructor,\n·····*·or·overridden·by·modifying·the·options·object·in·the·`fetchMethod`.\n·····*/\n····allowStaleOnFetchRejection?:·boolean\n\n····/**\n·····*·Set·to·true·to·return·a·stale·value·from·the·cache·when·the\n·····*·`AbortSignal`·passed·to·the·{@link·OptionsBase.fetchMethod}·dispatches\n·····*·an·`'abort'`·event,·whether·user-triggered,·or·due·to·internal·cache\n·····*·behavior.\n·····*\n·····*·Unless·{@link·OptionsBase.ignoreFetchAbort}·is·also·set,·the·underlying\n·····*·{@link·OptionsBase.fetchMethod}·will·still·be·considered·canceled,·and\n·····*·any·value·it·returns·will·be·ignored·and·not·cached.\n·····*\n·····*·Caveat:·since·fetches·are·aborted·when·a·new·value·is·explicitly\n·····*·set·in·the·cache,·this·can·lead·to·fetch·returning·a·stale·value,\n·····*·since·that·was·the·fallback·value·_at·the·moment·the·`fetch()`·was\n·····*·initiated_,·even·though·the·new·updated·value·is·now·present·in\n·····*·the·cache.\n·····*\n·····*·For·example:\n·····*\n·····*·```ts\n·····*·const·cache·=·new·LRUCache<string,·any>({\n·····*···ttl:·100,\n·····*···fetchMethod:·async·(url,·oldValue,·{·signal·})·=>··{\n·····*·····const·res·=·await·fetch(url,·{·signal·})\n·····*·····return·await·res.json()\n·····*···}\n·····*·})\n·····*·cache.set('https://example.com/',·{·some:·'data'·})\n·····*·//·100ms·go·by...\n·····*·const·result·=·cache.fetch('https://example.com/')\n·····*·cache.set('https://example.com/',·{·other:·'thing'·})\n·····*·console.log(await·result)·//·{·some:·'data'·}\n·····*·console.log(cache.get('https://example.com/'))·//·{·other:·'thing'·}\n·····*·```\n·····*/\n····allowStaleOnFetchAbort?:·boolean\n\n····/**\n·····*·Set·to·true·to·ignore·the·`abort`·event·emitted·by·the·`AbortSignal`\n·····*·object·passed·to·{@link·OptionsBase.fetchMethod},·and·still·cache·the\n·····*·resulting·resolution·value,·as·long·as·it·is·not·`undefined`.\n·····*\n·····*·When·used·on·its·own,·this·means·aborted·{@link·LRUCache#fetch}·calls\n·····*·are·not·immediately·resolved·or·rejected·when·they·are·aborted,·and\n·····*·instead·take·the·full·time·to·await.\n·····*\n·····*·When·used·with·{@link·OptionsBase.allowStaleOnFetchAbort},·aborted\n·····*·{@link·LRUCache#fetch}·calls·will·resolve·immediately·to·their·stale\n·····*·cached·value·or·`undefined`,·and·will·continue·to·process·and·eventually\n·····*·update·the·cache·when·they·resolve,·as·long·as·the·resulting·value·is\n·····*·not·`undefined`,·thus·supporting·a·\"return·stale·on·timeout·while\n·····*·refreshing\"·mechanism·by·passing·`AbortSignal.timeout(n)`·as·the·signal.\n·····*\n·····*·For·example:\n·····*\n·····*·```ts\n·····*·const·c·=·new·LRUCache({\n·····*···ttl:·100,\n·····*···ignoreFetchAbort:·true,\n·····*···allowStaleOnFetchAbort:·true,\n·····*···fetchMethod:·async·(key,·oldValue,·{·signal·})·=>·{\n·····*·····//·note:·do·NOT·pass·the·signal·to·fetch()!\n·····*·····//·let's·say·this·fetch·can·take·a·long·time.\n·····*·····const·res·=·await·fetch(`https://slow-backend-server/${key}`)\n·····*·····return·await·res.json()\n·····*···},\n·····*·})\n·····*\n·····*·//·this·will·return·the·stale·value·after·100ms,·while·still\n·····*·//·updating·in·the·background·for·next·time.\n·····*·const·val·=·await·c.fetch('key',·{·signal:·AbortSignal.timeout(100)·})\n·····*·```\n·····*\n·····*·**Note**:·regardless·of·this·setting,·an·`abort`·event·_is·still\n·····*·emitted·on·the·`AbortSignal`·object_,·so·may·result·in·invalid·results\n·····*·when·passed·to·other·underlying·APIs·that·use·AbortSignals.\n·····*\n·····*·This·may·be·overridden·in·the·{@link·OptionsBase.fetchMethod}·or·the\n·····*·call·to·{@link·LRUCache#fetch}.\n·····*/\n····ignoreFetchAbort?:·boolean\n\n····/**\n·····*·In·some·cases,·you·may·want·to·swap·out·the·performance/Date·object\n·····*·used·for·TTL·tracking.·This·should·almost·certainly·NOT·be·done·in\n·····*·production·environments!\n·····*\n·····*·This·value·defaults·to·`global.performance`·if·it·has·a·`now()`·method,\n·····*·or·the·`global.Date`·object·otherwise.\n·····*/\n····perf?:·Perf\n··}\n\n··export·interface·OptionsMaxLimit<K,·V,·FC>·extends·OptionsBase<\n····K,\n····V,\n····FC\n··>·{\n····max:·Count\n··}\n··export·interface·OptionsTTLLimit<K,·V,·FC>·extends·OptionsBase<\n····K,\n····V,\n····FC\n··>·{\n····ttl:·Milliseconds\n····ttlAutopurge:·boolean\n··}\n··export·interface·OptionsSizeLimit<K,·V,·FC>·extends·OptionsBase<\n····K,\n····V,\n····FC\n··>·{\n····maxSize:·Size\n··}\n\n··/**\n···*·The·valid·safe·options·for·the·{@link·LRUCache}·constructor\n···*/\n··export·type·Options<K,·V,·FC>·=\n····|·OptionsMaxLimit<K,·V,·FC>\n····|·OptionsSizeLimit<K,·V,·FC>\n····|·OptionsTTLLimit<K,·V,·FC>\n\n··/**\n···*·Entry·objects·used·by·{@link·LRUCache#load}·and·{@link·LRUCache#dump},\n···*·and·returned·by·{@link·LRUCache#info}.\n···*/\n··export·interface·Entry<V>·{\n····value:·V\n····ttl?:·Milliseconds\n····size?:·Size\n····start?:·Milliseconds\n··}\n}\n\n/**\n·*·Default·export,·the·thing·you're·using·this·module·to·get.\n·*\n·*·The·`K`·and·`V`·types·define·the·key·and·value·types,·respectively.·The\n·*·optional·`FC`·type·defines·the·type·of·the·`context`·object·passed·to\n·*·`cache.fetch()`·and·`cache.memo()`.\n·*\n·*·Keys·and·values·**must·not**·be·`null`·or·`undefined`.\n·*\n·*·All·properties·from·the·options·object·(with·the·exception·of·`max`,\n·*·`maxSize`,·`fetchMethod`,·`memoMethod`,·`dispose`·and·`disposeAfter`)·are\n·*·added·as·normal·public·members.·(The·listed·options·are·read-only·getters.)\n·*\n·*·Changing·any·of·these·will·alter·the·defaults·for·subsequent·method·calls.\n·*/\nexport·class·LRUCache<K·extends·{},·V·extends·{},·FC·=·unknown>·{\n··//·options·that·cannot·be·changed·without·disaster\n··readonly·#max:·LRUCache.Count\n··readonly·#maxSize:·LRUCache.Size\n··readonly·#dispose?:·LRUCache.Disposer<K,·V>\n··readonly·#onInsert?:·LRUCache.Inserter<K,·V>\n··readonly·#disposeAfter?:·LRUCache.Disposer<K,·V>\n··readonly·#fetchMethod?:·LRUCache.Fetcher<K,·V,·FC>\n··readonly·#memoMethod?:·LRUCache.Memoizer<K,·V,·FC>\n··readonly·#perf:·Perf\n\n··/**\n···*·{@link·LRUCache.OptionsBase.perf}\n···*/\n··get·perf()·{\n····return·this.#perf\n··}\n\n··/**\n···*·{@link·LRUCache.OptionsBase.ttl}\n···*/\n··ttl:·LRUCache.Milliseconds\n\n··/**\n···*·{@link·LRUCache.OptionsBase.ttlResolution}\n···*/\n··ttlResolution:·LRUCache.Milliseconds\n··/**\n···*·{@link·LRUCache.OptionsBase.ttlAutopurge}\n···*/\n··ttlAutopurge:·boolean\n··/**\n···*·{@link·LRUCache.OptionsBase.updateAgeOnGet}\n···*/\n··updateAgeOnGet:·boolean\n··/**\n···*·{@link·LRUCache.OptionsBase.updateAgeOnHas}\n···*/\n··updateAgeOnHas:·boolean\n··/**\n···*·{@link·LRUCache.OptionsBase.allowStale}\n···*/\n··allowStale:·boolean\n\n··/**\n···*·{@link·LRUCache.OptionsBase.noDisposeOnSet}\n···*/\n··noDisposeOnSet:·boolean\n··/**\n···*·{@link·LRUCache.OptionsBase.noUpdateTTL}\n···*/\n··noUpdateTTL:·boolean\n··/**\n···*·{@link·LRUCache.OptionsBase.maxEntrySize}\n···*/\n··maxEntrySize:·LRUCache.Size\n··/**\n···*·{@link·LRUCache.OptionsBase.sizeCalculation}\n···*/\n··sizeCalculation?:·LRUCache.SizeCalculator<K,·V>\n··/**\n···*·{@link·LRUCache.OptionsBase.noDeleteOnFetchRejection}\n···*/\n··noDeleteOnFetchRejection:·boolean\n··/**\n···*·{@link·LRUCache.OptionsBase.noDeleteOnStaleGet}\n···*/\n··noDeleteOnStaleGet:·boolean\n··/**\n···*·{@link·LRUCache.OptionsBase.allowStaleOnFetchAbort}\n···*/\n··allowStaleOnFetchAbort:·boolean\n··/**\n···*·{@link·LRUCache.OptionsBase.allowStaleOnFetchRejection}\n···*/\n··allowStaleOnFetchRejection:·boolean\n··/**\n···*·{@link·LRUCache.OptionsBase.ignoreFetchAbort}\n···*/\n··ignoreFetchAbort:·boolean\n\n··//·computed·properties\n··#size:·LRUCache.Count\n··#calculatedSize:·LRUCache.Size\n··#keyMap:·Map<K,·Index>\n··#keyList:·(K·|·undefined)[]\n··#valList:·(V·|·BackgroundFetch<V>·|·undefined)[]\n··#next:·NumberArray\n··#prev:·NumberArray\n··#head:·Index\n··#tail:·Index\n··#free:·StackLike\n··#disposed?:·DisposeTask<K,·V>[]\n··#sizes?:·ZeroArray\n··#starts?:·ZeroArray\n··#ttls?:·ZeroArray\n··#autopurgeTimers?:·(undefined·|·ReturnType<typeof·setTimeout>)[]\n\n··#hasDispose:·boolean\n··#hasFetchMethod:·boolean\n··#hasDisposeAfter:·boolean\n··#hasOnInsert:·boolean\n\n··/**\n···*·Do·not·call·this·method·unless·you·need·to·inspect·the\n···*·inner·workings·of·the·cache.··If·anything·returned·by·this\n···*·object·is·modified·in·any·way,·strange·breakage·may·occur.\n···*\n···*·These·fields·are·private·for·a·reason!\n···*\n···*·@internal\n···*/\n··static·unsafeExposeInternals<\n····K·extends·{},\n····V·extends·{},\n····FC·extends·unknown·=·unknown,\n··>(c:·LRUCache<K,·V,·FC>)·{\n····return·{\n······//·properties\n······starts:·c.#starts,\n······ttls:·c.#ttls,\n······autopurgeTimers:·c.#autopurgeTimers,\n······sizes:·c.#sizes,\n······keyMap:·c.#keyMap·as·Map<K,·number>,\n······keyList:·c.#keyList,\n······valList:·c.#valList,\n······next:·c.#next,\n······prev:·c.#prev,\n······get·head()·{\n········return·c.#head\n······},\n······get·tail()·{\n········return·c.#tail\n······},\n······free:·c.#free,\n······//·methods\n······isBackgroundFetch:·(p:·unknown)·=>·c.#isBackgroundFetch(p),\n······backgroundFetch:·(\n········k:·K,\n········index:·number·|·undefined,\n········options:·LRUCache.FetchOptions<K,·V,·FC>,\n········context:·unknown,\n······):·BackgroundFetch<V>·=>\n········c.#backgroundFetch(\n··········k,\n··········index·as·Index·|·undefined,\n··········options,\n··········context·as·FC,\n········),\n······moveToTail:·(index:·number):·void·=>·c.#moveToTail(index·as·Index),\n······indexes:·(options?:·{·allowStale:·boolean·})·=>·c.#indexes(options),\n······rindexes:·(options?:·{·allowStale:·boolean·})·=>\n········c.#rindexes(options),\n······isStale:·(index:·number·|·undefined)·=>·c.#isStale(index·as·Index),\n····}\n··}\n\n··//·Protected·read-only·members\n\n··/**\n···*·{@link·LRUCache.OptionsBase.max}·(read-only)\n···*/\n··get·max():·LRUCache.Count·{\n····return·this.#max\n··}\n··/**\n···*·{@link·LRUCache.OptionsBase.maxSize}·(read-only)\n···*/\n··get·maxSize():·LRUCache.Count·{\n····return·this.#maxSize\n··}\n··/**\n···*·The·total·computed·size·of·items·in·the·cache·(read-only)\n···*/\n··get·calculatedSize():·LRUCache.Size·{\n····return·this.#calculatedSize\n··}\n··/**\n···*·The·number·of·items·stored·in·the·cache·(read-only)\n···*/\n··get·size():·LRUCache.Count·{\n····return·this.#size\n··}\n··/**\n···*·{@link·LRUCache.OptionsBase.fetchMethod}·(read-only)\n···*/\n··get·fetchMethod():·LRUCache.Fetcher<K,·V,·FC>·|·undefined·{\n····return·this.#fetchMethod\n··}\n··get·memoMethod():·LRUCache.Memoizer<K,·V,·FC>·|·undefined·{\n····return·this.#memoMethod\n··}\n··/**\n···*·{@link·LRUCache.OptionsBase.dispose}·(read-only)\n···*/\n··get·dispose()·{\n····return·this.#dispose\n··}\n··/**\n···*·{@link·LRUCache.OptionsBase.onInsert}·(read-only)\n···*/\n··get·onInsert()·{\n····return·this.#onInsert\n··}\n··/**\n···*·{@link·LRUCache.OptionsBase.disposeAfter}·(read-only)\n···*/\n··get·disposeAfter()·{\n····return·this.#disposeAfter\n··}\n\n··constructor(options:·LRUCache.Options<K,·V,·FC>·|·LRUCache<K,·V,·FC>)·{\n····const·{\n······max·=·0,\n······ttl,\n······ttlResolution·=·1,\n······ttlAutopurge,\n······updateAgeOnGet,\n······updateAgeOnHas,\n······allowStale,\n······dispose,\n······onInsert,\n······disposeAfter,\n······noDisposeOnSet,\n······noUpdateTTL,\n······maxSize·=·0,\n······maxEntrySize·=·0,\n······sizeCalculation,\n······fetchMethod,\n······memoMethod,\n······noDeleteOnFetchRejection,\n······noDeleteOnStaleGet,\n······allowStaleOnFetchRejection,\n······allowStaleOnFetchAbort,\n······ignoreFetchAbort,\n······perf,\n····}·=·options\n\n····if·(perf·!==·undefined)·{\n······if·(typeof·perf?.now·!==·'function')·{\n········throw·new·TypeError(\n··········'perf·option·must·have·a·now()·method·if·specified',\n········)\n······}\n····}\n\n····this.#perf·=·perf·??·defaultPerf\n\n····if·(max·!==·0·&&·!isPosInt(max))·{\n······throw·new·TypeError('max·option·must·be·a·nonnegative·integer')\n····}\n\n····const·UintArray·=·max·?·getUintArray(max)·:·Array\n····if·(!UintArray)·{\n······throw·new·Error('invalid·max·value:·'·+·max)\n····}\n\n····this.#max·=·max\n····this.#maxSize·=·maxSize\n····this.maxEntrySize·=·maxEntrySize·||·this.#maxSize\n····this.sizeCalculation·=·sizeCalculation\n····if·(this.sizeCalculation)·{\n······if·(!this.#maxSize·&&·!this.maxEntrySize)·{\n········throw·new·TypeError(\n··········'cannot·set·sizeCalculation·without·setting·maxSize·or·maxEntrySize',\n········)\n······}\n······if·(typeof·this.sizeCalculation·!==·'function')·{\n········throw·new·TypeError('sizeCalculation·set·to·non-function')\n······}\n····}\n\n····if·(memoMethod·!==·undefined·&&·typeof·memoMethod·!==·'function')·{\n······throw·new·TypeError('memoMethod·must·be·a·function·if·defined')\n····}\n····this.#memoMethod·=·memoMethod\n\n····if·(fetchMethod·!==·undefined·&&·typeof·fetchMethod·!==·'function')·{\n······throw·new·TypeError('fetchMethod·must·be·a·function·if·specified')\n····}\n····this.#fetchMethod·=·fetchMethod\n····this.#hasFetchMethod·=·!!fetchMethod\n\n····this.#keyMap·=·new·Map()\n····this.#keyList·=·Array.from({·length:·max·}).fill(undefined)·as·(\n······|·K\n······|·undefined\n····)[]\n····this.#valList·=·Array.from({·length:·max·}).fill(undefined)·as·(\n······|·V\n······|·undefined\n····)[]\n····this.#next·=·new·UintArray(max)\n····this.#prev·=·new·UintArray(max)\n····this.#head·=·0·as·Index\n····this.#tail·=·0·as·Index\n····this.#free·=·Stack.create(max)\n····this.#size·=·0\n····this.#calculatedSize·=·0\n\n····if·(typeof·dispose·===·'function')·{\n······this.#dispose·=·dispose\n····}\n····if·(typeof·onInsert·===·'function')·{\n······this.#onInsert·=·onInsert\n····}\n····if·(typeof·disposeAfter·===·'function')·{\n······this.#disposeAfter·=·disposeAfter\n······this.#disposed·=·[]\n····}·else·{\n······this.#disposeAfter·=·undefined\n······this.#disposed·=·undefined\n····}\n····this.#hasDispose·=·!!this.#dispose\n····this.#hasOnInsert·=·!!this.#onInsert\n····this.#hasDisposeAfter·=·!!this.#disposeAfter\n\n····this.noDisposeOnSet·=·!!noDisposeOnSet\n····this.noUpdateTTL·=·!!noUpdateTTL\n····this.noDeleteOnFetchRejection·=·!!noDeleteOnFetchRejection\n····this.allowStaleOnFetchRejection·=·!!allowStaleOnFetchRejection\n····this.allowStaleOnFetchAbort·=·!!allowStaleOnFetchAbort\n····this.ignoreFetchAbort·=·!!ignoreFetchAbort\n\n····//·NB:·maxEntrySize·is·set·to·maxSize·if·it's·set\n····if·(this.maxEntrySize·!==·0)·{\n······if·(this.#maxSize·!==·0)·{\n········if·(!isPosInt(this.#maxSize))·{\n··········throw·new·TypeError(\n············'maxSize·must·be·a·positive·integer·if·specified',\n··········)\n········}\n······}\n······if·(!isPosInt(this.maxEntrySize))·{\n········throw·new·TypeError(\n··········'maxEntrySize·must·be·a·positive·integer·if·specified',\n········)\n······}\n······this.#initializeSizeTracking()\n····}\n\n····this.allowStale·=·!!allowStale\n····this.noDeleteOnStaleGet·=·!!noDeleteOnStaleGet\n····this.updateAgeOnGet·=·!!updateAgeOnGet\n····this.updateAgeOnHas·=·!!updateAgeOnHas\n····this.ttlResolution·=\n······isPosInt(ttlResolution)·||·ttlResolution·===·0·?·ttlResolution·:·1\n····this.ttlAutopurge·=·!!ttlAutopurge\n····this.ttl·=·ttl·||·0\n····if·(this.ttl)·{\n······if·(!isPosInt(this.ttl))·{\n········throw·new·TypeError('ttl·must·be·a·positive·integer·if·specified')\n······}\n······this.#initializeTTLTracking()\n····}\n\n····//·do·not·allow·completely·unbounded·caches\n····if·(this.#max·===·0·&&·this.ttl·===·0·&&·this.#maxSize·===·0)·{\n······throw·new·TypeError(\n········'At·least·one·of·max,·maxSize,·or·ttl·is·required',\n······)\n····}\n····if·(!this.ttlAutopurge·&&·!this.#max·&&·!this.#maxSize)·{\n······const·code·=·'LRU_CACHE_UNBOUNDED'\n······if·(shouldWarn(code))·{\n········warned.add(code)\n········const·msg·=\n··········'TTL·caching·without·ttlAutopurge,·max,·or·maxSize·can·'·+\n··········'result·in·unbounded·memory·consumption.'\n········emitWarning(msg,·'UnboundedCacheWarning',·code,·LRUCache)\n······}\n····}\n··}\n\n··/**\n···*·Return·the·number·of·ms·left·in·the·item's·TTL.·If·item·is·not·in·cache,\n···*·returns·`0`.·Returns·`Infinity`·if·item·is·in·cache·without·a·defined·TTL.\n···*/\n··getRemainingTTL(key:·K)·{\n····return·this.#keyMap.has(key)·?·Infinity·:·0\n··}\n\n··#initializeTTLTracking()·{\n····const·ttls·=·new·ZeroArray(this.#max)\n····const·starts·=·new·ZeroArray(this.#max)\n····this.#ttls·=·ttls\n····this.#starts·=·starts\n····const·purgeTimers·=\n······this.ttlAutopurge·?\n········Array.from<undefined·|·ReturnType<typeof·setTimeout>>({\n··········length:·this.#max,\n········})\n······:·undefined\n····this.#autopurgeTimers·=·purgeTimers\n\n····this.#setItemTTL·=·(index,·ttl,·start·=·this.#perf.now())·=>·{\n······starts[index]·=·ttl·!==·0·?·start·:·0\n······ttls[index]·=·ttl\n······setPurgetTimer(index,·ttl)\n····}\n\n····this.#updateItemAge·=·index·=>·{\n······starts[index]·=·ttls[index]·!==·0·?·this.#perf.now()·:·0\n······setPurgetTimer(index,·ttls[index])\n····}\n\n····//·clear·out·the·purge·timer·if·we're·setting·TTL·to·0,·and\n····//·previously·had·a·ttl·purge·timer·running,·so·it·doesn't\n····//·fire·unnecessarily.·Don't·need·to·do·this·if·we're·not·doing\n····//·autopurge.\n····const·setPurgetTimer·=\n······!this.ttlAutopurge·?\n········()·=>·{}\n······:·(index:·Index,·ttl?:·number)·=>·{\n··········if·(purgeTimers?.[index])·{\n············clearTimeout(purgeTimers[index])\n············purgeTimers[index]·=·undefined\n··········}\n··········if·(ttl·&&·ttl·!==·0·&&·purgeTimers)·{\n············const·t·=·setTimeout(()·=>·{\n··············if·(this.#isStale(index))·{\n················this.#delete(this.#keyList[index]·as·K,·'expire')\n··············}\n············},·ttl·+·1)\n············//·unref()·not·supported·on·all·platforms\n············/*·c8·ignore·start·*/\n············if·(t.unref)·{\n··············t.unref()\n············}\n············/*·c8·ignore·stop·*/\n············purgeTimers[index]·=·t\n··········}\n········}\n\n····this.#statusTTL·=·(status,·index)·=>·{\n······if·(ttls[index])·{\n········const·ttl·=·ttls[index]\n········const·start·=·starts[index]\n········/*·c8·ignore·start·*/\n········if·(!ttl·||·!start)·{\n··········return\n········}\n········/*·c8·ignore·stop·*/\n········status.ttl·=·ttl\n········status.start·=·start\n········status.now·=·cachedNow·||·getNow()\n········const·age·=·status.now·-·start\n········status.remainingTTL·=·ttl·-·age\n······}\n····}\n\n····//·debounce·calls·to·perf.now()·to·1s·so·we're·not·hitting\n····//·that·costly·call·repeatedly.\n····let·cachedNow·=·0\n····const·getNow·=·()·=>·{\n······const·n·=·this.#perf.now()\n······if·(this.ttlResolution·>·0)·{\n········cachedNow·=·n\n········const·t·=·setTimeout(()·=>·(cachedNow·=·0),·this.ttlResolution)\n········//·not·available·on·all·platforms\n········/*·c8·ignore·start·*/\n········if·(t.unref)·{\n··········t.unref()\n········}\n········/*·c8·ignore·stop·*/\n······}\n······return·n\n····}\n\n····this.getRemainingTTL·=·key·=>·{\n······const·index·=·this.#keyMap.get(key)\n······if·(index·===·undefined)·{\n········return·0\n······}\n······const·ttl·=·ttls[index]\n······const·start·=·starts[index]\n······if·(!ttl·||·!start)·{\n········return·Infinity\n······}\n······const·age·=·(cachedNow·||·getNow())·-·start\n······return·ttl·-·age\n····}\n\n····this.#isStale·=·index·=>·{\n······const·s·=·starts[index]\n······const·t·=·ttls[index]\n······return·!!t·&&·!!s·&&·(cachedNow·||·getNow())·-·s·>·t\n····}\n··}\n\n··//·conditionally·set·private·methods·related·to·TTL\n··#updateItemAge:·(index:·Index)·=>·void·=·()·=>·{}\n··#statusTTL:·(status:·LRUCache.Status<K,·V>,·index:·Index)·=>·void·=\n····()·=>·{}\n··#setItemTTL:·(\n····index:·Index,\n····ttl:·LRUCache.Milliseconds,\n····start?:·LRUCache.Milliseconds,\n····//·ignore·because·we·never·call·this·if·we're·not·already·in·TTL·mode\n····/*·c8·ignore·start·*/\n··)·=>·void·=·()·=>·{}\n··/*·c8·ignore·stop·*/\n\n··#isStale:·(index:·Index)·=>·boolean·=·()·=>·false\n\n··#initializeSizeTracking()·{\n····const·sizes·=·new·ZeroArray(this.#max)\n····this.#calculatedSize·=·0\n····this.#sizes·=·sizes\n····this.#removeItemSize·=·index·=>·{\n······this.#calculatedSize·-=·sizes[index]·as·number\n······sizes[index]·=·0\n····}\n····this.#requireSize·=·(k,·v,·size,·sizeCalculation)·=>·{\n······//·provisionally·accept·background·fetches.\n······//·actual·value·size·will·be·checked·when·they·return.\n······if·(this.#isBackgroundFetch(v))·{\n········return·0\n······}\n······if·(!isPosInt(size))·{\n········if·(sizeCalculation)·{\n··········if·(typeof·sizeCalculation·!==·'function')·{\n············throw·new·TypeError('sizeCalculation·must·be·a·function')\n··········}\n··········size·=·sizeCalculation(v,·k)\n··········if·(!isPosInt(size))·{\n············throw·new·TypeError(\n··············'sizeCalculation·return·invalid·(expect·positive·integer)',\n············)\n··········}\n········}·else·{\n··········throw·new·TypeError(\n············'invalid·size·value·(must·be·positive·integer).·'·+\n··············'When·maxSize·or·maxEntrySize·is·used,·sizeCalculation·'·+\n··············'or·size·must·be·set.',\n··········)\n········}\n······}\n······return·size\n····}\n\n····this.#addItemSize·=·(\n······index:·Index,\n······size:·LRUCache.Size,\n······status?:·LRUCache.Status<K,·V>,\n····)·=>·{\n······sizes[index]·=·size\n······if·(this.#maxSize)·{\n········const·maxSize·=·this.#maxSize·-·(sizes[index]·as·number)\n········while·(this.#calculatedSize·>·maxSize)·{\n··········this.#evict(true)\n········}\n······}\n······this.#calculatedSize·+=·sizes[index]·as·number\n······if·(status)·{\n········status.entrySize·=·size\n········status.totalCalculatedSize·=·this.#calculatedSize\n······}\n····}\n··}\n\n··#removeItemSize:·(index:·Index)·=>·void·=·_i·=>·{}\n\n··#addItemSize:·(\n····index:·Index,\n····size:·LRUCache.Size,\n····status?:·LRUCache.Status<K,·V>,\n··)·=>·void·=·(_i,·_s,·_st)·=>·{}\n\n··#requireSize:·(\n····k:·K,\n····v:·V·|·BackgroundFetch<V>,\n····size?:·LRUCache.Size,\n····sizeCalculation?:·LRUCache.SizeCalculator<K,·V>,\n····status?:·LRUCache.Status<K,·V>,\n··)·=>·LRUCache.Size·=·(\n····_k:·K,\n····_v:·V·|·BackgroundFetch<V>,\n····size?:·LRUCache.Size,\n····sizeCalculation?:·LRUCache.SizeCalculator<K,·V>,\n··)·=>·{\n····if·(size·||·sizeCalculation)·{\n······throw·new·TypeError(\n········'cannot·set·size·without·setting·maxSize·or·maxEntrySize·on·cache',\n······)\n····}\n····return·0\n··};\n\n··*#indexes({·allowStale·=·this.allowStale·}·=·{})·{\n····if·(this.#size)·{\n······for·(let·i·=·this.#tail;·this.#isValidIndex(i);·)·{\n········if·(allowStale·||·!this.#isStale(i))·{\n··········yield·i\n········}\n········if·(i·===·this.#head)·{\n··········break\n········}·else·{\n··········i·=·this.#prev[i]·as·Index\n········}\n······}\n····}\n··}\n\n··*#rindexes({·allowStale·=·this.allowStale·}·=·{})·{\n····if·(this.#size)·{\n······for·(let·i·=·this.#head;·this.#isValidIndex(i);·)·{\n········if·(allowStale·||·!this.#isStale(i))·{\n··········yield·i\n········}\n········if·(i·===·this.#tail)·{\n··········break\n········}·else·{\n··········i·=·this.#next[i]·as·Index\n········}\n······}\n····}\n··}\n\n··#isValidIndex(index:·Index)·{\n····return·(\n······index·!==·undefined·&&\n······this.#keyMap.get(this.#keyList[index]·as·K)·===·index\n····)\n··}\n\n··/**\n···*·Return·a·generator·yielding·`[key,·value]`·pairs,\n···*·in·order·from·most·recently·used·to·least·recently·used.\n···*/\n··*entries()·{\n····for·(const·i·of·this.#indexes())·{\n······if·(\n········this.#valList[i]·!==·undefined·&&\n········this.#keyList[i]·!==·undefined·&&\n········!this.#isBackgroundFetch(this.#valList[i])\n······)·{\n········yield·[this.#keyList[i],·this.#valList[i]]·as·[K,·V]\n······}\n····}\n··}\n\n··/**\n···*·Inverse·order·version·of·{@link·LRUCache.entries}\n···*\n···*·Return·a·generator·yielding·`[key,·value]`·pairs,\n···*·in·order·from·least·recently·used·to·most·recently·used.\n···*/\n··*rentries()·{\n····for·(const·i·of·this.#rindexes())·{\n······if·(\n········this.#valList[i]·!==·undefined·&&\n········this.#keyList[i]·!==·undefined·&&\n········!this.#isBackgroundFetch(this.#valList[i])\n······)·{\n········yield·[this.#keyList[i],·this.#valList[i]]\n······}\n····}\n··}\n\n··/**\n···*·Return·a·generator·yielding·the·keys·in·the·cache,\n···*·in·order·from·most·recently·used·to·least·recently·used.\n···*/\n··*keys()·{\n····for·(const·i·of·this.#indexes())·{\n······const·k·=·this.#keyList[i]\n······if·(k·!==·undefined·&&·!this.#isBackgroundFetch(this.#valList[i]))·{\n········yield·k\n······}\n····}\n··}\n\n··/**\n···*·Inverse·order·version·of·{@link·LRUCache.keys}\n···*\n···*·Return·a·generator·yielding·the·keys·in·the·cache,\n···*·in·order·from·least·recently·used·to·most·recently·used.\n···*/\n··*rkeys()·{\n····for·(const·i·of·this.#rindexes())·{\n······const·k·=·this.#keyList[i]\n······if·(k·!==·undefined·&&·!this.#isBackgroundFetch(this.#valList[i]))·{\n········yield·k\n······}\n····}\n··}\n\n··/**\n···*·Return·a·generator·yielding·the·values·in·the·cache,\n···*·in·order·from·most·recently·used·to·least·recently·used.\n···*/\n··*values()·{\n····for·(const·i·of·this.#indexes())·{\n······const·v·=·this.#valList[i]\n······if·(v·!==·undefined·&&·!this.#isBackgroundFetch(this.#valList[i]))·{\n········yield·this.#valList[i]·as·V\n······}\n····}\n··}\n\n··/**\n···*·Inverse·order·version·of·{@link·LRUCache.values}\n···*\n···*·Return·a·generator·yielding·the·values·in·the·cache,\n···*·in·order·from·least·recently·used·to·most·recently·used.\n···*/\n··*rvalues()·{\n····for·(const·i·of·this.#rindexes())·{\n······const·v·=·this.#valList[i]\n······if·(v·!==·undefined·&&·!this.#isBackgroundFetch(this.#valList[i]))·{\n········yield·this.#valList[i]\n······}\n····}\n··}\n\n··/**\n···*·Iterating·over·the·cache·itself·yields·the·same·results·as\n···*·{@link·LRUCache.entries}\n···*/\n··[Symbol.iterator]()·{\n····return·this.entries()\n··}\n\n··/**\n···*·A·String·value·that·is·used·in·the·creation·of·the·default·string\n···*·description·of·an·object.·Called·by·the·built-in·method\n···*·`Object.prototype.toString`.\n···*/\n··[Symbol.toStringTag]·=·'LRUCache'\n\n··/**\n···*·Find·a·value·for·which·the·supplied·fn·method·returns·a·truthy·value,\n···*·similar·to·`Array.find()`.·fn·is·called·as·`fn(value,·key,·cache)`.\n···*/\n··find(\n····fn:·(v:·V,·k:·K,·self:·LRUCache<K,·V,·FC>)·=>·boolean,\n····getOptions:·LRUCache.GetOptions<K,·V,·FC>·=·{},\n··)·{\n····for·(const·i·of·this.#indexes())·{\n······const·v·=·this.#valList[i]\n······const·value·=·this.#isBackgroundFetch(v)·?·v.__staleWhileFetching·:·v\n······if·(value·===·undefined)·continue\n······if·(fn(value,·this.#keyList[i]·as·K,·this))·{\n········return·this.#get(this.#keyList[i]·as·K,·getOptions)\n······}\n····}\n··}\n\n··/**\n···*·Call·the·supplied·function·on·each·item·in·the·cache,·in·order·from·most\n···*·recently·used·to·least·recently·used.\n···*\n···*·`fn`·is·called·as·`fn(value,·key,·cache)`.\n···*\n···*·If·`thisp`·is·provided,·function·will·be·called·in·the·`this`-context·of\n···*·the·provided·object,·or·the·cache·if·no·`thisp`·object·is·provided.\n···*\n···*·Does·not·update·age·or·recenty·of·use,·or·iterate·over·stale·values.\n···*/\n··forEach(\n····fn:·(v:·V,·k:·K,·self:·LRUCache<K,·V,·FC>)·=>·unknown,\n····thisp:·unknown·=·this,\n··)·{\n····for·(const·i·of·this.#indexes())·{\n······const·v·=·this.#valList[i]\n······const·value·=·this.#isBackgroundFetch(v)·?·v.__staleWhileFetching·:·v\n······if·(value·===·undefined)·continue\n······fn.call(thisp,·value,·this.#keyList[i]·as·K,·this)\n····}\n··}\n\n··/**\n···*·The·same·as·{@link·LRUCache.forEach}·but·items·are·iterated·over·in\n···*·reverse·order.··(ie,·less·recently·used·items·are·iterated·over·first.)\n···*/\n··rforEach(\n····fn:·(v:·V,·k:·K,·self:·LRUCache<K,·V,·FC>)·=>·unknown,\n····thisp:·unknown·=·this,\n··)·{\n····for·(const·i·of·this.#rindexes())·{\n······const·v·=·this.#valList[i]\n······const·value·=·this.#isBackgroundFetch(v)·?·v.__staleWhileFetching·:·v\n······if·(value·===·undefined)·continue\n······fn.call(thisp,·value,·this.#keyList[i]·as·K,·this)\n····}\n··}\n\n··/**\n···*·Delete·any·stale·entries.·Returns·true·if·anything·was·removed,\n···*·false·otherwise.\n···*/\n··purgeStale()·{\n····let·deleted·=·false\n····for·(const·i·of·this.#rindexes({·allowStale:·true·}))·{\n······if·(this.#isStale(i))·{\n········this.#delete(this.#keyList[i]·as·K,·'expire')\n········deleted·=·true\n······}\n····}\n····return·deleted\n··}\n\n··/**\n···*·Get·the·extended·info·about·a·given·entry,·to·get·its·value,·size,·and\n···*·TTL·info·simultaneously.·Returns·`undefined`·if·the·key·is·not·present.\n···*\n···*·Unlike·{@link·LRUCache#dump},·which·is·designed·to·be·portable·and·survive\n···*·serialization,·the·`start`·value·is·always·the·current·timestamp,·and·the\n···*·`ttl`·is·a·calculated·remaining·time·to·live·(negative·if·expired).\n···*\n···*·Always·returns·stale·values,·if·their·info·is·found·in·the·cache,·so·be\n···*·sure·to·check·for·expirations·(ie,·a·negative·{@link·LRUCache.Entry#ttl})\n···*·if·relevant.\n···*/\n··info(key:·K):·LRUCache.Entry<V>·|·undefined·{\n····const·i·=·this.#keyMap.get(key)\n····if·(i·===·undefined)·return·undefined\n····const·v·=·this.#valList[i]\n····/*·c8·ignore·start·-·this·isn't·tested·for·the·info·function,\n·····*·but·it's·the·same·logic·as·found·in·other·places.·*/\n····const·value:·V·|·undefined·=\n······this.#isBackgroundFetch(v)·?·v.__staleWhileFetching·:·v\n····if·(value·===·undefined)·return·undefined\n····/*·c8·ignore·stop·*/\n····const·entry:·LRUCache.Entry<V>·=·{·value·}\n····if·(this.#ttls·&&·this.#starts)·{\n······const·ttl·=·this.#ttls[i]\n······const·start·=·this.#starts[i]\n······if·(ttl·&&·start)·{\n········const·remain·=·ttl·-·(this.#perf.now()·-·start)\n········entry.ttl·=·remain\n········entry.start·=·Date.now()\n······}\n····}\n····if·(this.#sizes)·{\n······entry.size·=·this.#sizes[i]\n····}\n····return·entry\n··}\n\n··/**\n···*·Return·an·array·of·[key,·{@link·LRUCache.Entry}]·tuples·which·can·be\n···*·passed·to·{@link·LRUCache#load}.\n···*\n···*·The·`start`·fields·are·calculated·relative·to·a·portable·`Date.now()`\n···*·timestamp,·even·if·`performance.now()`·is·available.\n···*\n···*·Stale·entries·are·always·included·in·the·`dump`,·even·if\n···*·{@link·LRUCache.OptionsBase.allowStale}·is·false.\n···*\n···*·Note:·this·returns·an·actual·array,·not·a·generator,·so·it·can·be·more\n···*·easily·passed·around.\n···*/\n··dump()·{\n····const·arr:·[K,·LRUCache.Entry<V>][]·=·[]\n····for·(const·i·of·this.#indexes({·allowStale:·true·}))·{\n······const·key·=·this.#keyList[i]\n······const·v·=·this.#valList[i]\n······const·value:·V·|·undefined·=\n········this.#isBackgroundFetch(v)·?·v.__staleWhileFetching·:·v\n······if·(value·===·undefined·||·key·===·undefined)·continue\n······const·entry:·LRUCache.Entry<V>·=·{·value·}\n······if·(this.#ttls·&&·this.#starts)·{\n········entry.ttl·=·this.#ttls[i]\n········//·always·dump·the·start·relative·to·a·portable·timestamp\n········//·it's·ok·for·this·to·be·a·bit·slow,·it's·a·rare·operation.\n········const·age·=·this.#perf.now()·-·(this.#starts[i]·as·number)\n········entry.start·=·Math.floor(Date.now()·-·age)\n······}\n······if·(this.#sizes)·{\n········entry.size·=·this.#sizes[i]\n······}\n······arr.unshift([key,·entry])\n····}\n····return·arr\n··}\n\n··/**\n···*·Reset·the·cache·and·load·in·the·items·in·entries·in·the·order·listed.\n···*\n···*·The·shape·of·the·resulting·cache·may·be·different·if·the·same·options·are\n···*·not·used·in·both·caches.\n···*\n···*·The·`start`·fields·are·assumed·to·be·calculated·relative·to·a·portable\n···*·`Date.now()`·timestamp,·even·if·`performance.now()`·is·available.\n···*/\n··load(arr:·[K,·LRUCache.Entry<V>][])·{\n····this.clear()\n····for·(const·[key,·entry]·of·arr)·{\n······if·(entry.start)·{\n········//·entry.start·is·a·portable·timestamp,·but·we·may·be·using\n········//·node's·performance.now(),·so·calculate·the·offset,·so·that\n········//·we·get·the·intended·remaining·TTL,·no·matter·how·long·it's\n········//·been·on·ice.\n········//\n········//·it's·ok·for·this·to·be·a·bit·slow,·it's·a·rare·operation.\n········const·age·=·Date.now()·-·entry.start\n········entry.start·=·this.#perf.now()·-·age\n······}\n······this.#set(key,·entry.value,·entry)\n····}\n··}\n\n··/**\n···*·Add·a·value·to·the·cache.\n···*\n···*·Note:·if·`undefined`·is·specified·as·a·value,·this·is·an·alias·for\n···*·{@link·LRUCache#delete}\n···*\n···*·Fields·on·the·{@link·LRUCache.SetOptions}·options·param·will·override\n···*·their·corresponding·values·in·the·constructor·options·for·the·scope\n···*·of·this·single·`set()`·operation.\n···*\n···*·If·`start`·is·provided,·then·that·will·set·the·effective·start\n···*·time·for·the·TTL·calculation.·Note·that·this·must·be·a·previous\n···*·value·of·`performance.now()`·if·supported,·or·a·previous·value·of\n···*·`Date.now()`·if·not.\n···*\n···*·Options·object·may·also·include·`size`,·which·will·prevent\n···*·calling·the·`sizeCalculation`·function·and·just·use·the·specified\n···*·number·if·it·is·a·positive·integer,·and·`noDisposeOnSet`·which\n···*·will·prevent·calling·a·`dispose`·function·in·the·case·of\n···*·overwrites.\n···*\n···*·If·the·`size`·(or·return·value·of·`sizeCalculation`)·for·a·given\n···*·entry·is·greater·than·`maxEntrySize`,·then·the·item·will·not·be\n···*·added·to·the·cache.\n···*\n···*·Will·update·the·recency·of·the·entry.\n···*\n···*·If·the·value·is·`undefined`,·then·this·is·an·alias·for\n···*·`cache.delete(key)`.·`undefined`·is·never·stored·in·the·cache.\n···*/\n··set(\n····k:·K,\n····v:·V·|·undefined,\n····setOptions:·LRUCache.SetOptions<K,·V,·FC>·=·{},\n··)·{\n····const·{·status·=·metrics.hasSubscribers·?·{}·:·undefined·}·=·setOptions\n····setOptions.status·=·status\n····if·(status)·{\n······status.op·=·'set'\n······status.key·=·k\n······if·(v·!==·undefined)·status.value·=·v\n····}\n····const·result·=·this.#set(k,·v,·setOptions)\n····if·(status·&&·metrics.hasSubscribers)·{\n······metrics.publish(status)\n····}\n····return·result\n··}\n\n··#set(\n····k:·K,\n····v:·V·|·BackgroundFetch<V>·|·undefined,\n····setOptions:·LRUCache.SetOptions<K,·V,·FC>·=·{},\n··)·{\n····const·{\n······ttl·=·this.ttl,\n······start,\n······noDisposeOnSet·=·this.noDisposeOnSet,\n······sizeCalculation·=·this.sizeCalculation,\n······status,\n····}·=·setOptions\n\n····if·(v·===·undefined)·{\n······if·(status)·status.set·=·'deleted'\n······this.delete(k)\n······return·this\n····}\n····let·{·noUpdateTTL·=·this.noUpdateTTL·}·=·setOptions\n\n····if·(status·&&·!this.#isBackgroundFetch(v))·status.value·=·v\n\n····const·size·=·this.#requireSize(\n······k,\n······v,\n······setOptions.size·||·0,\n······sizeCalculation,\n······status,\n····)\n····//·if·the·item·doesn't·fit,·don't·do·anything\n····//·NB:·maxEntrySize·set·to·maxSize·by·default\n····if·(this.maxEntrySize·&&·size·>·this.maxEntrySize)·{\n······//·have·to·delete,·in·case·something·is·there·already.\n······this.#delete(k,·'set')\n······if·(status)·{\n········status.set·=·'miss'\n········status.maxEntrySizeExceeded·=·true\n······}\n······return·this\n····}\n····let·index·=·this.#size·===·0·?·undefined·:·this.#keyMap.get(k)\n····if·(index·===·undefined)·{\n······//·addition\n······index·=·(\n········this.#size·===·0·?·this.#tail\n········:·this.#free.length·!==·0·?·this.#free.pop()\n········:·this.#size·===·this.#max·?·this.#evict(false)\n········:·this.#size)·as·Index\n······this.#keyList[index]·=·k\n······this.#valList[index]·=·v\n······this.#keyMap.set(k,·index)\n······this.#next[this.#tail]·=·index\n······this.#prev[index]·=·this.#tail\n······this.#tail·=·index\n······this.#size++\n······this.#addItemSize(index,·size,·status)\n······if·(status)·status.set·=·'add'\n······noUpdateTTL·=·false\n······if·(this.#hasOnInsert)·{\n········this.#onInsert?.(v·as·V,·k,·'add')\n······}\n····}·else·{\n······//·update\n······this.#moveToTail(index)\n······const·oldVal·=·this.#valList[index]·as·V·|·BackgroundFetch<V>\n······if·(v·!==·oldVal)·{\n········if·(this.#hasFetchMethod·&&·this.#isBackgroundFetch(oldVal))·{\n··········oldVal.__abortController.abort(new·Error('replaced'))\n··········const·{·__staleWhileFetching:·s·}·=·oldVal\n··········if·(s·!==·undefined·&&·!noDisposeOnSet)·{\n············if·(this.#hasDispose)·{\n··············this.#dispose?.(s·as·V,·k,·'set')\n············}\n············if·(this.#hasDisposeAfter)·{\n··············this.#disposed?.push([s·as·V,·k,·'set'])\n············}\n··········}\n········}·else·if·(!noDisposeOnSet)·{\n··········if·(this.#hasDispose)·{\n············this.#dispose?.(oldVal·as·V,·k,·'set')\n··········}\n··········if·(this.#hasDisposeAfter)·{\n············this.#disposed?.push([oldVal·as·V,·k,·'set'])\n··········}\n········}\n········this.#removeItemSize(index)\n········this.#addItemSize(index,·size,·status)\n········this.#valList[index]·=·v\n········if·(status)·{\n··········status.set·=·'replace'\n··········const·oldValue·=\n············oldVal·&&·this.#isBackgroundFetch(oldVal)·?\n··············oldVal.__staleWhileFetching\n············:·oldVal\n··········if·(oldValue·!==·undefined)·status.oldValue·=·oldValue\n········}\n······}·else·if·(status)·{\n········status.set·=·'update'\n······}\n\n······if·(this.#hasOnInsert)·{\n········this.onInsert?.(v·as·V,·k,·v·===·oldVal·?·'update'·:·'replace')\n······}\n····}\n····if·(ttl·!==·0·&&·!this.#ttls)·{\n······this.#initializeTTLTracking()\n····}\n····if·(this.#ttls)·{\n······if·(!noUpdateTTL)·{\n········this.#setItemTTL(index,·ttl,·start)\n······}\n······if·(status)·this.#statusTTL(status,·index)\n····}\n····if·(!noDisposeOnSet·&&·this.#hasDisposeAfter·&&·this.#disposed)·{\n······const·dt·=·this.#disposed\n······let·task:·DisposeTask<K,·V>·|·undefined\n······while·((task·=·dt?.shift()))·{\n········this.#disposeAfter?.(...task)\n······}\n····}\n····return·this\n··}\n\n··/**\n···*·Evict·the·least·recently·used·item,·returning·its·value·or\n···*·`undefined`·if·cache·is·empty.\n···*/\n··pop():·V·|·undefined·{\n····try·{\n······while·(this.#size)·{\n········const·val·=·this.#valList[this.#head]\n········this.#evict(true)\n········if·(this.#isBackgroundFetch(val))·{\n··········if·(val.__staleWhileFetching)·{\n············return·val.__staleWhileFetching\n··········}\n········}·else·if·(val·!==·undefined)·{\n··········return·val\n········}\n······}\n····}·finally·{\n······if·(this.#hasDisposeAfter·&&·this.#disposed)·{\n········const·dt·=·this.#disposed\n········let·task:·DisposeTask<K,·V>·|·undefined\n········while·((task·=·dt?.shift()))·{\n··········this.#disposeAfter?.(...task)\n········}\n······}\n····}\n··}\n\n··#evict(free:·boolean)·{\n····const·head·=·this.#head\n····const·k·=·this.#keyList[head]·as·K\n····const·v·=·this.#valList[head]·as·V\n····if·(this.#hasFetchMethod·&&·this.#isBackgroundFetch(v))·{\n······v.__abortController.abort(new·Error('evicted'))\n····}·else·if·(this.#hasDispose·||·this.#hasDisposeAfter)·{\n······if·(this.#hasDispose)·{\n········this.#dispose?.(v,·k,·'evict')\n······}\n······if·(this.#hasDisposeAfter)·{\n········this.#disposed?.push([v,·k,·'evict'])\n······}\n····}\n····this.#removeItemSize(head)\n····if·(this.#autopurgeTimers?.[head])·{\n······clearTimeout(this.#autopurgeTimers[head])\n······this.#autopurgeTimers[head]·=·undefined\n····}\n····//·if·we·aren't·about·to·use·the·index,·then·null·these·out\n····if·(free)·{\n······this.#keyList[head]·=·undefined\n······this.#valList[head]·=·undefined\n······this.#free.push(head)\n····}\n····if·(this.#size·===·1)·{\n······this.#head·=·this.#tail·=·0·as·Index\n······this.#free.length·=·0\n····}·else·{\n······this.#head·=·this.#next[head]·as·Index\n····}\n····this.#keyMap.delete(k)\n····this.#size--\n····return·head\n··}\n\n··/**\n···*·Check·if·a·key·is·in·the·cache,·without·updating·the·recency·of·use.\n···*·Will·return·false·if·the·item·is·stale,·even·though·it·is·technically\n···*·in·the·cache.\n···*\n···*·Check·if·a·key·is·in·the·cache,·without·updating·the·recency·of\n···*·use.·Age·is·updated·if·{@link·LRUCache.OptionsBase.updateAgeOnHas}·is·set\n···*·to·`true`·in·either·the·options·or·the·constructor.\n···*\n···*·Will·return·`false`·if·the·item·is·stale,·even·though·it·is·technically·in\n···*·the·cache.·The·difference·can·be·determined·(if·it·matters)·by·using·a\n···*·`status`·argument,·and·inspecting·the·`has`·field.\n···*\n···*·Will·not·update·item·age·unless\n···*·{@link·LRUCache.OptionsBase.updateAgeOnHas}·is·set.\n···*/\n··has(k:·K,·hasOptions:·LRUCache.HasOptions<K,·V,·FC>·=·{})·{\n····const·{·status·=·metrics.hasSubscribers·?·{}·:·undefined·}·=·hasOptions\n····hasOptions.status·=·status\n····if·(status)·{\n······status.op·=·'has'\n······status.key·=·k\n····}\n····const·result·=·this.#has(k,·hasOptions)\n····if·(metrics.hasSubscribers)·metrics.publish(status)\n····return·result\n··}\n··#has(k:·K,·hasOptions:·LRUCache.HasOptions<K,·V,·FC>·=·{})·{\n····const·{·updateAgeOnHas·=·this.updateAgeOnHas,·status·}·=·hasOptions\n····const·index·=·this.#keyMap.get(k)\n····if·(index·!==·undefined)·{\n······const·v·=·this.#valList[index]\n······if·(\n········this.#isBackgroundFetch(v)·&&\n········v.__staleWhileFetching·===·undefined\n······)·{\n········return·false\n······}\n······if·(!this.#isStale(index))·{\n········if·(updateAgeOnHas)·{\n··········this.#updateItemAge(index)\n········}\n········if·(status)·{\n··········status.has·=·'hit'\n··········this.#statusTTL(status,·index)\n········}\n········return·true\n······}·else·if·(status)·{\n········status.has·=·'stale'\n········this.#statusTTL(status,·index)\n······}\n····}·else·if·(status)·{\n······status.has·=·'miss'\n····}\n····return·false\n··}\n\n··/**\n···*·Like·{@link·LRUCache#get}·but·doesn't·update·recency·or·delete·stale\n···*·items.\n···*\n···*·Returns·`undefined`·if·the·item·is·stale,·unless\n···*·{@link·LRUCache.OptionsBase.allowStale}·is·set.\n···*/\n··peek(k:·K,·peekOptions:·LRUCache.PeekOptions<K,·V,·FC>·=·{})·{\n····const·{·status·=·hasSubscribers()·?·{}·:·undefined·}·=·peekOptions\n····if·(status)·{\n······status.op·=·'peek'\n······status.key·=·k\n····}\n····peekOptions.status·=·status\n····const·result·=·this.#peek(k,·peekOptions)\n····if·(metrics.hasSubscribers)·{\n······metrics.publish(status)\n····}\n····return·result\n··}\n··#peek(k:·K,·peekOptions:·LRUCache.PeekOptions<K,·V,·FC>)·{\n····const·{·status,·allowStale·=·this.allowStale·}·=·peekOptions\n····const·index·=·this.#keyMap.get(k)\n····if·(index·===·undefined·||·(!allowStale·&&·this.#isStale(index)))·{\n······if·(status)·status.peek·=·index·===·undefined·?·'miss'·:·'stale'\n······return·undefined\n····}\n····const·v·=·this.#valList[index]\n····const·val·=·this.#isBackgroundFetch(v)·?·v.__staleWhileFetching·:·v\n····if·(status)·{\n······if·(val·!==·undefined)·{\n········status.peek·=·'hit'\n········status.value·=·val\n······}·else·{\n········status.peek·=·'miss'\n······}\n····}\n····return·val\n··}\n\n··#backgroundFetch(\n····k:·K,\n····index:·Index·|·undefined,\n····options:·LRUCache.FetchOptions<K,·V,·FC>,\n····context:·FC,\n··):·BackgroundFetch<V>·{\n····const·v·=·index·===·undefined·?·undefined·:·this.#valList[index]\n····if·(this.#isBackgroundFetch(v))·{\n······return·v\n····}\n\n····const·ac·=·new·AbortController()\n····const·{·signal·}·=·options\n····//·when/if·our·AC·signals,·then·stop·listening·to·theirs.\n····signal?.addEventListener('abort',·()·=>·ac.abort(signal.reason),·{\n······signal:·ac.signal,\n····})\n\n····const·fetchOpts·=·{\n······signal:·ac.signal,\n······options,\n······context,\n····}\n\n····const·cb·=·(v:·V·|·undefined,·updateCache·=·false):·V·|·undefined·=>·{\n······const·{·aborted·}·=·ac.signal\n······const·ignoreAbort·=·options.ignoreFetchAbort·&&·v·!==·undefined\n······const·proceed·=\n········options.ignoreFetchAbort·||\n········!!(options.allowStaleOnFetchAbort·&&·v·!==·undefined)\n······if·(options.status)·{\n········if·(aborted·&&·!updateCache)·{\n··········options.status.fetchAborted·=·true\n··········options.status.fetchError·=·ac.signal.reason\n··········if·(ignoreAbort)·options.status.fetchAbortIgnored·=·true\n········}·else·{\n··········options.status.fetchResolved·=·true\n········}\n······}\n······if·(aborted·&&·!ignoreAbort·&&·!updateCache)·{\n········return·fetchFail(ac.signal.reason,·proceed)\n······}\n······//·either·we·didn't·abort,·and·are·still·here,·or·we·did,·and·ignored\n······const·bf·=·p·as·BackgroundFetch<V>\n······//·if·nothing·else·has·been·written·there·but·we're·set·to·update·the\n······//·cache·and·ignore·the·abort,·or·if·it's·still·pending·on·this·specific\n······//·background·request,·then·write·it·to·the·cache.\n······const·vl·=·this.#valList[index·as·Index]\n······if·(vl·===·p·||·(vl·===·undefined·&&·ignoreAbort·&&·updateCache))·{\n········if·(v·===·undefined)·{\n··········if·(bf.__staleWhileFetching·!==·undefined)·{\n············this.#valList[index·as·Index]·=·bf.__staleWhileFetching\n··········}·else·{\n············this.#delete(k,·'fetch')\n··········}\n········}·else·{\n··········if·(options.status)·options.status.fetchUpdated·=·true\n··········this.#set(k,·v,·fetchOpts.options)\n········}\n······}\n······return·v\n····}\n\n····const·eb·=·(er:·unknown)·=>·{\n······if·(options.status)·{\n········options.status.fetchRejected·=·true\n········options.status.fetchError·=·er·as·Error\n······}\n······//·do·not·pass·go,·do·not·collect·$200\n······return·fetchFail(er,·false)\n····}\n\n····const·fetchFail·=·(er:·unknown,·proceed:·boolean):·V·|·undefined·=>·{\n······const·{·aborted·}·=·ac.signal\n······const·allowStaleAborted·=·aborted·&&·options.allowStaleOnFetchAbort\n······const·allowStale·=\n········allowStaleAborted·||·options.allowStaleOnFetchRejection\n······const·noDelete·=·allowStale·||·options.noDeleteOnFetchRejection\n······const·bf·=·p·as·BackgroundFetch<V>\n······if·(this.#valList[index·as·Index]·===·p)·{\n········//·if·we·allow·stale·on·fetch·rejections,·then·we·need·to·ensure·that\n········//·the·stale·value·is·not·removed·from·the·cache·when·the·fetch·fails.\n········const·del·=\n··········!noDelete·||·(!proceed·&&·bf.__staleWhileFetching·===·undefined)\n········if·(del)·{\n··········this.#delete(k,·'fetch')\n········}·else·if·(!allowStaleAborted)·{\n··········//·still·replace·the·*promise*·with·the·stale·value,\n··········//·since·we·are·done·with·the·promise·at·this·point.\n··········//·leave·it·untouched·if·we're·still·waiting·for·an\n··········//·aborted·background·fetch·that·hasn't·yet·returned.\n··········this.#valList[index·as·Index]·=·bf.__staleWhileFetching\n········}\n······}\n······if·(allowStale)·{\n········if·(options.status·&&·bf.__staleWhileFetching·!==·undefined)·{\n··········options.status.returnedStale·=·true\n········}\n········return·bf.__staleWhileFetching\n······}·else·if·(bf.__returned·===·bf)·{\n········throw·er\n······}\n····}\n\n····const·pcall·=·(\n······res:·(v:·V·|·undefined)·=>·void,\n······rej:·(e:·unknown)·=>·void,\n····)·=>·{\n······const·fmp·=·this.#fetchMethod?.(k,·v,·fetchOpts)\n······if·(fmp·&&·fmp·instanceof·Promise)·{\n········fmp.then(v·=>·res(v·===·undefined·?·undefined·:·v),·rej)\n······}\n······//·ignored,·we·go·until·we·finish,·regardless.\n······//·defer·check·until·we·are·actually·aborting,\n······//·so·fetchMethod·can·override.\n······ac.signal.addEventListener('abort',·()·=>·{\n········if·(!options.ignoreFetchAbort·||·options.allowStaleOnFetchAbort)·{\n··········res(undefined)\n··········//·when·it·eventually·resolves,·update·the·cache.\n··········if·(options.allowStaleOnFetchAbort)·{\n············res·=·v·=>·cb(v,·true)\n··········}\n········}\n······})\n····}\n\n····if·(options.status)·options.status.fetchDispatched·=·true\n····const·p·=·new·Promise(pcall).then(cb,·eb)\n····const·bf:·BackgroundFetch<V>·=·Object.assign(p,·{\n······__abortController:·ac,\n······__staleWhileFetching:·v,\n······__returned:·undefined,\n····})\n\n····if·(index·===·undefined)·{\n······//·internal,·don't·expose·status.\n······this.#set(k,·bf,·{·...fetchOpts.options,·status:·undefined·})\n······index·=·this.#keyMap.get(k)\n····}·else·{\n······this.#valList[index]·=·bf\n····}\n····return·bf\n··}\n\n··#isBackgroundFetch(p:·unknown):·p·is·BackgroundFetch<V>·{\n····if·(!this.#hasFetchMethod)·return·false\n····const·b·=·p·as·BackgroundFetch<V>\n····return·(\n······!!b·&&\n······b·instanceof·Promise·&&\n······b.hasOwnProperty('__staleWhileFetching')·&&\n······b.__abortController·instanceof·AbortController\n····)\n··}\n\n··/**\n···*·Make·an·asynchronous·cached·fetch·using·the\n···*·{@link·LRUCache.OptionsBase.fetchMethod}·function.\n···*\n···*·If·the·value·is·in·the·cache·and·not·stale,·then·the·returned\n···*·Promise·resolves·to·the·value.\n···*\n···*·If·not·in·the·cache,·or·beyond·its·TTL·staleness,·then\n···*·`fetchMethod(key,·staleValue,·{·options,·signal,·context·})`·is\n···*·called,·and·the·value·returned·will·be·added·to·the·cache·once\n···*·resolved.\n···*\n···*·If·called·with·`allowStale`,·and·an·asynchronous·fetch·is\n···*·currently·in·progress·to·reload·a·stale·value,·then·the·former\n···*·stale·value·will·be·returned.\n···*\n···*·If·called·with·`forceRefresh`,·then·the·cached·item·will·be\n···*·re-fetched,·even·if·it·is·not·stale.·However,·if·`allowStale`·is·also\n···*·set,·then·the·old·value·will·still·be·returned.·This·is·useful\n···*·in·cases·where·you·want·to·force·a·reload·of·a·cached·value.·If\n···*·a·background·fetch·is·already·in·progress,·then·`forceRefresh`\n···*·has·no·effect.\n···*\n···*·If·multiple·fetches·for·the·same·key·are·issued,·then·they·will·all·be\n···*·coalesced·into·a·single·call·to·fetchMethod.\n···*\n···*·Note·that·this·means·that·handling·options·such·as\n···*·{@link·LRUCache.OptionsBase.allowStaleOnFetchAbort},\n···*·{@link·LRUCache.FetchOptions.signal},\n···*·and·{@link·LRUCache.OptionsBase.allowStaleOnFetchRejection}·will·be\n···*·determined·by·the·FIRST·fetch()·call·for·a·given·key.\n···*\n···*·This·is·a·known·(fixable)·shortcoming·which·will·be·addresed·on·when\n···*·someone·complains·about·it,·as·the·fix·would·involve·added·complexity·and\n···*·may·not·be·worth·the·costs·for·this·edge·case.\n···*\n···*·If·{@link·LRUCache.OptionsBase.fetchMethod}·is·not·specified,·then·this·is\n···*·effectively·an·alias·for·`Promise.resolve(cache.get(key))`.\n···*\n···*·When·the·fetch·method·resolves·to·a·value,·if·the·fetch·has·not\n···*·been·aborted·due·to·deletion,·eviction,·or·being·overwritten,\n···*·then·it·is·added·to·the·cache·using·the·options·provided.\n···*\n···*·If·the·key·is·evicted·or·deleted·before·the·`fetchMethod`\n···*·resolves,·then·the·AbortSignal·passed·to·the·`fetchMethod`·will\n···*·receive·an·`abort`·event,·and·the·promise·returned·by·`fetch()`\n···*·will·reject·with·the·reason·for·the·abort.\n···*\n···*·If·a·`signal`·is·passed·to·the·`fetch()`·call,·then·aborting·the\n···*·signal·will·abort·the·fetch·and·cause·the·`fetch()`·promise·to\n···*·reject·with·the·reason·provided.\n···*\n···*·**Setting·`context`**\n···*\n···*·If·an·`FC`·type·is·set·to·a·type·other·than·`unknown`,·`void`,·or\n···*·`undefined`·in·the·{@link·LRUCache}·constructor,·then·all\n···*·calls·to·`cache.fetch()`·_must_·provide·a·`context`·option.·If\n···*·set·to·`undefined`·or·`void`,·then·calls·to·fetch·_must·not_\n···*·provide·a·`context`·option.\n···*\n···*·The·`context`·param·allows·you·to·provide·arbitrary·data·that\n···*·might·be·relevant·in·the·course·of·fetching·the·data.·It·is·only\n···*·relevant·for·the·course·of·a·single·`fetch()`·operation,·and\n···*·discarded·afterwards.\n···*\n···*·**Note:·`fetch()`·calls·are·inflight-unique**\n···*\n···*·If·you·call·`fetch()`·multiple·times·with·the·same·key·value,\n···*·then·every·call·after·the·first·will·resolve·on·the·same\n···*·promise<sup>1</sup>,\n···*·_even·if·they·have·different·settings·that·would·otherwise·change\n···*·the·behavior·of·the·fetch_,·such·as·`noDeleteOnFetchRejection`\n···*·or·`ignoreFetchAbort`.\n···*\n···*·In·most·cases,·this·is·not·a·problem·(in·fact,·only·fetching\n···*·something·once·is·what·you·probably·want,·if·you're·caching·in\n···*·the·first·place).·If·you·are·changing·the·fetch()·options\n···*·dramatically·between·runs,·there's·a·good·chance·that·you·might\n···*·be·trying·to·fit·divergent·semantics·into·a·single·object,·and\n···*·would·be·better·off·with·multiple·cache·instances.\n···*\n···*·**1**:·Ie,·they're·not·the·\"same·Promise\",·but·they·resolve·at\n···*·the·same·time,·because·they're·both·waiting·on·the·same\n···*·underlying·fetchMethod·response.\n···*/\n\n··fetch(\n····k:·K,\n····fetchOptions:·unknown·extends·FC·?·LRUCache.FetchOptions<K,·V,·FC>\n····:·FC·extends·undefined·|·void·?·LRUCache.FetchOptionsNoContext<K,·V>\n····:·LRUCache.FetchOptionsWithContext<K,·V,·FC>,\n··):·Promise<undefined·|·V>\n\n··//·this·overload·not·allowed·if·context·is·required\n··fetch(\n····k:·unknown·extends·FC·?·K\n····:·FC·extends·undefined·|·void·?·K\n····:·never,\n····fetchOptions?:·unknown·extends·FC·?·LRUCache.FetchOptions<K,·V,·FC>\n····:·FC·extends·undefined·|·void·?·LRUCache.FetchOptionsNoContext<K,·V>\n····:·never,\n··):·Promise<undefined·|·V>\n··fetch(\n····k:·K,\n····fetchOptions:·LRUCache.FetchOptions<K,·V,·FC>·=·{},\n··):·Promise<undefined·|·V>·{\n····const·ths·=·tracing.hasSubscribers\n····const·{·status·=·hasSubscribers()·?·{}·:·undefined·}·=·fetchOptions\n····fetchOptions.status·=·status\n····if·(status·&&·fetchOptions.context)·{\n······status.context·=·fetchOptions.context\n····}\n····const·p·=·this.#fetch(k,·fetchOptions)\n····if·(status·&&·hasSubscribers())·{\n······if·(ths)·{\n········status.trace·=·true\n········tracing.tracePromise(()·=>·p,·status).catch(()·=>·{})\n······}\n····}\n····return·p\n··}\n\n··async·#fetch(\n····k:·K,\n····fetchOptions:·LRUCache.FetchOptions<K,·V,·FC>·=·{},\n··):·Promise<undefined·|·V>·{\n····const·{\n······//·get·options\n······allowStale·=·this.allowStale,\n······updateAgeOnGet·=·this.updateAgeOnGet,\n······noDeleteOnStaleGet·=·this.noDeleteOnStaleGet,\n······//·set·options\n······ttl·=·this.ttl,\n······noDisposeOnSet·=·this.noDisposeOnSet,\n······size·=·0,\n······sizeCalculation·=·this.sizeCalculation,\n······noUpdateTTL·=·this.noUpdateTTL,\n······//·fetch·exclusive·options\n······noDeleteOnFetchRejection·=·this.noDeleteOnFetchRejection,\n······allowStaleOnFetchRejection·=·this.allowStaleOnFetchRejection,\n······ignoreFetchAbort·=·this.ignoreFetchAbort,\n······allowStaleOnFetchAbort·=·this.allowStaleOnFetchAbort,\n······context,\n······forceRefresh·=·false,\n······status,\n······signal,\n····}·=·fetchOptions\n····if·(status)·{\n······status.op·=·'fetch'\n······status.key·=·k\n······if·(forceRefresh)·status.forceRefresh·=·true\n····}\n\n····if·(!this.#hasFetchMethod)·{\n······if·(status)·status.fetch·=·'get'\n······return·this.#get(k,·{\n········allowStale,\n········updateAgeOnGet,\n········noDeleteOnStaleGet,\n········status,\n······})\n····}\n\n····const·options·=·{\n······allowStale,\n······updateAgeOnGet,\n······noDeleteOnStaleGet,\n······ttl,\n······noDisposeOnSet,\n······size,\n······sizeCalculation,\n······noUpdateTTL,\n······noDeleteOnFetchRejection,\n······allowStaleOnFetchRejection,\n······allowStaleOnFetchAbort,\n······ignoreFetchAbort,\n······status,\n······signal,\n····}\n\n····let·index·=·this.#keyMap.get(k)\n····if·(index·===·undefined)·{\n······if·(status)·status.fetch·=·'miss'\n······const·p·=·this.#backgroundFetch(k,·index,·options,·context·as·FC)\n······return·(p.__returned·=·p)\n····}·else·{\n······//·in·cache,·maybe·already·fetching\n······const·v·=·this.#valList[index]\n······if·(this.#isBackgroundFetch(v))·{\n········const·stale·=·allowStale·&&·v.__staleWhileFetching·!==·undefined\n········if·(status)·{\n··········status.fetch·=·'inflight'\n··········if·(stale)·status.returnedStale·=·true\n········}\n········return·stale·?·v.__staleWhileFetching·:·(v.__returned·=·v)\n······}\n\n······//·if·we·force·a·refresh,·that·means·do·NOT·serve·the·cached·value,\n······//·unless·we·are·already·in·the·process·of·refreshing·the·cache.\n······const·isStale·=·this.#isStale(index)\n······if·(!forceRefresh·&&·!isStale)·{\n········if·(status)·status.fetch·=·'hit'\n········this.#moveToTail(index)\n········if·(updateAgeOnGet)·{\n··········this.#updateItemAge(index)\n········}\n········if·(status)·this.#statusTTL(status,·index)\n········return·v\n······}\n\n······//·ok,·it·is·stale·or·a·forced·refresh,·and·not·already·fetching.\n······//·refresh·the·cache.\n······const·p·=·this.#backgroundFetch(k,·index,·options,·context·as·FC)\n······const·hasStale·=·p.__staleWhileFetching·!==·undefined\n······const·staleVal·=·hasStale·&&·allowStale\n······if·(status)·{\n········status.fetch·=·isStale·?·'stale'·:·'refresh'\n········if·(staleVal·&&·isStale)·status.returnedStale·=·true\n······}\n······return·staleVal·?·p.__staleWhileFetching·:·(p.__returned·=·p)\n····}\n··}\n\n··/**\n···*·In·some·cases,·`cache.fetch()`·may·resolve·to·`undefined`,·either·because\n···*·a·{@link·LRUCache.OptionsBase#fetchMethod}·was·not·provided·(turning\n···*·`cache.fetch(k)`·into·just·an·async·wrapper·around·`cache.get(k)`)·or\n···*·because·`ignoreFetchAbort`·was·specified·(either·to·the·constructor·or\n···*·in·the·{@link·LRUCache.FetchOptions}).·Also,·the\n···*·{@link·LRUCache.OptionsBase.fetchMethod}·may·return·`undefined`·or·`void`,·making\n···*·the·test·even·more·complicated.\n···*\n···*·Because·inferring·the·cases·where·`undefined`·might·be·returned·are·so\n···*·cumbersome,·but·testing·for·`undefined`·can·also·be·annoying,·this·method\n···*·can·be·used,·which·will·reject·if·`this.fetch()`·resolves·to·undefined.\n···*/\n··forceFetch(\n····k:·K,\n····fetchOptions:·unknown·extends·FC·?·LRUCache.FetchOptions<K,·V,·FC>\n····:·FC·extends·undefined·|·void·?·LRUCache.FetchOptionsNoContext<K,·V>\n····:·LRUCache.FetchOptionsWithContext<K,·V,·FC>,\n··):·Promise<V>\n··//·this·overload·not·allowed·if·context·is·required\n··forceFetch(\n····k:·unknown·extends·FC·?·K\n····:·FC·extends·undefined·|·void·?·K\n····:·never,\n····fetchOptions?:·unknown·extends·FC·?·LRUCache.FetchOptions<K,·V,·FC>\n····:·FC·extends·undefined·|·void·?·LRUCache.FetchOptionsNoContext<K,·V>\n····:·never,\n··):·Promise<V>\n··forceFetch(\n····k:·K,\n····fetchOptions:·LRUCache.FetchOptions<K,·V,·FC>·=·{},\n··):·Promise<V>·{\n····const·ths·=·tracing.hasSubscribers\n····const·{·status·=·hasSubscribers()·?·{}·:·undefined·}·=·fetchOptions\n····fetchOptions.status·=·status\n····if·(status·&&·fetchOptions.context)·{\n······status.context·=·fetchOptions.context\n····}\n····const·p·=·this.#forceFetch(k,·fetchOptions)\n····if·(status·&&·hasSubscribers())·{\n······if·(ths)·{\n········status.trace·=·true\n········tracing.tracePromise(()·=>·p,·status).catch(()·=>·{})\n······}\n····}\n····return·p\n··}\n\n··async·#forceFetch(\n····k:·K,\n····fetchOptions:·LRUCache.FetchOptions<K,·V,·FC>·=·{},\n··)·{\n····const·v·=·await·this.#fetch(\n······k,\n······fetchOptions·as·unknown·extends·FC·?·LRUCache.FetchOptions<K,·V,·FC>\n······:·FC·extends·undefined·|·void·?·LRUCache.FetchOptionsNoContext<K,·V>\n······:·LRUCache.FetchOptionsWithContext<K,·V,·FC>,\n····)\n····if·(v·===·undefined)·throw·new·Error('fetch()·returned·undefined')\n····return·v\n··}\n\n··/**\n···*·If·the·key·is·found·in·the·cache,·then·this·is·equivalent·to\n···*·{@link·LRUCache#get}.·If·not,·in·the·cache,·then·calculate·the·value·using\n···*·the·{@link·LRUCache.OptionsBase.memoMethod},·and·add·it·to·the·cache.\n···*\n···*·If·an·`FC`·type·is·set·to·a·type·other·than·`unknown`,·`void`,·or\n···*·`undefined`·in·the·LRUCache·constructor,·then·all·calls·to·`cache.memo()`\n···*·_must_·provide·a·`context`·option.·If·set·to·`undefined`·or·`void`,·then\n···*·calls·to·memo·_must·not_·provide·a·`context`·option.\n···*\n···*·The·`context`·param·allows·you·to·provide·arbitrary·data·that·might·be\n···*·relevant·in·the·course·of·fetching·the·data.·It·is·only·relevant·for·the\n···*·course·of·a·single·`memo()`·operation,·and·discarded·afterwards.\n···*/\n··memo(\n····k:·K,\n····memoOptions:·unknown·extends·FC·?·LRUCache.MemoOptions<K,·V,·FC>\n····:·FC·extends·undefined·|·void·?·LRUCache.MemoOptionsNoContext<K,·V>\n····:·LRUCache.MemoOptionsWithContext<K,·V,·FC>,\n··):·V\n··//·this·overload·not·allowed·if·context·is·required\n··memo(\n····k:·unknown·extends·FC·?·K\n····:·FC·extends·undefined·|·void·?·K\n····:·never,\n····memoOptions?:·unknown·extends·FC·?·LRUCache.MemoOptions<K,·V,·FC>\n····:·FC·extends·undefined·|·void·?·LRUCache.MemoOptionsNoContext<K,·V>\n····:·never,\n··):·V\n··memo(k:·K,·memoOptions:·LRUCache.MemoOptions<K,·V,·FC>·=·{})·{\n····const·{·status·=·metrics.hasSubscribers·?·{}·:·undefined·}·=\n······memoOptions\n····memoOptions.status·=·status\n····if·(status)·{\n······status.op·=·'memo'\n······status.key·=·k\n······if·(memoOptions.context)·{\n········status.context·=·memoOptions.context\n······}\n····}\n····const·result·=·this.#memo(k,·memoOptions)\n····if·(status)·status.value·=·result\n····if·(metrics.hasSubscribers)·metrics.publish(status)\n····return·result\n··}\n··#memo(k:·K,·memoOptions:·LRUCache.MemoOptions<K,·V,·FC>·=·{})·{\n····const·memoMethod·=·this.#memoMethod\n····if·(!memoMethod)·{\n······throw·new·Error('no·memoMethod·provided·to·constructor')\n····}\n····const·{·context,·status,·forceRefresh,·...options·}·=·memoOptions\n····if·(status·&&·forceRefresh)·status.forceRefresh·=·true\n····const·v·=·this.#get(k,·options)\n····const·refresh·=·forceRefresh·||·v·===·undefined\n····if·(status)·{\n······status.memo·=·refresh·?·'miss'·:·'hit'\n······if·(!refresh)·status.value·=·v\n····}\n····if·(!refresh)·return·v\n····const·vv·=·memoMethod(k,·v,·{\n······options,\n······context,\n····}·as·LRUCache.MemoizerOptions<K,·V,·FC>)\n····if·(status)·status.value·=·vv\n····this.#set(k,·vv,·options)\n····return·vv\n··}\n\n··/**\n···*·Return·a·value·from·the·cache.·Will·update·the·recency·of·the·cache\n···*·entry·found.\n···*\n···*·If·the·key·is·not·found,·get()·will·return·`undefined`.\n···*/\n··get(k:·K,·getOptions:·LRUCache.GetOptions<K,·V,·FC>·=·{})·{\n····const·{·status·=·metrics.hasSubscribers·?·{}·:·undefined·}·=·getOptions\n····getOptions.status·=·status\n····if·(status)·{\n······status.op·=·'get'\n······status.key·=·k\n····}\n····const·result·=·this.#get(k,·getOptions)\n····if·(status)·{\n······if·(result·!==·undefined)·status.value·=·result\n······if·(metrics.hasSubscribers)·metrics.publish(status)\n····}\n····return·result\n··}\n\n··#get(k:·K,·getOptions:·LRUCache.GetOptions<K,·V,·FC>·=·{})·{\n····const·{\n······allowStale·=·this.allowStale,\n······updateAgeOnGet·=·this.updateAgeOnGet,\n······noDeleteOnStaleGet·=·this.noDeleteOnStaleGet,\n······status,\n····}·=·getOptions\n····const·index·=·this.#keyMap.get(k)\n····if·(index·===·undefined)·{\n······if·(status)·status.get·=·'miss'\n······return·undefined\n····}\n····const·value·=·this.#valList[index]\n····const·fetching·=·this.#isBackgroundFetch(value)\n····if·(status)·this.#statusTTL(status,·index)\n····if·(this.#isStale(index))·{\n······//·delete·only·if·not·an·in-flight·background·fetch\n······if·(!fetching)·{\n········if·(!noDeleteOnStaleGet)·{\n··········this.#delete(k,·'expire')\n········}\n········if·(status)·status.get·=·'stale'\n········if·(allowStale)·{\n··········if·(status)·status.returnedStale·=·true\n··········return·value\n········}\n········return·undefined\n······}\n······if·(status)·status.get·=·'stale-fetching'\n······if·(allowStale·&&·value.__staleWhileFetching·!==·undefined)·{\n········if·(status)·status.returnedStale·=·true\n········return·value.__staleWhileFetching\n······}\n······return·undefined\n····}\n····//·not·stale\n····if·(status)·status.get·=·fetching·?·'fetching'·:·'hit'\n····//·if·we're·currently·fetching·it,·we·don't·actually·have·it·yet\n····//·it's·not·stale,·which·means·this·isn't·a·staleWhileRefetching.\n····//·If·it's·not·stale,·and·fetching,·AND·has·a·__staleWhileFetching\n····//·value,·then·that·means·the·user·fetched·with·{forceRefresh:true},\n····//·so·it's·safe·to·return·that·value.\n····this.#moveToTail(index)\n····if·(updateAgeOnGet)·{\n······this.#updateItemAge(index)\n····}\n····return·fetching·?·value.__staleWhileFetching·:·value\n··}\n\n··#connect(p:·Index,·n:·Index)·{\n····this.#prev[n]·=·p\n····this.#next[p]·=·n\n··}\n\n··#moveToTail(index:·Index):·void·{\n····//·if·tail·already,·nothing·to·do\n····//·if·head,·move·head·to·next[index]\n····//·else\n····//···move·next[prev[index]]·to·next[index]·(head·has·no·prev)\n····//···move·prev[next[index]]·to·prev[index]\n····//·prev[index]·=·tail\n····//·next[tail]·=·index\n····//·tail·=·index\n····if·(index·!==·this.#tail)·{\n······if·(index·===·this.#head)·{\n········this.#head·=·this.#next[index]·as·Index\n······}·else·{\n········this.#connect(\n··········this.#prev[index]·as·Index,\n··········this.#next[index]·as·Index,\n········)\n······}\n······this.#connect(this.#tail,·index)\n······this.#tail·=·index\n····}\n··}\n\n··/**\n···*·Deletes·a·key·out·of·the·cache.\n···*\n···*·Returns·true·if·the·key·was·deleted,·false·otherwise.\n···*/\n··delete(k:·K)·{\n····return·this.#delete(k,·'delete')\n··}\n\n··#delete(k:·K,·reason:·LRUCache.DisposeReason)·{\n····if·(metrics.hasSubscribers)·{\n······metrics.publish({\n········op:·'delete',\n········delete:·reason,\n········key:·k,\n······})\n····}\n····let·deleted·=·false\n····if·(this.#size·!==·0)·{\n······const·index·=·this.#keyMap.get(k)\n······if·(index·!==·undefined)·{\n········if·(this.#autopurgeTimers?.[index])·{\n··········clearTimeout(this.#autopurgeTimers?.[index])\n··········this.#autopurgeTimers[index]·=·undefined\n········}\n········deleted·=·true\n········if·(this.#size·===·1)·{\n··········this.#clear(reason)\n········}·else·{\n··········this.#removeItemSize(index)\n··········const·v·=·this.#valList[index]\n··········if·(this.#isBackgroundFetch(v))·{\n············v.__abortController.abort(new·Error('deleted'))\n··········}·else·if·(this.#hasDispose·||·this.#hasDisposeAfter)·{\n············if·(this.#hasDispose)·{\n··············this.#dispose?.(v·as·V,·k,·reason)\n············}\n············if·(this.#hasDisposeAfter)·{\n··············this.#disposed?.push([v·as·V,·k,·reason])\n············}\n··········}\n··········this.#keyMap.delete(k)\n··········this.#keyList[index]·=·undefined\n··········this.#valList[index]·=·undefined\n··········if·(index·===·this.#tail)·{\n············this.#tail·=·this.#prev[index]·as·Index\n··········}·else·if·(index·===·this.#head)·{\n············this.#head·=·this.#next[index]·as·Index\n··········}·else·{\n············const·pi·=·this.#prev[index]·as·number\n············this.#next[pi]·=·this.#next[index]·as·number\n············const·ni·=·this.#next[index]·as·number\n············this.#prev[ni]·=·this.#prev[index]·as·number\n··········}\n··········this.#size--\n··········this.#free.push(index)\n········}\n······}\n····}\n····if·(this.#hasDisposeAfter·&&·this.#disposed?.length)·{\n······const·dt·=·this.#disposed\n······let·task:·DisposeTask<K,·V>·|·undefined\n······while·((task·=·dt?.shift()))·{\n········this.#disposeAfter?.(...task)\n······}\n····}\n····return·deleted\n··}\n\n··/**\n···*·Clear·the·cache·entirely,·throwing·away·all·values.\n···*/\n··clear()·{\n····return·this.#clear('delete')\n··}\n··#clear(reason:·LRUCache.DisposeReason)·{\n····for·(const·index·of·this.#rindexes({·allowStale:·true·}))·{\n······const·v·=·this.#valList[index]\n······if·(this.#isBackgroundFetch(v))·{\n········v.__abortController.abort(new·Error('deleted'))\n······}·else·{\n········const·k·=·this.#keyList[index]\n········if·(this.#hasDispose)·{\n··········this.#dispose?.(v·as·V,·k·as·K,·reason)\n········}\n········if·(this.#hasDisposeAfter)·{\n··········this.#disposed?.push([v·as·V,·k·as·K,·reason])\n········}\n······}\n····}\n\n····this.#keyMap.clear()\n····this.#valList.fill(undefined)\n····this.#keyList.fill(undefined)\n····if·(this.#ttls·&&·this.#starts)·{\n······this.#ttls.fill(0)\n······this.#starts.fill(0)\n······for·(const·t·of·this.#autopurgeTimers·??·[])·{\n········if·(t·!==·undefined)·clearTimeout(t)\n······}\n······this.#autopurgeTimers?.fill(undefined)\n····}\n····if·(this.#sizes)·{\n······this.#sizes.fill(0)\n····}\n····this.#head·=·0·as·Index\n····this.#tail·=·0·as·Index\n····this.#free.length·=·0\n····this.#calculatedSize·=·0\n····this.#size·=·0\n····if·(this.#hasDisposeAfter·&&·this.#disposed)·{\n······const·dt·=·this.#disposed\n······let·task:·DisposeTask<K,·V>·|·undefined\n······while·((task·=·dt?.shift()))·{\n········this.#disposeAfter?.(...task)\n······}\n····}\n··}\n}\n" |
| 194 | ····], | 194 | ····], |
| 195 | ····"version":·3 | 195 | ····"version":·3 |
| 196 | } | 196 | } |
| Offset 15, 28 lines modified | Offset 15, 36 lines modified | ||
| 15 | ····}, | 15 | ····}, |
| 16 | ····"engines":·{ | 16 | ····"engines":·{ |
| 17 | ········"node":·"20·||·>=22" | 17 | ········"node":·"20·||·>=22" |
| 18 | ····}, | 18 | ····}, |
| 19 | ····"exports":·{ | 19 | ····"exports":·{ |
| 20 | ········".":·{ | 20 | ········".":·{ |
| 21 | ············"import":·{ | 21 | ············"import":·{ |
| 22 | ················"browser":·{ | ||
| 23 | ····················"default":·"./dist/esm/browser/index.min.js", | ||
| 24 | ····················"types":·"./dist/esm/browser/index.d.ts" | ||
| 25 | ················}, | ||
| 22 | ················"default":·"./dist/esm/index.min.js", | 26 | ················"default":·"./dist/esm/index.min.js", |
| 23 | ················"node":·{ | 27 | ················"node":·{ |
| 24 | ····················"default":·"./dist/esm/node/index.min.js", | 28 | ····················"default":·"./dist/esm/node/index.min.js", |
| 25 | ····················"types":·"./dist/esm/node/index.d.ts" | 29 | ····················"types":·"./dist/esm/node/index.d.ts" |
| 26 | ················}, | 30 | ················}, |
| 27 | ················"types":·"./dist/esm/index.d.ts" | 31 | ················"types":·"./dist/esm/index.d.ts" |
| 28 | ············}, | 32 | ············}, |
| 29 | ············"require":·{ | 33 | ············"require":·{ |
| 30 | ················"default":·"./dist/commonjs/index.min.js", | 34 | ················"default":·"./dist/commonjs/index.min.js", |
| 31 | ················"types":·"./dist/commonjs/index.d.ts" | 35 | ················"types":·"./dist/commonjs/index.d.ts" |
| 32 | ············} | 36 | ············} |
| 33 | ········}, | 37 | ········}, |
| 34 | ········"./raw":·{ | 38 | ········"./raw":·{ |
| 35 | ············"import":·{ | 39 | ············"import":·{ |
| 40 | ················"browser":·{ | ||
| 41 | ····················"default":·"./dist/esm/browser/index.js", | ||
| 42 | ····················"types":·"./dist/esm/browser/index.d.ts" | ||
| 43 | ················}, | ||
| 36 | ················"default":·"./dist/esm/index.js", | 44 | ················"default":·"./dist/esm/index.js", |
| 37 | ················"node":·{ | 45 | ················"node":·{ |
| 38 | ····················"default":·"./dist/esm/node/index.js", | 46 | ····················"default":·"./dist/esm/node/index.js", |
| 39 | ····················"types":·"./dist/esm/node/index.d.ts" | 47 | ····················"types":·"./dist/esm/node/index.d.ts" |
| 40 | ················}, | 48 | ················}, |
| 41 | ················"types":·"./dist/esm/index.d.ts" | 49 | ················"types":·"./dist/esm/index.d.ts" |
| 42 | ············}, | 50 | ············}, |
| Offset 82, 19 lines modified | Offset 90, 24 lines modified | ||
| 82 | ········"snap":·"tap", | 90 | ········"snap":·"tap", |
| 83 | ········"test":·"tap", | 91 | ········"test":·"tap", |
| 84 | ········"typedoc":·"typedoc·--tsconfig·./.tshy/esm.json·./src/*.ts" | 92 | ········"typedoc":·"typedoc·--tsconfig·./.tshy/esm.json·./src/*.ts" |
| 85 | ····}, | 93 | ····}, |
| 86 | ····"sideEffects":·false, | 94 | ····"sideEffects":·false, |
| 87 | ····"tshy":·{ | 95 | ····"tshy":·{ |
| 88 | ········"esmDialects":·[ | 96 | ········"esmDialects":·[ |
| 89 | ············"node" | 97 | ············"node", |
| 98 | ············"browser" | ||
| 90 | ········], | 99 | ········], |
| 91 | ········"exports":·{ | 100 | ········"exports":·{ |
| 92 | ············".":·{ | 101 | ············".":·{ |
| 93 | ················"import":·{ | 102 | ················"import":·{ |
| 103 | ····················"browser":·{ | ||
| 104 | ························"default":·"./dist/esm/browser/index.min.js", | ||
| 105 | ························"types":·"./dist/esm/browser/index.d.ts" | ||
| 106 | ····················}, | ||
| 94 | ····················"default":·"./dist/esm/index.min.js", | 107 | ····················"default":·"./dist/esm/index.min.js", |
| 95 | ····················"node":·{ | 108 | ····················"node":·{ |
| 96 | ························"default":·"./dist/esm/node/index.min.js", | 109 | ························"default":·"./dist/esm/node/index.min.js", |
| 97 | ························"types":·"./dist/esm/node/index.d.ts" | 110 | ························"types":·"./dist/esm/node/index.d.ts" |
| 98 | ····················}, | 111 | ····················}, |
| 99 | ····················"types":·"./dist/esm/index.d.ts" | 112 | ····················"types":·"./dist/esm/index.d.ts" |
| 100 | ················}, | 113 | ················}, |
| Offset 105, 9 lines modified | Offset 118, 9 lines modified | ||
| 105 | ············}, | 118 | ············}, |
| 106 | ············"./raw":·"./src/index.ts" | 119 | ············"./raw":·"./src/index.ts" |
| 107 | ········}, | 120 | ········}, |
| 108 | ········"selfLink":·false | 121 | ········"selfLink":·false |
| 109 | ····}, | 122 | ····}, |
| 110 | ····"type":·"module", | 123 | ····"type":·"module", |
| 111 | ····"types":·"./dist/commonjs/index.d.ts", | 124 | ····"types":·"./dist/commonjs/index.d.ts", |
| 112 | ····"version":·"11.3. | 125 | ····"version":·"11.3.5" |
| 113 | } | 126 | } |
| Offset 48, 14 lines modified | Offset 48, 15 lines modified | ||
| 48 | export·type·{InvariantOf}·from·'./source/invariant-of.d.ts'; | 48 | export·type·{InvariantOf}·from·'./source/invariant-of.d.ts'; |
| 49 | export·type·{SetOptional}·from·'./source/set-optional.d.ts'; | 49 | export·type·{SetOptional}·from·'./source/set-optional.d.ts'; |
| 50 | export·type·{SetReadonly}·from·'./source/set-readonly.d.ts'; | 50 | export·type·{SetReadonly}·from·'./source/set-readonly.d.ts'; |
| 51 | export·type·{SetRequired}·from·'./source/set-required.d.ts'; | 51 | export·type·{SetRequired}·from·'./source/set-required.d.ts'; |
| 52 | export·type·{SetRequiredDeep}·from·'./source/set-required-deep.d.ts'; | 52 | export·type·{SetRequiredDeep}·from·'./source/set-required-deep.d.ts'; |
| 53 | export·type·{SetNonNullable}·from·'./source/set-non-nullable.d.ts'; | 53 | export·type·{SetNonNullable}·from·'./source/set-non-nullable.d.ts'; |
| 54 | export·type·{SetNonNullableDeep}·from·'./source/set-non-nullable-deep.d.ts'; | 54 | export·type·{SetNonNullableDeep}·from·'./source/set-non-nullable-deep.d.ts'; |
| 55 | export·type·{NonNullableDeep}·from·'./source/non-nullable-deep.d.ts'; | ||
| 55 | export·type·{ValueOf}·from·'./source/value-of.d.ts'; | 56 | export·type·{ValueOf}·from·'./source/value-of.d.ts'; |
| 56 | export·type·{AsyncReturnType}·from·'./source/async-return-type.d.ts'; | 57 | export·type·{AsyncReturnType}·from·'./source/async-return-type.d.ts'; |
| 57 | export·type·{ConditionalExcept}·from·'./source/conditional-except.d.ts'; | 58 | export·type·{ConditionalExcept}·from·'./source/conditional-except.d.ts'; |
| 58 | export·type·{ConditionalKeys}·from·'./source/conditional-keys.d.ts'; | 59 | export·type·{ConditionalKeys}·from·'./source/conditional-keys.d.ts'; |
| 59 | export·type·{ConditionalPick}·from·'./source/conditional-pick.d.ts'; | 60 | export·type·{ConditionalPick}·from·'./source/conditional-pick.d.ts'; |
| 60 | export·type·{ConditionalPickDeep,·ConditionalPickDeepOptions}·from·'./source/conditional-pick-deep.d.ts'; | 61 | export·type·{ConditionalPickDeep,·ConditionalPickDeepOptions}·from·'./source/conditional-pick-deep.d.ts'; |
| 61 | export·type·{UnionToIntersection}·from·'./source/union-to-intersection.d.ts'; | 62 | export·type·{UnionToIntersection}·from·'./source/union-to-intersection.d.ts'; |
| Offset 169, 14 lines modified | Offset 170, 16 lines modified | ||
| 169 | export·type·{IsUppercase}·from·'./source/is-uppercase.d.ts'; | 170 | export·type·{IsUppercase}·from·'./source/is-uppercase.d.ts'; |
| 170 | export·type·{IsOptional}·from·'./source/is-optional.d.ts'; | 171 | export·type·{IsOptional}·from·'./source/is-optional.d.ts'; |
| 171 | export·type·{IsNullable}·from·'./source/is-nullable.d.ts'; | 172 | export·type·{IsNullable}·from·'./source/is-nullable.d.ts'; |
| 172 | export·type·{TupleOf}·from·'./source/tuple-of.d.ts'; | 173 | export·type·{TupleOf}·from·'./source/tuple-of.d.ts'; |
| 173 | export·type·{ExclusifyUnion}·from·'./source/exclusify-union.d.ts'; | 174 | export·type·{ExclusifyUnion}·from·'./source/exclusify-union.d.ts'; |
| 174 | export·type·{ArrayReverse}·from·'./source/array-reverse.d.ts'; | 175 | export·type·{ArrayReverse}·from·'./source/array-reverse.d.ts'; |
| 175 | export·type·{UnionMember}·from·'./source/union-member.d.ts'; | 176 | export·type·{UnionMember}·from·'./source/union-member.d.ts'; |
| 177 | export·type·{Absolute}·from·'./source/absolute.d.ts'; | ||
| 178 | export·type·{UnionLength}·from·'./source/union-length.d.ts'; | ||
| 176 | //·Template·literal·types | 179 | //·Template·literal·types |
| 177 | export·type·{CamelCase,·CamelCaseOptions}·from·'./source/camel-case.d.ts'; | 180 | export·type·{CamelCase,·CamelCaseOptions}·from·'./source/camel-case.d.ts'; |
| 178 | export·type·{CamelCasedProperties}·from·'./source/camel-cased-properties.d.ts'; | 181 | export·type·{CamelCasedProperties}·from·'./source/camel-cased-properties.d.ts'; |
| 179 | export·type·{CamelCasedPropertiesDeep}·from·'./source/camel-cased-properties-deep.d.ts'; | 182 | export·type·{CamelCasedPropertiesDeep}·from·'./source/camel-cased-properties-deep.d.ts'; |
| 180 | export·type·{KebabCase}·from·'./source/kebab-case.d.ts'; | 183 | export·type·{KebabCase}·from·'./source/kebab-case.d.ts'; |
| 181 | export·type·{KebabCasedProperties}·from·'./source/kebab-cased-properties.d.ts'; | 184 | export·type·{KebabCasedProperties}·from·'./source/kebab-cased-properties.d.ts'; |
| Offset 5, 25 lines modified | Offset 5, 27 lines modified | ||
| 5 | ········"url":·"https://sindresorhus.com" | 5 | ········"url":·"https://sindresorhus.com" |
| 6 | ····}, | 6 | ····}, |
| 7 | ····"dependencies":·{ | 7 | ····"dependencies":·{ |
| 8 | ········"tagged-tag":·"^1.0.0" | 8 | ········"tagged-tag":·"^1.0.0" |
| 9 | ····}, | 9 | ····}, |
| 10 | ····"description":·"A·collection·of·essential·TypeScript·types", | 10 | ····"description":·"A·collection·of·essential·TypeScript·types", |
| 11 | ····"devDependencies":·{ | 11 | ····"devDependencies":·{ |
| 12 | ········"@eslint/markdown":·"^8.0.1", | ||
| 12 | ········"@sindresorhus/tsconfig":·"^8.0.1", | 13 | ········"@sindresorhus/tsconfig":·"^8.0.1", |
| 14 | ········"@types/node":·"^25.5.0", | ||
| 13 | ········"@typescript-eslint/parser":·"^8.44.0", | 15 | ········"@typescript-eslint/parser":·"^8.44.0", |
| 14 | ········"@typescript/vfs":·"^1.6.1", | 16 | ········"@typescript/vfs":·"^1.6.1", |
| 15 | ········"dedent":·"^1.7.0", | 17 | ········"dedent":·"^1.7.0", |
| 16 | ········"eslint":·"^ | 18 | ········"eslint":·"^10.1.0", |
| 17 | ········"expect-type":·"^1.2.2", | 19 | ········"expect-type":·"^1.2.2", |
| 18 | ········"npm-run-all2":·"^8.0.4", | 20 | ········"npm-run-all2":·"^8.0.4", |
| 19 | ········"tsd":·"^0.33.0", | 21 | ········"tsd":·"^0.33.0", |
| 20 | ········"typescript":·"^5.9.2", | 22 | ········"typescript":·"^5.9.2", |
| 21 | ········"typescript-eslint":·"^8.47.0", | 23 | ········"typescript-eslint":·"^8.47.0", |
| 22 | ········"xo":·"^ | 24 | ········"xo":·"^2.0.2" |
| 23 | ····}, | 25 | ····}, |
| 24 | ····"engines":·{ | 26 | ····"engines":·{ |
| 25 | ········"node":·">=20" | 27 | ········"node":·">=20" |
| 26 | ····}, | 28 | ····}, |
| 27 | ····"exports":·{ | 29 | ····"exports":·{ |
| 28 | ········".":·{ | 30 | ········".":·{ |
| 29 | ············"types":·"./index.d.ts" | 31 | ············"types":·"./index.d.ts" |
| Offset 55, 19 lines modified | Offset 57, 19 lines modified | ||
| 55 | ····"name":·"type-fest", | 57 | ····"name":·"type-fest", |
| 56 | ····"repository":·"sindresorhus/type-fest", | 58 | ····"repository":·"sindresorhus/type-fest", |
| 57 | ····"scripts":·{ | 59 | ····"scripts":·{ |
| 58 | ········"test":·"run-p·test:*", | 60 | ········"test":·"run-p·test:*", |
| 59 | ········"test:linter":·"node·--test", | 61 | ········"test:linter":·"node·--test", |
| 60 | ········"test:tsc":·"node·--max-old-space-size=6144·./node_modules/.bin/tsc", | 62 | ········"test:tsc":·"node·--max-old-space-size=6144·./node_modules/.bin/tsc", |
| 61 | ········"test:tsd":·"node·--max-old-space-size=6144·./node_modules/.bin/tsd", | 63 | ········"test:tsd":·"node·--max-old-space-size=6144·./node_modules/.bin/tsd", |
| 62 | ········"test:xo":·"node·--max-old-space-size=6144·./node_modules/.bin/xo·--ignores=lint-processors/fixtures/**/*.d.ts" | 64 | ········"test:xo":·"node·--max-old-space-size=6144·./node_modules/.bin/xo·--ignores=lint-processors/fixtures/**/*.d.ts·'**/*.{js,ts,md}'" |
| 63 | ····}, | 65 | ····}, |
| 64 | ····"sideEffects":·false, | 66 | ····"sideEffects":·false, |
| 65 | ····"tsd":·{ | 67 | ····"tsd":·{ |
| 66 | ········"compilerOptions":·{ | 68 | ········"compilerOptions":·{ |
| 67 | ············"noUnusedLocals":·false | 69 | ············"noUnusedLocals":·false |
| 68 | ········} | 70 | ········} |
| 69 | ····}, | 71 | ····}, |
| 70 | ····"type":·"module", | 72 | ····"type":·"module", |
| 71 | ····"types":·"./index.d.ts", | 73 | ····"types":·"./index.d.ts", |
| 72 | ····"version":·"5. | 74 | ····"version":·"5.6.0" |
| 73 | } | 75 | } |
| Offset 25, 14 lines modified | Offset 25, 25 lines modified | ||
| 25 | » » » » » <img·width="230"·src="https://sindresorhus.com/assets/thanks/nitric-logo.svg"·alt="nitric·logo"> | 25 | » » » » » <img·width="230"·src="https://sindresorhus.com/assets/thanks/nitric-logo.svg"·alt="nitric·logo"> |
| 26 | » » » » </div> | 26 | » » » » </div> |
| 27 | » » » » <b>Effortless·backends·with·infrastructure·from·code</b> | 27 | » » » » <b>Effortless·backends·with·infrastructure·from·code</b> |
| 28 | » » » » <div> | 28 | » » » » <div> |
| 29 | » » » » » <sup>An·open-source·framework·that·supports·any·programming·language,·cloud·provider,·or·deployment·automation·tool.</sup> | 29 | » » » » » <sup>An·open-source·framework·that·supports·any·programming·language,·cloud·provider,·or·deployment·automation·tool.</sup> |
| 30 | » » » » </div> | 30 | » » » » </div> |
| 31 | » » » </a> | 31 | » » » </a> |
| 32 | » » » <br> | ||
| 33 | » » » <br> | ||
| 34 | » » » <a·href="https://circleback.ai?utm_source=sindresorhus&utm_medium=sponsorship&utm_campaign=awesome-list&utm_id=type-fest"> | ||
| 35 | » » » » <div> | ||
| 36 | » » » » » <img·width="300"·src="https://sindresorhus.com/assets/thanks/circleback-logo.png?x"·alt="Circleback·logo"> | ||
| 37 | » » » » </div> | ||
| 38 | » » » » <b>Get·the·most·out·of·every·conversation.</b> | ||
| 39 | » » » » <div> | ||
| 40 | » » » » » <sup>AI-powered·meeting·notes,·automations,·and·search.·Give·AI·agents·the·context·they·need·to·get·things·done.</sup> | ||
| 41 | » » » » </div> | ||
| 42 | » » » </a> | ||
| 32 | » » </p> | 43 | » » </p> |
| 33 | » </div> | 44 | » </div> |
| 34 | » <br> | 45 | » <br> |
| 35 | » <hr> | 46 | » <hr> |
| 36 | </div> | 47 | </div> |
| 37 | <br> | 48 | <br> |
| 38 | <br> | 49 | <br> |
| Offset 98, 92 lines modified | Offset 109, 93 lines modified | ||
| 98 | -·[`EmptyObject`](source/empty-object.d.ts)·-·Represents·a·strictly·empty·plain·object,·the·`{}`·value. | 109 | -·[`EmptyObject`](source/empty-object.d.ts)·-·Represents·a·strictly·empty·plain·object,·the·`{}`·value. |
| 99 | -·[`NonEmptyObject`](source/non-empty-object.d.ts)·-·Represents·an·object·with·at·least·1·non-optional·key. | 110 | -·[`NonEmptyObject`](source/non-empty-object.d.ts)·-·Represents·an·object·with·at·least·1·non-optional·key. |
| 100 | -·[`UnknownRecord`](source/unknown-record.d.ts)·-·Represents·an·object·with·`unknown`·value.·You·probably·want·this·instead·of·`{}`. | 111 | -·[`UnknownRecord`](source/unknown-record.d.ts)·-·Represents·an·object·with·`unknown`·value.·You·probably·want·this·instead·of·`{}`. |
| 101 | -·[`UnknownArray`](source/unknown-array.d.ts)·-·Represents·an·array·with·`unknown`·value. | 112 | -·[`UnknownArray`](source/unknown-array.d.ts)·-·Represents·an·array·with·`unknown`·value. |
| 102 | -·[`UnknownMap`](source/unknown-map.d.ts)·-·Represents·a·map·with·`unknown`·key·and·value. | 113 | -·[`UnknownMap`](source/unknown-map.d.ts)·-·Represents·a·map·with·`unknown`·key·and·value. |
| 103 | -·[`UnknownSet`](source/unknown-set.d.ts)·-·Represents·a·set·with·`unknown`·value. | 114 | -·[`UnknownSet`](source/unknown-set.d.ts)·-·Represents·a·set·with·`unknown`·value. |
| 104 | -·[`Except`](source/except.d.ts)·-·Create·a·type·from·an·object·type·without·certain·keys. | 115 | -·[`Except`](source/except.d.ts)·-·Create·a·type·from·an·object·type·without·certain·keys. |
| 105 | -·[`Writable`](source/writable.d.ts)·-·Create·a·type·that·strips·`readonly`·from·the·given·type.·Inverse·of·`Readonly<T>`. | 116 | -·[`Writable`](source/writable.d.ts)·-·Create·a·type·that·strips·`readonly`·from·the·given·type.·Inverse·of·`Readonly<T>`. |
| 106 | -·[`WritableDeep`](source/writable-deep.d.ts)·-·Create·a·deeply·mutable·version·of·an·`object`/`ReadonlyMap`/`ReadonlySet`/`ReadonlyArray`·type.·The·inverse·of·`ReadonlyDeep<T>`.·Use·`Writable<T>`·if·you·only·need·one·level·deep. | 117 | -·[`WritableDeep`](source/writable-deep.d.ts)·-·Create·a·deeply·mutable·version·of·an·`object`/`ReadonlyMap`/`ReadonlySet`/`ReadonlyArray`·type.·The·inverse·of·`ReadonlyDeep<T>`.·Use·`Writable<T>`·if·you·only·need·one·level·deep. |
| 107 | -·[`Merge`](source/merge.d.ts)·-·Merge·two·types·into·a·new·type.·Keys·of·the·second·type·overrides·keys·of·the·first·type. | 118 | -·[`Merge`](source/merge.d.ts)·-·Merge·two·types·into·a·new·type.·Keys·of·the·second·type·overrides·keys·of·the·first·type. |
| 108 | -·[`ObjectMerge`](source/object-merge.d.ts)·-·Merge·two·object·types·into·a·new·object·type,·where·keys·from·the·second·override·keys·from·the·first. | 119 | -·[`ObjectMerge`](source/object-merge.d.ts)·-·Merge·two·object·types·into·a·new·object·type,·where·keys·from·the·second·override·keys·from·the·first. |
| 109 | -·[`MergeDeep`](source/merge-deep.d.ts)·-·Merge·two·objects·or·two·arrays/tuples·recursively·into·a·new·type. | 120 | -·[`MergeDeep`](source/merge-deep.d.ts)·-·Merge·two·objects·or·two·arrays/tuples·recursively·into·a·new·type. |
| 110 | -·[`MergeExclusive`](source/merge-exclusive.d.ts)·-·Create·a·type·that·has·mutually·exclusive·keys. | 121 | -·[`MergeExclusive`](source/merge-exclusive.d.ts)·-·Create·a·type·that·has·mutually·exclusive·keys. |
| 111 | -·[`OverrideProperties`](source/override-properties.d.ts)·-·Override· | 122 | -·[`OverrideProperties`](source/override-properties.d.ts)·-·Override·existing·properties·of·the·given·type.·Similar·to·`Merge`,·but·enforces·that·the·original·type·has·the·properties·you·want·to·override. |
| 112 | -·[`RequireAtLeastOne`](source/require-at-least-one.d.ts)·-·Create·a·type·that·requires·at·least·one·of·the·given·keys. | 123 | -·[`RequireAtLeastOne`](source/require-at-least-one.d.ts)·-·Create·a·type·that·requires·at·least·one·of·the·given·keys,·while·keeping·the·remaining·keys·as·is. |
| 113 | -·[`RequireExactlyOne`](source/require-exactly-one.d.ts)·-·Create·a·type·that·requires·exactly· | 124 | -·[`RequireExactlyOne`](source/require-exactly-one.d.ts)·-·Create·a·type·that·requires·exactly·one·of·the·given·keys·and·disallows·more,·while·keeping·the·remaining·keys·as·is. |
| 114 | -·[`RequireAllOrNone`](source/require-all-or-none.d.ts)·-·Create·a·type·that·requires·all·of·the·given·keys·or·none·of·the·given·keys. | 125 | -·[`RequireAllOrNone`](source/require-all-or-none.d.ts)·-·Create·a·type·that·requires·all·of·the·given·keys·or·none·of·the·given·keys,·while·keeping·the·remaining·keys·as·is. |
| 115 | -·[`RequireOneOrNone`](source/require-one-or-none.d.ts)·-·Create·a·type·that·requires·exactly· | 126 | -·[`RequireOneOrNone`](source/require-one-or-none.d.ts)·-·Create·a·type·that·requires·exactly·one·of·the·given·keys·or·none·of·the·given·keys,·while·keeping·the·remaining·keys·as·is. |
| 116 | -·[`SingleKeyObject`](source/single-key-object.d.ts)·-·Create·a·type·that·only·accepts·an·object·with·a·single·key. | 127 | -·[`SingleKeyObject`](source/single-key-object.d.ts)·-·Create·a·type·that·only·accepts·an·object·with·a·single·key. |
| 117 | -·[`RequiredDeep`](source/required-deep.d.ts)·-·Create·a·deeply·required·version·of·another·type.·Use·[`Required<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#requiredtype)·if·you·only·need·one·level·deep. | ||
| 118 | -·[`PickDeep`](source/pick-deep.d.ts)·-·Pick·properties·from·a·deeply-nested·object.·Use·[`Pick<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#picktype-keys)·if·you·only·need·one·level·deep. | ||
| 119 | -·[` | 128 | -·[`RequiredDeep`](source/required-deep.d.ts)·-·Create·a·deeply·required·version·of·another·type. |
| 129 | -·[`PickDeep`](source/pick-deep.d.ts)·-·Pick·properties·from·a·deeply-nested·object. | ||
| 130 | -·[`OmitDeep`](source/omit-deep.d.ts)·-·Omit·properties·from·a·deeply-nested·object. | ||
| 120 | -·[`OmitIndexSignature`](source/omit-index-signature.d.ts)·-·Omit·any·index·signatures·from·the·given·object·type,·leaving·only·explicitly·defined·properties. | 131 | -·[`OmitIndexSignature`](source/omit-index-signature.d.ts)·-·Omit·any·index·signatures·from·the·given·object·type,·leaving·only·explicitly·defined·properties. |
| 121 | -·[`PickIndexSignature`](source/pick-index-signature.d.ts)·-·Pick·only·index·signatures·from·the·given·object·type,·leaving·out·all·explicitly·defined·properties. | 132 | -·[`PickIndexSignature`](source/pick-index-signature.d.ts)·-·Pick·only·index·signatures·from·the·given·object·type,·leaving·out·all·explicitly·defined·properties. |
| 122 | -·[`PartialDeep`](source/partial-deep.d.ts)·-·Create·a·deeply·optional·version·of·another·type. | 133 | -·[`PartialDeep`](source/partial-deep.d.ts)·-·Create·a·deeply·optional·version·of·another·type. |
| 123 | -·[`PartialOnUndefinedDeep`](source/partial-on-undefined-deep.d.ts)·-·Create·a·deep·version·of·another·type·where·all·keys·accepting·`undefined`·type·are·set·to·optional. | 134 | -·[`PartialOnUndefinedDeep`](source/partial-on-undefined-deep.d.ts)·-·Create·a·deep·version·of·another·type·where·all·keys·accepting·`undefined`·type·are·set·to·optional. |
| 124 | -·[`UndefinedOnPartialDeep`](source/undefined-on-partial-deep.d.ts)·-·Create·a·deep·version·of·another·type·where·all·optional·keys·are·set·to·also·accept·`undefined`. | 135 | -·[`UndefinedOnPartialDeep`](source/undefined-on-partial-deep.d.ts)·-·Create·a·deep·version·of·another·type·where·all·optional·keys·are·set·to·also·accept·`undefined`. |
| 125 | -·[`UnwrapPartial`](source/unwrap-partial.d.ts)·-·Revert·the·`Partial`·modifier·on·an·object·type. | 136 | -·[`UnwrapPartial`](source/unwrap-partial.d.ts)·-·Revert·the·`Partial`·modifier·on·an·object·type. |
| 126 | -·[`ReadonlyDeep`](source/readonly-deep.d.ts)·-·Create·a·deeply·immutable·version·of·an | 137 | -·[`ReadonlyDeep`](source/readonly-deep.d.ts)·-·Create·a·deeply·immutable·version·of·another·type. |
| 127 | -·[`LiteralUnion`](source/literal-union.d.ts)·-·Create·a·union·type·by·combining·primitive·types·and·literal·types·without·sacrificing·auto-completion·in·IDEs·for·the·literal·type·part·of·the·union. | 138 | -·[`LiteralUnion`](source/literal-union.d.ts)·-·Create·a·union·type·by·combining·primitive·types·and·literal·types·without·sacrificing·auto-completion·in·IDEs·for·the·literal·type·part·of·the·union. |
| 128 | -·[`Tagged`](source/tagged.d.ts)·-·Create·a·[tagged·type](https://medium.com/@KevinBGreene/surviving-the-typescript-ecosystem-branding-and-type-tagging-6cf6e516523d)·that·can·support·[multiple·tags](https://github.com/sindresorhus/type-fest/issues/665)·and·[per-tag·metadata](https://medium.com/@ethanresnick/advanced-typescript-tagged-types-improved-with-type-level-metadata-5072fc125fcf). | 139 | -·[`Tagged`](source/tagged.d.ts)·-·Create·a·[tagged·type](https://medium.com/@KevinBGreene/surviving-the-typescript-ecosystem-branding-and-type-tagging-6cf6e516523d)·that·can·support·[multiple·tags](https://github.com/sindresorhus/type-fest/issues/665)·and·[per-tag·metadata](https://medium.com/@ethanresnick/advanced-typescript-tagged-types-improved-with-type-level-metadata-5072fc125fcf). |
| 129 | -·[`UnwrapTagged`](source/tagged.d.ts)·-·Get·the·untagged·portion·of·a·tagged·type·created·with·`Tagged`. | 140 | -·[`UnwrapTagged`](source/tagged.d.ts)·-·Get·the·untagged·portion·of·a·tagged·type·created·with·`Tagged`. |
| 130 | -·[`InvariantOf`](source/invariant-of.d.ts)·-·Create·an·[invariant·type](https://basarat.gitbook.io/typescript/type-system/type-compatibility#footnote-invariance),·which·is·a·type·that·does·not·accept·supertypes·and·subtypes. | 141 | -·[`InvariantOf`](source/invariant-of.d.ts)·-·Create·an·[invariant·type](https://basarat.gitbook.io/typescript/type-system/type-compatibility#footnote-invariance),·which·is·a·type·that·does·not·accept·supertypes·and·subtypes. |
| 131 | -·[`SetOptional`](source/set-optional.d.ts)·-·Create·a·type·that·makes·the·given·keys·optional. | 142 | -·[`SetOptional`](source/set-optional.d.ts)·-·Create·a·type·that·makes·the·given·keys·optional,·while·keeping·the·remaining·keys·as·is. |
| 132 | -·[`SetReadonly`](source/set-readonly.d.ts)·-·Create·a·type·that·makes·the·given·keys·readonly. | 143 | -·[`SetReadonly`](source/set-readonly.d.ts)·-·Create·a·type·that·makes·the·given·keys·readonly,·while·keeping·the·remaining·keys·as·is. |
| 133 | -·[`SetRequired`](source/set-required.d.ts)·-·Create·a·type·that·makes·the·given·keys·required. | 144 | -·[`SetRequired`](source/set-required.d.ts)·-·Create·a·type·that·makes·the·given·keys·required,·while·keeping·the·remaining·keys·as·is. |
| 134 | -·[`SetRequiredDeep`](source/set-required-deep.d.ts)·-· | 145 | -·[`SetRequiredDeep`](source/set-required-deep.d.ts)·-·Create·a·type·that·makes·the·given·keys·required,·with·support·for·deeply·nested·key·paths,·while·keeping·the·remaining·keys·as·is. |
| 135 | -·[`SetNonNullable`](source/set-non-nullable.d.ts)·-·Create·a·type·that·makes·the·given·keys·non-nullable. | 146 | -·[`SetNonNullable`](source/set-non-nullable.d.ts)·-·Create·a·type·that·makes·the·given·keys·non-nullable,·while·keeping·the·remaining·keys·as·is. |
| 136 | -·[`SetNonNullableDeep`](source/set-non-nullable-deep.d.ts)·-·Create·a·type·that·makes·the·specified·keys·non-nullable·(removes·`null`·and·`undefined`),·supports·deeply·nested·key·paths,·and·leaves·all·other·keys·unchanged. | 147 | -·[`SetNonNullableDeep`](source/set-non-nullable-deep.d.ts)·-·Create·a·type·that·makes·the·specified·keys·non-nullable·(removes·`null`·and·`undefined`),·supports·deeply·nested·key·paths,·and·leaves·all·other·keys·unchanged. |
| 148 | -·[`NonNullableDeep`](source/non-nullable-deep.d.ts)·-·Recursively·removes·`null`·and·`undefined`·from·the·specified·type. | ||
| 137 | -·[`ValueOf`](source/value-of.d.ts)·-·Create·a·union·of·the·given·object's·values,·and·optionally·specify·which·keys·to·get·the·values·from. | 149 | -·[`ValueOf`](source/value-of.d.ts)·-·Create·a·union·of·the·given·object's·values,·and·optionally·specify·which·keys·to·get·the·values·from. |
| 138 | -·[`ConditionalKeys`](source/conditional-keys.d.ts)·-·Extract·keys·from·a· | 150 | -·[`ConditionalKeys`](source/conditional-keys.d.ts)·-·Extract·the·keys·from·a·type·where·the·value·type·of·the·key·extends·the·given·`Condition`. |
| 139 | -·[`ConditionalPick`](source/conditional-pick.d.ts)·-·Like·`Pick`·except·it·selects·properties·from·a·shape·where·the·values·extend·the·given·`Condition`·type. | ||
| 140 | -·[`ConditionalPickDeep`](source/conditional-pick-deep.d.ts)·-·Like·`ConditionalPick`·except·that·it·selects·the·properties·deeply. | ||
| 141 | -·[`Conditional | 151 | -·[`ConditionalPick`](source/conditional-pick.d.ts)·-·Pick·keys·from·the·shape·that·matches·the·given·`Condition`. |
| 152 | -·[`ConditionalPickDeep`](source/conditional-pick-deep.d.ts)·-·Pick·keys·recursively·from·the·shape·that·matches·the·given·condition. | ||
| 153 | -·[`ConditionalExcept`](source/conditional-except.d.ts)·-·Exclude·keys·from·a·shape·that·matches·the·given·`Condition`. | ||
| 142 | -·[`UnionToIntersection`](source/union-to-intersection.d.ts)·-·Convert·a·union·type·to·an·intersection·type. | 154 | -·[`UnionToIntersection`](source/union-to-intersection.d.ts)·-·Convert·a·union·type·to·an·intersection·type. |
| 143 | -·[`LiteralToPrimitive`](source/literal-to-primitive.d.ts)·-· | 155 | -·[`LiteralToPrimitive`](source/literal-to-primitive.d.ts)·-·Given·a·[literal·type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types)·return·the·[primitive·type](https://developer.mozilla.org/en-US/docs/Glossary/Primitive)·it·belongs·to,·or·`never`·if·it's·not·a·primitive. |
| 144 | -·[`LiteralToPrimitiveDeep`](source/literal-to-primitive-deep.d.ts)·-·Like·`LiteralToPrimitive`·except·it·converts·literal·types·inside·an·object·or·array·deeply. | 156 | -·[`LiteralToPrimitiveDeep`](source/literal-to-primitive-deep.d.ts)·-·Like·`LiteralToPrimitive`·except·it·converts·literal·types·inside·an·object·or·array·deeply. |
| 145 | -·[`Stringified`](source/stringified.d.ts)·-·Create·a·type·with·the·keys·of·the·given·type·changed·to·`string`·type. | 157 | -·[`Stringified`](source/stringified.d.ts)·-·Create·a·type·with·the·keys·of·the·given·type·changed·to·`string`·type. |
| 146 | -·[`IterableElement`](source/iterable-element.d.ts)·-·Get·the·element·type·of·an·`Iterable`/`AsyncIterable`.·For·example,·`Array`,·`Set`,·`Map`,·generator,·stream,·etc. | 158 | -·[`IterableElement`](source/iterable-element.d.ts)·-·Get·the·element·type·of·an·`Iterable`/`AsyncIterable`.·For·example,·`Array`,·`Set`,·`Map`,·generator,·stream,·etc. |
| 147 | -·[`Entry`](source/entry.d.ts)·-·Create·a·type·that·represents·the·type·of·an·entry·of·a·collection. | ||
| 148 | -·[`Entr | 159 | -·[`Entry`](source/entry.d.ts)·-·Create·a·type·that·describes·a·single·key-value·pair·produced·when·calling·a·collection’s·`entries`·method. |
| 160 | -·[`Entries`](source/entries.d.ts)·-·Create·a·type·that·describes·the·key-value·pairs·produced·when·calling·a·collection’s·`entries`·method. | ||
| 149 | -·[`SetReturnType`](source/set-return-type.d.ts)·-·Create·a·function·type·with·a·return·type·of·your·choice·and·the·same·parameters·as·the·given·function·type. | 161 | -·[`SetReturnType`](source/set-return-type.d.ts)·-·Create·a·function·type·with·a·return·type·of·your·choice·and·the·same·parameters·as·the·given·function·type. |
| 150 | -·[`SetParameterType`](source/set-parameter-type.d.ts)·-·Create·a·function·that·replaces·some·parameters·with·the·given·parameters. | 162 | -·[`SetParameterType`](source/set-parameter-type.d.ts)·-·Create·a·function·that·replaces·some·parameters·with·the·given·parameters. |
| 151 | -·[`Simplify`](source/simplify.d.ts)·-·Useful·to·flatten·the·type·output·to·improve·type·hints·shown·in·editors.·And·also·to·transform·an·interface·into·a·type·to·aide·with·assignability. | 163 | -·[`Simplify`](source/simplify.d.ts)·-·Useful·to·flatten·the·type·output·to·improve·type·hints·shown·in·editors.·And·also·to·transform·an·interface·into·a·type·to·aide·with·assignability. |
| 152 | -·[`SimplifyDeep`](source/simplify-deep.d.ts)·-·Deeply·simplifies·an·object·type. | 164 | -·[`SimplifyDeep`](source/simplify-deep.d.ts)·-·Deeply·simplifies·an·object·type. |
| 153 | -·[`Get`](source/get.d.ts)·-·Get·a·deeply-nested·property·from·an·object·using·a·key·path,·like·[Lodash's·`.get()`](https://lodash.com/docs/latest#get)·function. | 165 | -·[`Get`](source/get.d.ts)·-·Get·a·deeply-nested·property·from·an·object·using·a·key·path,·like·[Lodash's·`.get()`](https://lodash.com/docs/latest#get)·function. |
| 154 | -·[`KeyAsString`](source/key-as-string.d.ts)·-·Get·keys·of·the·given·type·as·strings. | 166 | -·[`KeyAsString`](source/key-as-string.d.ts)·-·Get·keys·of·the·given·type·as·strings. |
| 155 | -·[`Schema`](source/schema.d.ts)·-·Create·a·deep·version·of·another·object·type·where·property·values·are·recursively·replaced·into·a·given·value·type. | 167 | -·[`Schema`](source/schema.d.ts)·-·Create·a·deep·version·of·another·object·type·where·property·values·are·recursively·replaced·into·a·given·value·type. |
| 156 | -·[`Exact`](source/exact.d.ts)·-·Create·a·type·that·does·not·allow·extra·properties. | 168 | -·[`Exact`](source/exact.d.ts)·-·Create·a·type·that·does·not·allow·extra·properties,·meaning·it·only·allows·properties·that·are·explicitly·declared. |
| 157 | -·[`KeysOfUnion`](source/keys-of-union.d.ts)·-·Create·a·union·of·all·keys·from·a·given·type,·even·those·exclusive·to·specific·union·members. | 169 | -·[`KeysOfUnion`](source/keys-of-union.d.ts)·-·Create·a·union·of·all·keys·from·a·given·type,·even·those·exclusive·to·specific·union·members. |
| 158 | -·[`OptionalKeysOf`](source/optional-keys-of.d.ts)·-·Extract·all·optional·keys·from·the·given·type. | 170 | -·[`OptionalKeysOf`](source/optional-keys-of.d.ts)·-·Extract·all·optional·keys·from·the·given·type. |
| 159 | -·[`HasOptionalKeys`](source/has-optional-keys.d.ts)·-· | 171 | -·[`HasOptionalKeys`](source/has-optional-keys.d.ts)·-·Returns·a·boolean·for·whether·the·given·type·has·any·optional·fields. |
| 160 | -·[`RequiredKeysOf`](source/required-keys-of.d.ts)·-·Extract·all·required·keys·from·the·given·type. | 172 | -·[`RequiredKeysOf`](source/required-keys-of.d.ts)·-·Extract·all·required·keys·from·the·given·type. |
| 161 | -·[`HasRequiredKeys`](source/has-required-keys.d.ts)·-· | 173 | -·[`HasRequiredKeys`](source/has-required-keys.d.ts)·-·Returns·a·boolean·for·whether·the·given·type·has·any·required·fields. |
| 162 | -·[`ReadonlyKeysOf`](source/readonly-keys-of.d.ts)·-·Extract·all·readonly·keys·from·the·given·type. | 174 | -·[`ReadonlyKeysOf`](source/readonly-keys-of.d.ts)·-·Extract·all·readonly·keys·from·the·given·type. |
| 163 | -·[`HasReadonlyKeys`](source/has-readonly-keys.d.ts)·-· | 175 | -·[`HasReadonlyKeys`](source/has-readonly-keys.d.ts)·-·Returns·a·boolean·for·whether·the·given·type·has·any·readonly·fields. |
| Max diff block lines reached; 17177/33503 bytes (51.27%) of diff not shown. | |||
| Offset 65, 27 lines modified | Offset 65, 27 lines modified | ||
| 65 | @see·{@link·SharedUnionFields} | 65 | @see·{@link·SharedUnionFields} |
| 66 | @category·Object | 66 | @category·Object |
| 67 | @category·Union | 67 | @category·Union |
| 68 | */ | 68 | */ |
| 69 | export·type·AllUnionFields<Union>·= | 69 | export·type·AllUnionFields<Union>·= |
| 70 | Extract<Union,·NonRecursiveType·|·ReadonlyMap<unknown,·unknown>·|·ReadonlySet<unknown>·|·UnknownArray>·extends·infer·SkippedMembers | 70 | » Extract<Union,·NonRecursiveType·|·ReadonlyMap<unknown,·unknown>·|·ReadonlySet<unknown>·|·UnknownArray>·extends·infer·SkippedMembers |
| 71 | » ?·Exclude<Union,·SkippedMembers>·extends·infer·RelevantMembers | 71 | » » ?·Exclude<Union,·SkippedMembers>·extends·infer·RelevantMembers |
| 72 | » » ? | 72 | » » » ?·//·eslint-disable-line·@stylistic/operator-linebreak |
| 73 | » » |·SkippedMembers | 73 | » » » |·SkippedMembers |
| 74 | » » |·Simplify< | 74 | » » » |·Simplify< |
| 75 | » » //·Include·fields·that·are·common·in·all·union·members | 75 | » » » » //·Include·fields·that·are·common·in·all·union·members |
| 76 | » » » SharedUnionFields<RelevantMembers> | 76 | » » » » SharedUnionFields<RelevantMembers> |
| 77 | » » //·Include·readonly·fields·present·in·any·union·member | 77 | » » » » //·Include·readonly·fields·present·in·any·union·member |
| 78 | » » » { | 78 | » » » » &·{ |
| 79 | » » » » readonly·[P·in·ReadonlyKeysOfUnion<RelevantMembers>]?:·ValueOfUnion<RelevantMembers,·P·&·KeysOfUnion<RelevantMembers>> | 79 | » » » » » readonly·[P·in·ReadonlyKeysOfUnion<RelevantMembers>]?:·ValueOfUnion<RelevantMembers,·P·&·KeysOfUnion<RelevantMembers>> |
| 80 | » » » | 80 | » » » » } |
| 81 | » » //·Include·remaining·fields·that·are·neither·common·nor·readonly | 81 | » » » » //·Include·remaining·fields·that·are·neither·common·nor·readonly |
| 82 | » » » { | 82 | » » » » &·{ |
| 83 | » » » » [P·in·Exclude<KeysOfUnion<RelevantMembers>,·ReadonlyKeysOfUnion<RelevantMembers>·|·keyof·RelevantMembers>]?:·ValueOfUnion<RelevantMembers,·P> | 83 | » » » » » [P·in·Exclude<KeysOfUnion<RelevantMembers>,·ReadonlyKeysOfUnion<RelevantMembers>·|·keyof·RelevantMembers>]?:·ValueOfUnion<RelevantMembers,·P> |
| 84 | » » » } | 84 | » » » » } |
| 85 | » » > | 85 | » » » > |
| 86 | » » :·never | 86 | » » » :·never |
| 87 | » :·never; | 87 | » » :·never; |
| 88 | export·{}; | 88 | export·{}; |
| Offset 1, 11 lines modified | Offset 1, 11 lines modified | ||
| 1 | import·type·{AndAll}·from·'./and-all.d.ts'; | 1 | import·type·{AndAll}·from·'./and-all.d.ts'; |
| 2 | /** | 2 | /** |
| 3 | Returns·a·boolean·for·whether·two·given·types·are·both·true. | 3 | Returns·a·boolean·for·whether·two·given·types·are·both·`true`. |
| 4 | Use-case:·Constructing·complex·conditional·types·where·multiple·conditions·must·be·satisfied. | 4 | Use-case:·Constructing·complex·conditional·types·where·multiple·conditions·must·be·satisfied. |
| 5 | @example | 5 | @example |
| 6 | ``` | 6 | ``` |
| 7 | import·type·{And}·from·'type-fest'; | 7 | import·type·{And}·from·'type-fest'; |
| Offset 4, 49 lines modified | Offset 4, 49 lines modified | ||
| 4 | import·type·{UnknownArray}·from·'./unknown-array.d.ts'; | 4 | import·type·{UnknownArray}·from·'./unknown-array.d.ts'; |
| 5 | import·type·{TupleOf}·from·'./tuple-of.d.ts'; | 5 | import·type·{TupleOf}·from·'./tuple-of.d.ts'; |
| 6 | /** | 6 | /** |
| 7 | The·implementation·of·`SplitArrayByIndex`·for·fixed·length·arrays. | 7 | The·implementation·of·`SplitArrayByIndex`·for·fixed·length·arrays. |
| 8 | */ | 8 | */ |
| 9 | type·SplitFixedArrayByIndex<T·extends·UnknownArray,·SplitIndex·extends·number>·= | 9 | type·SplitFixedArrayByIndex<T·extends·UnknownArray,·SplitIndex·extends·number>·= |
| 10 | SplitIndex·extends·0 | 10 | » SplitIndex·extends·0 |
| 11 | » ?·[[],·T] | 11 | » » ?·[[],·T] |
| 12 | » :·T·extends·readonly·[...TupleOf<SplitIndex>,·...infer·V] | 12 | » » :·T·extends·readonly·[...TupleOf<SplitIndex>,·...infer·V] |
| 13 | » » ?·T·extends·readonly·[...infer·U,·...V] | 13 | » » » ?·T·extends·readonly·[...infer·U,·...V] |
| 14 | » » » ?·[U,·V] | 14 | » » » » ?·[U,·V] |
| 15 | » » » :·[never,·never] | 15 | » » » » :·[never,·never] |
| 16 | » » :·[never,·never]; | 16 | » » » :·[never,·never]; |
| 17 | /** | 17 | /** |
| 18 | The·implementation·of·`SplitArrayByIndex`·for·variable·length·arrays. | 18 | The·implementation·of·`SplitArrayByIndex`·for·variable·length·arrays. |
| 19 | */ | 19 | */ |
| 20 | type·SplitVariableArrayByIndex<T·extends·UnknownArray, | 20 | type·SplitVariableArrayByIndex<T·extends·UnknownArray, |
| 21 | » SplitIndex·extends·number, | 21 | » SplitIndex·extends·number, |
| 22 | » T1·=·Subtract<SplitIndex,·StaticPartOfArray<T>['length']>, | 22 | » T1·=·Subtract<SplitIndex,·StaticPartOfArray<T>['length']>, |
| 23 | » T2·=·T1·extends·number | 23 | » T2·=·T1·extends·number |
| 24 | » » ?·TupleOf<GreaterThanOrEqual<T1,·0>·extends·true·?·T1·:·number,·VariablePartOfArray<T>[number]> | 24 | » » ?·TupleOf<GreaterThanOrEqual<T1,·0>·extends·true·?·T1·:·number,·VariablePartOfArray<T>[number]> |
| 25 | » » :·[], | 25 | » » :·[], |
| 26 | >·= | 26 | >·= |
| 27 | SplitIndex·extends·0 | 27 | » SplitIndex·extends·0 |
| 28 | » ?·[[],·T] | 28 | » » ?·[[],·T] |
| 29 | » :·GreaterThanOrEqual<StaticPartOfArray<T>['length'],·SplitIndex>·extends·true | 29 | » » :·GreaterThanOrEqual<StaticPartOfArray<T>['length'],·SplitIndex>·extends·true |
| 30 | » » ?·[ | 30 | » » » ?·[ |
| 31 | » » » SplitFixedArrayByIndex<StaticPartOfArray<T>,·SplitIndex>[0], | 31 | » » » » SplitFixedArrayByIndex<StaticPartOfArray<T>,·SplitIndex>[0], |
| 32 | » » » [ | 32 | » » » » [ |
| 33 | » » » » ...SplitFixedArrayByIndex<StaticPartOfArray<T>,·SplitIndex>[1], | 33 | » » » » » ...SplitFixedArrayByIndex<StaticPartOfArray<T>,·SplitIndex>[1], |
| 34 | » » » » ...VariablePartOfArray<T>, | 34 | » » » » » ...VariablePartOfArray<T>, |
| 35 | » » » ], | 35 | » » » » ], |
| 36 | » » ] | 36 | » » » ] |
| 37 | » » :·[ | 37 | » » » :·[ |
| 38 | » » » [ | 38 | » » » » [ |
| 39 | » » » » ...StaticPartOfArray<T>, | 39 | » » » » » ...StaticPartOfArray<T>, |
| 40 | » » » » ...(T2·extends·UnknownArray·?·T2·:·[]), | 40 | » » » » » ...(T2·extends·UnknownArray·?·T2·:·[]), |
| 41 | » » » ], | 41 | » » » » ], |
| 42 | » » » VariablePartOfArray<T>, | 42 | » » » » VariablePartOfArray<T>, |
| 43 | » » ]; | 43 | » » » ]; |
| 44 | /** | 44 | /** |
| 45 | Split·the·given·array·`T`·by·the·given·`SplitIndex`. | 45 | Split·the·given·array·`T`·by·the·given·`SplitIndex`. |
| 46 | @example | 46 | @example |
| 47 | ``` | 47 | ``` |
| 48 | type·A·=·SplitArrayByIndex<[1,·2,·3,·4],·2>; | 48 | type·A·=·SplitArrayByIndex<[1,·2,·3,·4],·2>; |
| Offset 1, 30 lines modified | Offset 1, 56 lines modified | ||
| 1 | import·type·{ApplyDefaultOptions}·from·'./internal/index.d.ts'; | 1 | import·type·{ApplyDefaultOptions}·from·'./internal/index.d.ts'; |
| 2 | import·type·{Words,·WordsOptions}·from·'./words.d.ts'; | 2 | import·type·{_DefaultWordsOptions,·Words,·WordsOptions}·from·'./words.d.ts'; |
| 3 | /** | 3 | /** |
| 4 | CamelCase·options. | 4 | CamelCase·options. |
| 5 | @see·{@link·CamelCase} | 5 | @see·{@link·CamelCase} |
| 6 | */ | 6 | */ |
| 7 | export·type·CamelCaseOptions·=·WordsOptions·&·{ | 7 | export·type·CamelCaseOptions·=·WordsOptions·&·{ |
| 8 | » /** | 8 | » /** |
| 9 | » Whether·to·preserved·consecutive·uppercase·letter. | 9 | » Whether·to·preserved·consecutive·uppercase·letter. |
| 10 | » @default·false | 10 | » @default·false |
| 11 | » */ | 11 | » */ |
| 12 | » preserveConsecutiveUppercase?:·boolean; | 12 | » preserveConsecutiveUppercase?:·boolean; |
| 13 | » /** | ||
| 14 | » Whether·to·preserve·leading·underscores. | ||
| 15 | » This·matches·the·behavior·of·the·[`camelcase`](https://github.com/sindresorhus/camelcase)·package·v9+. | ||
| 16 | » @default·false | ||
| 17 | » */ | ||
| 18 | » preserveLeadingUnderscores?:·boolean; | ||
| 13 | }; | 19 | }; |
| 14 | export·type·_DefaultCamelCaseOptions·=·{ | 20 | export·type·_DefaultCamelCaseOptions·=·_DefaultWordsOptions·&·{ |
| 15 | » splitOnNumbers:·true; | ||
| 16 | » preserveConsecutiveUppercase:·false; | 21 | » preserveConsecutiveUppercase:·false; |
| 22 | » preserveLeadingUnderscores:·false; | ||
| 17 | }; | 23 | }; |
| 18 | /** | 24 | /** |
| 25 | Extract·leading·underscores·from·a·string. | ||
| 26 | @example | ||
| 27 | ``` | ||
| 28 | type·A·=·LeadingUnderscores<'__foo_bar'>; | ||
| 29 | //=>·'__' | ||
| 30 | type·B·=·LeadingUnderscores<'foo_bar'>; | ||
| 31 | //=>·'' | ||
| 32 | ``` | ||
| 33 | */ | ||
| 34 | type·LeadingUnderscores<Type·extends·string,·Underscores·extends·string·=·''>·= | ||
| 35 | » Type·extends·`_${infer·Rest}` | ||
| 36 | » » ?·LeadingUnderscores<Rest,·`_${Underscores}`> | ||
| 37 | » » :·Underscores; | ||
| 38 | /** | ||
| 19 | Convert·an·array·of·words·to·camel-case. | 39 | Convert·an·array·of·words·to·camel-case. |
| 20 | */ | 40 | */ |
| 21 | type·CamelCaseFromArray< | 41 | type·CamelCaseFromArray< |
| 22 | » Words·extends·string[], | 42 | » Words·extends·string[], |
| 23 | » Options·extends·Required<CamelCaseOptions>, | 43 | » Options·extends·Required<CamelCaseOptions>, |
| 24 | » OutputString·extends·string·=·'', | 44 | » OutputString·extends·string·=·'', |
| 25 | >·=·Words·extends·[ | 45 | >·=·Words·extends·[ |
| Offset 39, 22 lines modified | Offset 65, 26 lines modified | ||
| 39 | /** | 65 | /** |
| 40 | Convert·a·string·literal·to·camel-case. | 66 | Convert·a·string·literal·to·camel-case. |
| 41 | This·can·be·useful·when,·for·example,·converting·some·kebab-cased·command-line·flags·or·a·snake-cased·database·result. | 67 | This·can·be·useful·when,·for·example,·converting·some·kebab-cased·command-line·flags·or·a·snake-cased·database·result. |
| 42 | By·default,·consecutive·uppercase·letter·are·preserved.·See·{@link·CamelCaseOptions.preserveConsecutiveUppercase·preserveConsecutiveUppercase}·option·to·change·this·behaviour. | 68 | By·default,·consecutive·uppercase·letter·are·preserved.·See·{@link·CamelCaseOptions.preserveConsecutiveUppercase·preserveConsecutiveUppercase}·option·to·change·this·behaviour. |
| 69 | Use·the·`preserveLeadingUnderscores`·option·to·retain·leading·underscores,·matching·the·runtime·behavior·of·[`camelcase`](https://github.com/sindresorhus/camelcase)·v9+. | ||
| 43 | @example | 70 | @example |
| 44 | ``` | 71 | ``` |
| 45 | import·type·{CamelCase}·from·'type-fest'; | 72 | import·type·{CamelCase}·from·'type-fest'; |
| 46 | //·Simple | 73 | //·Simple |
| 47 | const·someVariable:·CamelCase<'foo-bar'>·=·'fooBar'; | 74 | const·someVariable:·CamelCase<'foo-bar'>·=·'fooBar'; |
| 48 | const·preserveConsecutiveUppercase:·CamelCase<'foo-BAR-baz',·{preserveConsecutiveUppercase:·true}>·=·'fooBARBaz'; | 75 | const·preserveConsecutiveUppercase:·CamelCase<'foo-BAR-baz',·{preserveConsecutiveUppercase:·true}>·=·'fooBARBaz'; |
| 76 | const·splitOnPunctuation:·CamelCase<'foo-bar:BAZ',·{splitOnPunctuation:·true}>·=·'fooBarBaz'; | ||
| 77 | const·preserveLeadingUnderscores:·CamelCase<'_foo_bar',·{preserveLeadingUnderscores:·true}>·=·'_fooBar'; | ||
| 49 | //·Advanced | 78 | //·Advanced |
| 50 | type·CamelCasedProperties<T>·=·{ | 79 | type·CamelCasedProperties<T>·=·{ |
| 51 | » [K·in·keyof·T·as·CamelCase<K>]:·T[K] | 80 | » [K·in·keyof·T·as·CamelCase<K>]:·T[K] |
| 52 | }; | 81 | }; |
| Offset 79, 14 lines modified | Offset 109, 17 lines modified | ||
| 79 | @category·Change·case | 109 | @category·Change·case |
| 80 | @category·Template·literal | 110 | @category·Template·literal |
| 81 | */ | 111 | */ |
| 82 | export·type·CamelCase<Type,·Options·extends·CamelCaseOptions·=·{}>·=·Type·extends·string | 112 | export·type·CamelCase<Type,·Options·extends·CamelCaseOptions·=·{}>·=·Type·extends·string |
| 83 | » ?·string·extends·Type | 113 | » ?·string·extends·Type |
| 84 | » » ?·Type | 114 | » » ?·Type |
| 115 | » » :·`${Options['preserveLeadingUnderscores']·extends·true | ||
| 116 | » » » ?·LeadingUnderscores<Type> | ||
| 117 | » » » :·'' | ||
| 85 | » » | 118 | » » }${Uncapitalize<CamelCaseFromArray< |
| 86 | » » » Words<Type·extends·Uppercase<Type>·?·Lowercase<Type>·:·Type,·Options>, | 119 | » » » Words<Type·extends·Uppercase<Type>·?·Lowercase<Type>·:·Type,·Options>, |
| 87 | » » » ApplyDefaultOptions<CamelCaseOptions,·_DefaultCamelCaseOptions,·Options> | 120 | » » » ApplyDefaultOptions<CamelCaseOptions,·_DefaultCamelCaseOptions,·Options> |
| 88 | » » >> | 121 | » » >>}` |
| Max diff block lines reached; 14/3107 bytes (0.45%) of diff not shown. | |||
| Offset 44, 14 lines modified | Offset 44, 21 lines modified | ||
| 44 | const·preserveConsecutiveUppercase:·CamelCasedPropertiesDeep<{fooBAR:·{fooBARBiz:·[{fooBARBaz:·string}]}},·{preserveConsecutiveUppercase:·true}>·=·{ | 44 | const·preserveConsecutiveUppercase:·CamelCasedPropertiesDeep<{fooBAR:·{fooBARBiz:·[{fooBARBaz:·string}]}},·{preserveConsecutiveUppercase:·true}>·=·{ |
| 45 | » fooBAR:·{ | 45 | » fooBAR:·{ |
| 46 | » » fooBARBiz:·[{ | 46 | » » fooBARBiz:·[{ |
| 47 | » » » fooBARBaz:·'string', | 47 | » » » fooBARBaz:·'string', |
| 48 | » » }], | 48 | » » }], |
| 49 | » }, | 49 | » }, |
| 50 | }; | 50 | }; |
| 51 | const·splitOnPunctuation:·CamelCasedPropertiesDeep<{'user@info':·{'user::id':·number;·'user::name':·string}},·{splitOnPunctuation:·true}>·=·{ | ||
| 52 | » userInfo:·{ | ||
| 53 | » » userId:·1, | ||
| 54 | » » userName:·'Tom', | ||
| 55 | » }, | ||
| 56 | }; | ||
| 51 | ``` | 57 | ``` |
| 52 | @category·Change·case | 58 | @category·Change·case |
| 53 | @category·Template·literal | 59 | @category·Template·literal |
| 54 | @category·Object | 60 | @category·Object |
| 55 | */ | 61 | */ |
| 56 | export·type·CamelCasedPropertiesDeep< | 62 | export·type·CamelCasedPropertiesDeep< |
| Offset 82, 18 lines modified | Offset 89, 18 lines modified | ||
| 82 | >·=·Value·extends·[] | 89 | >·=·Value·extends·[] |
| 83 | » ?·[] | 90 | » ?·[] |
| 84 | » //·Trailing·spread·array | 91 | » //·Trailing·spread·array |
| 85 | » :·Value·extends·[infer·U,·...infer·V] | 92 | » :·Value·extends·[infer·U,·...infer·V] |
| 86 | » » ?·[_CamelCasedPropertiesDeep<U,·Options>,·..._CamelCasedPropertiesDeep<V,·Options>] | 93 | » » ?·[_CamelCasedPropertiesDeep<U,·Options>,·..._CamelCasedPropertiesDeep<V,·Options>] |
| 87 | » » :·Value·extends·readonly·[infer·U,·...infer·V] | 94 | » » :·Value·extends·readonly·[infer·U,·...infer·V] |
| 88 | » » » ?·readonly·[_CamelCasedPropertiesDeep<U,·Options>,·..._CamelCasedPropertiesDeep<V,·Options>] | 95 | » » » ?·readonly·[_CamelCasedPropertiesDeep<U,·Options>,·..._CamelCasedPropertiesDeep<V,·Options>] |
| 89 | » » » | 96 | » » » //·Leading·spread·array |
| 90 | » » » Value·extends·readonly·[...infer·U,·infer·V] | 97 | » » » :·Value·extends·readonly·[...infer·U,·infer·V] |
| 91 | » » » » ?·[..._CamelCasedPropertiesDeep<U,·Options>,·_CamelCasedPropertiesDeep<V,·Options>] | 98 | » » » » ?·[..._CamelCasedPropertiesDeep<U,·Options>,·_CamelCasedPropertiesDeep<V,·Options>] |
| 92 | » » » » | 99 | » » » » //·Array |
| 93 | » » » » Value·extends·Array<infer·U> | 100 | » » » » :·Value·extends·Array<infer·U> |
| 94 | » » » » » ?·Array<_CamelCasedPropertiesDeep<U,·Options>> | 101 | » » » » » ?·Array<_CamelCasedPropertiesDeep<U,·Options>> |
| 95 | » » » » » :·Value·extends·ReadonlyArray<infer·U> | 102 | » » » » » :·Value·extends·ReadonlyArray<infer·U> |
| 96 | » » » » » » ?·ReadonlyArray<_CamelCasedPropertiesDeep<U,·Options>> | 103 | » » » » » » ?·ReadonlyArray<_CamelCasedPropertiesDeep<U,·Options>> |
| 97 | » » » » » » :·never; | 104 | » » » » » » :·never; |
| 98 | export·{}; | 105 | export·{}; |
| Offset 1, 12 lines modified | Offset 1, 12 lines modified | ||
| 1 | import·type·{CamelCase,·CamelCaseOptions,·_DefaultCamelCaseOptions}·from·'./camel-case.d.ts'; | 1 | import·type·{CamelCase,·CamelCaseOptions,·_DefaultCamelCaseOptions}·from·'./camel-case.d.ts'; |
| 2 | import·type·{ApplyDefaultOptions}·from·'./internal/index.d.ts'; | 2 | import·type·{ApplyDefaultOptions}·from·'./internal/index.d.ts'; |
| 3 | /** | 3 | /** |
| 4 | Convert·object·properties·to·camel·ca | 4 | Convert·top-level·object·properties·to·camel·case. |
| 5 | This·can·be·useful·when,·for·example,·converting·some·API·types·from·a·different·style. | 5 | This·can·be·useful·when,·for·example,·converting·some·API·types·from·a·different·style. |
| 6 | @see·{@link·CamelCasedPropertiesDeep} | 6 | @see·{@link·CamelCasedPropertiesDeep} |
| 7 | @see·{@link·CamelCase} | 7 | @see·{@link·CamelCase} |
| 8 | @example | 8 | @example |
| Offset 22, 14 lines modified | Offset 22, 18 lines modified | ||
| 22 | » userId:·1, | 22 | » userId:·1, |
| 23 | » userName:·'Tom', | 23 | » userName:·'Tom', |
| 24 | }; | 24 | }; |
| 25 | const·preserveConsecutiveUppercase:·CamelCasedProperties<{fooBAR:·string},·{preserveConsecutiveUppercase:·true}>·=·{ | 25 | const·preserveConsecutiveUppercase:·CamelCasedProperties<{fooBAR:·string},·{preserveConsecutiveUppercase:·true}>·=·{ |
| 26 | » fooBAR:·'string', | 26 | » fooBAR:·'string', |
| 27 | }; | 27 | }; |
| 28 | const·splitOnPunctuation:·CamelCasedProperties<{'foo::bar':·string},·{splitOnPunctuation:·true}>·=·{ | ||
| 29 | » fooBar:·'string', | ||
| 30 | }; | ||
| 28 | ``` | 31 | ``` |
| 29 | @category·Change·case | 32 | @category·Change·case |
| 30 | @category·Template·literal | 33 | @category·Template·literal |
| 31 | @category·Object | 34 | @category·Object |
| 32 | */ | 35 | */ |
| 33 | export·type·CamelCasedProperties<Value,·Options·extends·CamelCaseOptions·=·{}>·=·Value·extends·Function | 36 | export·type·CamelCasedProperties<Value,·Options·extends·CamelCaseOptions·=·{}>·=·Value·extends·Function |
| Offset 34, 14 lines modified | Offset 34, 15 lines modified | ||
| 34 | ``` | 34 | ``` |
| 35 | import·type·{DelimiterCase}·from·'type-fest'; | 35 | import·type·{DelimiterCase}·from·'type-fest'; |
| 36 | //·Simple | 36 | //·Simple |
| 37 | const·someVariable:·DelimiterCase<'fooBar',·'#'>·=·'foo#bar'; | 37 | const·someVariable:·DelimiterCase<'fooBar',·'#'>·=·'foo#bar'; |
| 38 | const·someVariableNoSplitOnNumbers:·DelimiterCase<'p2pNetwork',·'#',·{splitOnNumbers:·false}>·=·'p2p#network'; | 38 | const·someVariableNoSplitOnNumbers:·DelimiterCase<'p2pNetwork',·'#',·{splitOnNumbers:·false}>·=·'p2p#network'; |
| 39 | const·someVariableWithPunctuation:·DelimiterCase<'div.card::after',·'#',·{splitOnPunctuation:·true}>·=·'div#card#after'; | ||
| 39 | //·Advanced | 40 | //·Advanced |
| 40 | type·OddlyCasedProperties<T>·=·{ | 41 | type·OddlyCasedProperties<T>·=·{ |
| 41 | » [K·in·keyof·T·as·DelimiterCase<K,·'#'>]:·T[K] | 42 | » [K·in·keyof·T·as·DelimiterCase<K,·'#'>]:·T[K] |
| 42 | }; | 43 | }; |
| Offset 1, 14 lines modified | Offset 1, 14 lines modified | ||
| 1 | import·type·{_DefaultDelimiterCaseOptions,·DelimiterCase}·from·'./delimiter-case.d.ts'; | 1 | import·type·{_DefaultDelimiterCaseOptions,·DelimiterCase}·from·'./delimiter-case.d.ts'; |
| 2 | import·type·{ApplyDefaultOptions,·NonRecursiveType}·from·'./internal/index.d.ts'; | 2 | import·type·{ApplyDefaultOptions,·NonRecursiveType}·from·'./internal/index.d.ts'; |
| 3 | import·type·{UnknownArray}·from·'./unknown-array.d.ts'; | 3 | import·type·{UnknownArray}·from·'./unknown-array.d.ts'; |
| 4 | import·type·{WordsOptions}·from·'./words.d.ts'; | 4 | import·type·{WordsOptions}·from·'./words.d.ts'; |
| 5 | /** | 5 | /** |
| 6 | Convert·object·properties·to·delimiter·cas | 6 | Convert·object·properties·to·a·custom·string·delimiter·casing·recursively. |
| 7 | This·can·be·useful·when,·for·example,·converting·some·API·types·from·a·different·style. | 7 | This·can·be·useful·when,·for·example,·converting·some·API·types·from·a·different·style. |
| 8 | @see·{@link·DelimiterCase} | 8 | @see·{@link·DelimiterCase} |
| 9 | @see·{@link·DelimiterCasedProperties} | 9 | @see·{@link·DelimiterCasedProperties} |
| 10 | @example | 10 | @example |
| Offset 47, 14 lines modified | Offset 47, 21 lines modified | ||
| 47 | » » 'line-2':·[ | 47 | » » 'line-2':·[ |
| 48 | » » » { | 48 | » » » { |
| 49 | » » » » 'line-3':·'string', | 49 | » » » » 'line-3':·'string', |
| 50 | » » » }, | 50 | » » » }, |
| 51 | » » ], | 51 | » » ], |
| 52 | » }, | 52 | » }, |
| 53 | }; | 53 | }; |
| 54 | const·splitOnPunctuation:·DelimiterCasedPropertiesDeep<{'user@info':·{'user::id':·number;·'user::name':·string}},·'-',·{splitOnPunctuation:·true}>·=·{ | ||
| 55 | » 'user-info':·{ | ||
| 56 | » » 'user-id':·1, | ||
| 57 | » » 'user-name':·'Tom', | ||
| 58 | » }, | ||
| 59 | }; | ||
| 54 | ``` | 60 | ``` |
| 55 | @category·Change·case | 61 | @category·Change·case |
| 56 | @category·Template·literal | 62 | @category·Template·literal |
| 57 | @category·Object | 63 | @category·Object |
| 58 | */ | 64 | */ |
| 59 | export·type·DelimiterCasedPropertiesDeep< | 65 | export·type·DelimiterCasedPropertiesDeep< |
| Offset 1, 13 lines modified | Offset 1, 13 lines modified | ||
| 1 | import·type·{_DefaultDelimiterCaseOptions,·DelimiterCase}·from·'./delimiter-case.d.ts'; | 1 | import·type·{_DefaultDelimiterCaseOptions,·DelimiterCase}·from·'./delimiter-case.d.ts'; |
| 2 | import·type·{ApplyDefaultOptions}·from·'./internal/index.d.ts'; | 2 | import·type·{ApplyDefaultOptions}·from·'./internal/index.d.ts'; |
| 3 | import·type·{WordsOptions}·from·'./words.d.ts'; | 3 | import·type·{WordsOptions}·from·'./words.d.ts'; |
| 4 | /** | 4 | /** |
| 5 | Convert·object·properties·to· | 5 | Convert·object·properties·to·a·custom·string·delimiter·casing. |
| 6 | This·can·be·useful·when,·for·example,·converting·some·API·types·from·a·different·style. | 6 | This·can·be·useful·when,·for·example,·converting·some·API·types·from·a·different·style. |
| 7 | @see·{@link·DelimiterCase} | 7 | @see·{@link·DelimiterCase} |
| 8 | @see·{@link·DelimiterCasedPropertiesDeep} | 8 | @see·{@link·DelimiterCasedPropertiesDeep} |
| 9 | @example | 9 | @example |
| Offset 23, 14 lines modified | Offset 23, 18 lines modified | ||
| 23 | » 'user-id':·1, | 23 | » 'user-id':·1, |
| 24 | » 'user-name':·'Tom', | 24 | » 'user-name':·'Tom', |
| 25 | }; | 25 | }; |
| 26 | const·splitOnNumbers:·DelimiterCasedProperties<{line1:·string},·'-',·{splitOnNumbers:·true}>·=·{ | 26 | const·splitOnNumbers:·DelimiterCasedProperties<{line1:·string},·'-',·{splitOnNumbers:·true}>·=·{ |
| 27 | » 'line-1':·'string', | 27 | » 'line-1':·'string', |
| 28 | }; | 28 | }; |
| 29 | const·splitOnPunctuation:·DelimiterCasedProperties<{'foo::bar':·string},·'-',·{splitOnPunctuation:·true}>·=·{ | ||
| 30 | » 'foo-bar':·'string', | ||
| 31 | }; | ||
| 29 | ``` | 32 | ``` |
| 30 | @category·Change·case | 33 | @category·Change·case |
| 31 | @category·Template·literal | 34 | @category·Template·literal |
| 32 | @category·Object | 35 | @category·Object |
| 33 | */ | 36 | */ |
| 34 | export·type·DelimiterCasedProperties< | 37 | export·type·DelimiterCasedProperties< |
| Offset 28, 15 lines modified | Offset 28, 15 lines modified | ||
| 28 | Unfortunately,·`Record<string,·never>`,·`Record<keyof·any,·never>`·and·`Record<never,·never>`·do·not·work.·See·{@link·https://github.com/sindresorhus/type-fest/issues/395·#395}. | 28 | Unfortunately,·`Record<string,·never>`,·`Record<keyof·any,·never>`·and·`Record<never,·never>`·do·not·work.·See·{@link·https://github.com/sindresorhus/type-fest/issues/395·#395}. |
| 29 | @category·Object | 29 | @category·Object |
| 30 | */ | 30 | */ |
| 31 | export·type·EmptyObject·=·{[emptyObjectSymbol]?:·never}; | 31 | export·type·EmptyObject·=·{[emptyObjectSymbol]?:·never}; |
| 32 | /** | 32 | /** |
| 33 | Returns·a· | 33 | Returns·a·boolean·for·whether·the·type·is·strictly·equal·to·an·empty·plain·object,·the·`{}`·value. |
| 34 | @example | 34 | @example |
| 35 | ``` | 35 | ``` |
| 36 | import·type·{IsEmptyObject}·from·'type-fest'; | 36 | import·type·{IsEmptyObject}·from·'type-fest'; |
| 37 | type·Pass·=·IsEmptyObject<{}>;·//=>·true | 37 | type·Pass·=·IsEmptyObject<{}>;·//=>·true |
| 38 | type·Fail1·=·IsEmptyObject<[]>;·//=>·false | 38 | type·Fail1·=·IsEmptyObject<[]>;·//=>·false |
| Offset 2, 15 lines modified | Offset 2, 15 lines modified | ||
| 2 | type·ArrayEntries<BaseType·extends·readonly·unknown[]>·=·Array<_ArrayEntry<BaseType>>; | 2 | type·ArrayEntries<BaseType·extends·readonly·unknown[]>·=·Array<_ArrayEntry<BaseType>>; |
| 3 | type·MapEntries<BaseType>·=·Array<_MapEntry<BaseType>>; | 3 | type·MapEntries<BaseType>·=·Array<_MapEntry<BaseType>>; |
| 4 | type·ObjectEntries<BaseType>·=·Array<_ObjectEntry<BaseType>>; | 4 | type·ObjectEntries<BaseType>·=·Array<_ObjectEntry<BaseType>>; |
| 5 | type·SetEntries<BaseType·extends·Set<unknown>>·=·Array<_SetEntry<BaseType>>; | 5 | type·SetEntries<BaseType·extends·Set<unknown>>·=·Array<_SetEntry<BaseType>>; |
| 6 | /** | 6 | /** |
| 7 | 7 | Create·a·type·that·describes·the·key-value·pairs·produced·when·calling·a·collection’s·`entries`·method. | |
| 8 | For·example·the·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries|`Object`},·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/entries|`Map`},·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/entries|`Array`},·and·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/entries|`Set`}·collections·all·have·this·method.·Note·that·`WeakMap`·and·`WeakSet`·do·not·have·this·method·since·their·entries·are·not·enumerable. | 8 | For·example·the·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries|`Object`},·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/entries|`Map`},·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/entries|`Array`},·and·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/entries|`Set`}·collections·all·have·this·method.·Note·that·`WeakMap`·and·`WeakSet`·do·not·have·this·method·since·their·entries·are·not·enumerable. |
| 9 | @see·`Entry`·if·you·want·to·just·access·the·type·of·a·single·entry. | 9 | @see·`Entry`·if·you·want·to·just·access·the·type·of·a·single·entry. |
| 10 | @example | 10 | @example |
| 11 | ``` | 11 | ``` |
| Offset 1, 1 lines modified | Offset 1, 1 lines modified | ||
| 1 | u | 1 | utf-8 |
| Offset 3, 15 lines modified | Offset 3, 15 lines modified | ||
| 3 | export·type·_ArrayEntry<BaseType·extends·readonly·unknown[]>·=·[number,·BaseType[number]]; | 3 | export·type·_ArrayEntry<BaseType·extends·readonly·unknown[]>·=·[number,·BaseType[number]]; |
| 4 | export·type·_MapEntry<BaseType>·=·[MapKey<BaseType>,·MapValue<BaseType>]; | 4 | export·type·_MapEntry<BaseType>·=·[MapKey<BaseType>,·MapValue<BaseType>]; |
| 5 | export·type·_ObjectEntry<BaseType>·=·[keyof·BaseType,·BaseType[keyof·BaseType]]; | 5 | export·type·_ObjectEntry<BaseType>·=·[keyof·BaseType,·BaseType[keyof·BaseType]]; |
| 6 | export·type·_SetEntry<BaseType>·=·BaseType·extends·Set<infer·ItemType>·?·[ItemType,·ItemType]·:·never; | 6 | export·type·_SetEntry<BaseType>·=·BaseType·extends·Set<infer·ItemType>·?·[ItemType,·ItemType]·:·never; |
| 7 | /** | 7 | /** |
| 8 | 8 | Create·a·type·that·describes·a·single·key-value·pair·produced·when·calling·a·collection’s·`entries`·method. | |
| 9 | For·example·the·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries|`Object`},·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/entries|`Map`},·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/entries|`Array`},·and·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/entries|`Set`}·collections·all·have·this·method.·Note·that·`WeakMap`·and·`WeakSet`·do·not·have·this·method·since·their·entries·are·not·enumerable. | 9 | For·example·the·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries|`Object`},·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/entries|`Map`},·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/entries|`Array`},·and·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/entries|`Set`}·collections·all·have·this·method.·Note·that·`WeakMap`·and·`WeakSet`·do·not·have·this·method·since·their·entries·are·not·enumerable. |
| 10 | @see·`Entries`·if·you·want·to·just·access·the·type·of·the·array·of·entries·(which·is·the·return·of·the·`.entries()`·method). | 10 | @see·`Entries`·if·you·want·to·just·access·the·type·of·the·array·of·entries·(which·is·the·return·of·the·`.entries()`·method). |
| 11 | @example | 11 | @example |
| 12 | ``` | 12 | ``` |
| Offset 1, 1 lines modified | Offset 1, 1 lines modified | ||
| 1 | u | 1 | utf-8 |
| Offset 157, 15 lines modified | Offset 157, 15 lines modified | ||
| 157 | » » » » » ) | 157 | » » » » » ) |
| 158 | » » » » » :·Key·extends·keyof·WithStringKeys<BaseType> | 158 | » » » » » :·Key·extends·keyof·WithStringKeys<BaseType> |
| 159 | » » » » » » ?·StrictPropertyOf<WithStringKeys<BaseType>,·Key,·Options> | 159 | » » » » » » ?·StrictPropertyOf<WithStringKeys<BaseType>,·Key,·Options> |
| 160 | » » » » » » :·unknown; | 160 | » » » » » » :·unknown; |
| 161 | //·This·works·by·first·splitting·the·path·based·on·`.`·and·`[...]`·characters·into·a·tuple·of·string·keys.·Then·it·recursively·uses·the·head·key·to·get·the·next·property·of·the·current·object,·until·there·are·no·keys·left.·Number·keys·extract·the·item·type·from·arrays,·or·are·converted·to·strings·to·extract·types·from·tuples·and·dictionaries·with·number·keys. | 161 | //·This·works·by·first·splitting·the·path·based·on·`.`·and·`[...]`·characters·into·a·tuple·of·string·keys.·Then·it·recursively·uses·the·head·key·to·get·the·next·property·of·the·current·object,·until·there·are·no·keys·left.·Number·keys·extract·the·item·type·from·arrays,·or·are·converted·to·strings·to·extract·types·from·tuples·and·dictionaries·with·number·keys. |
| 162 | /** | 162 | /** |
| 163 | Get·a·deeply-nested·property·from·an·object·using·a·key·path,·like·Lodash's·`.get()`·function. | 163 | Get·a·deeply-nested·property·from·an·object·using·a·key·path,·like·[Lodash's·`.get()`](https://lodash.com/docs/latest#get)·function. |
| 164 | Use-case:·Retrieve·a·property·from·deep·inside·an·API·response·or·some·other·complex·object. | 164 | Use-case:·Retrieve·a·property·from·deep·inside·an·API·response·or·some·other·complex·object. |
| 165 | @example | 165 | @example |
| 166 | ``` | 166 | ``` |
| 167 | import·type·{Get}·from·'type-fest'; | 167 | import·type·{Get}·from·'type-fest'; |
| Offset 1, 12 lines modified | Offset 1, 13 lines modified | ||
| 1 | import·type·{ | 1 | import·type·{PositiveNumericStringGt}·from·'./internal/index.d.ts'; |
| 2 | import·type·{IsEqual}·from·'./is-equal.d.ts'; | 2 | import·type·{IsEqual}·from·'./is-equal.d.ts'; |
| 3 | import·type·{PositiveInfinity,·NegativeInfinity,·IsNegative}·from·'./numeric.d.ts'; | 3 | import·type·{PositiveInfinity,·NegativeInfinity,·IsNegative}·from·'./numeric.d.ts'; |
| 4 | import·type·{And}·from·'./and.d.ts'; | 4 | import·type·{And}·from·'./and.d.ts'; |
| 5 | import·type·{Or}·from·'./or.d.ts'; | 5 | import·type·{Or}·from·'./or.d.ts'; |
| 6 | import·type·{Absolute}·from·'./absolute.d.ts'; | ||
| 6 | /** | 7 | /** |
| 7 | Returns·a·boolean·for·whether·a·given·number·is·greater·than·another·number. | 8 | Returns·a·boolean·for·whether·a·given·number·is·greater·than·another·number. |
| 8 | @example | 9 | @example |
| 9 | ``` | 10 | ``` |
| 10 | import·type·{GreaterThan}·from·'type-fest'; | 11 | import·type·{GreaterThan}·from·'type-fest'; |
| Offset 78, 14 lines modified | Offset 79, 14 lines modified | ||
| 78 | » » » » » » » » :·[IsNegative<A>,·IsNegative<B>]·extends·infer·R·extends·[boolean,·boolean] | 79 | » » » » » » » » :·[IsNegative<A>,·IsNegative<B>]·extends·infer·R·extends·[boolean,·boolean] |
| 79 | » » » » » » » » » ?·[true,·false]·extends·R | 80 | » » » » » » » » » ?·[true,·false]·extends·R |
| 80 | » » » » » » » » » » ?·false | 81 | » » » » » » » » » » ?·false |
| 81 | » » » » » » » » » » :·[false,·true]·extends·R | 82 | » » » » » » » » » » :·[false,·true]·extends·R |
| 82 | » » » » » » » » » » » ?·true | 83 | » » » » » » » » » » » ?·true |
| 83 | » » » » » » » » » » » :·[false,·false]·extends·R | 84 | » » » » » » » » » » » :·[false,·false]·extends·R |
| 84 | » » » » » » » » » » » » ?·PositiveNumericStringGt<`${A}`,·`${B}`> | 85 | » » » » » » » » » » » » ?·PositiveNumericStringGt<`${A}`,·`${B}`> |
| 85 | » » » » » » » » » » » » :·PositiveNumericStringGt<`${ | 86 | » » » » » » » » » » » » :·PositiveNumericStringGt<`${Absolute<B>}`,·`${Absolute<A>}`> |
| 86 | » » » » » » » » » :·never | 87 | » » » » » » » » » :·never |
| 87 | » » » » » :·never | 88 | » » » » » :·never |
| 88 | » » » :·never·//·Should·never·happen | 89 | » » » :·never·//·Should·never·happen |
| 89 | » » :·never;·//·Should·never·happen | 90 | » » :·never;·//·Should·never·happen |
| 90 | export·{}; | 91 | export·{}; |
| Offset 1, 11 lines modified | Offset 1, 11 lines modified | ||
| 1 | import·type·{OptionalKeysOf}·from·'./optional-keys-of.d.ts'; | 1 | import·type·{OptionalKeysOf}·from·'./optional-keys-of.d.ts'; |
| 2 | /** | 2 | /** |
| 3 | 3 | Returns·a·boolean·for·whether·the·given·type·has·any·optional·fields. | |
| 4 | This·is·useful·when·you·want·to·create·an·API·whose·behavior·depends·on·the·presence·or·absence·of·optional·fields. | 4 | This·is·useful·when·you·want·to·create·an·API·whose·behavior·depends·on·the·presence·or·absence·of·optional·fields. |
| 5 | @example | 5 | @example |
| 6 | ``` | 6 | ``` |
| 7 | import·type·{HasOptionalKeys,·OptionalKeysOf}·from·'type-fest'; | 7 | import·type·{HasOptionalKeys,·OptionalKeysOf}·from·'type-fest'; |
| Offset 1, 11 lines modified | Offset 1, 11 lines modified | ||
| 1 | import·type·{ReadonlyKeysOf}·from·'./readonly-keys-of.d.ts'; | 1 | import·type·{ReadonlyKeysOf}·from·'./readonly-keys-of.d.ts'; |
| 2 | /** | 2 | /** |
| 3 | 3 | Returns·a·boolean·for·whether·the·given·type·has·any·readonly·fields. | |
| 4 | This·is·useful·when·you·want·to·create·an·API·whose·behavior·depends·on·the·presence·or·absence·of·readonly·fields. | 4 | This·is·useful·when·you·want·to·create·an·API·whose·behavior·depends·on·the·presence·or·absence·of·readonly·fields. |
| 5 | @example | 5 | @example |
| 6 | ``` | 6 | ``` |
| 7 | import·type·{HasReadonlyKeys,·ReadonlyKeysOf}·from·'type-fest'; | 7 | import·type·{HasReadonlyKeys,·ReadonlyKeysOf}·from·'type-fest'; |
| Offset 1, 11 lines modified | Offset 1, 11 lines modified | ||
| 1 | import·type·{RequiredKeysOf}·from·'./required-keys-of.d.ts'; | 1 | import·type·{RequiredKeysOf}·from·'./required-keys-of.d.ts'; |
| 2 | /** | 2 | /** |
| 3 | 3 | Returns·a·boolean·for·whether·the·given·type·has·any·required·fields. | |
| 4 | This·is·useful·when·you·want·to·create·an·API·whose·behavior·depends·on·the·presence·or·absence·of·required·fields. | 4 | This·is·useful·when·you·want·to·create·an·API·whose·behavior·depends·on·the·presence·or·absence·of·required·fields. |
| 5 | @example | 5 | @example |
| 6 | ``` | 6 | ``` |
| 7 | import·type·{HasRequiredKeys}·from·'type-fest'; | 7 | import·type·{HasRequiredKeys}·from·'type-fest'; |
| Offset 1, 11 lines modified | Offset 1, 11 lines modified | ||
| 1 | import·type·{WritableKeysOf}·from·'./writable-keys-of.d.ts'; | 1 | import·type·{WritableKeysOf}·from·'./writable-keys-of.d.ts'; |
| 2 | /** | 2 | /** |
| 3 | 3 | Returns·a·boolean·for·whether·the·given·type·has·any·writable·fields. | |
| 4 | This·is·useful·when·you·want·to·create·an·API·whose·behavior·depends·on·the·presence·or·absence·of·writable·fields. | 4 | This·is·useful·when·you·want·to·create·an·API·whose·behavior·depends·on·the·presence·or·absence·of·writable·fields. |
| 5 | @example | 5 | @example |
| 6 | ``` | 6 | ``` |
| 7 | import·type·{HasWritableKeys,·WritableKeysOf}·from·'type-fest'; | 7 | import·type·{HasWritableKeys,·WritableKeysOf}·from·'type-fest'; |
| Offset 1, 14 lines modified | Offset 1, 12 lines modified | ||
| 1 | import·type·{IntRange}·from·'./int-range.d.ts'; | 1 | import·type·{IntRange}·from·'./int-range.d.ts'; |
| 2 | import·type·{Sum}·from·'./sum.d.ts'; | 2 | import·type·{Sum}·from·'./sum.d.ts'; |
| 3 | /** | 3 | /** |
| 4 | Generate·a·union·of·numbers·between·a·specified·start·and·end·(both·inclusive),·with·an·optional·step. | ||
| 4 | Generate·a·union·of·numbers. | ||
| 5 | The·numbers·are·created·from·the·given·`Start`·(inclusive)·parameter·to·the·given·`End`·(inclusive)·parameter. | ||
| 6 | You·skip·over·numbers·using·the·`Step`·parameter·(defaults·to·`1`).·For·example,·`IntClosedRange<0,·10,·2>`·will·create·a·union·of·`0·|·2·|·4·|·6·|·8·|·10`. | 5 | You·skip·over·numbers·using·the·`Step`·parameter·(defaults·to·`1`).·For·example,·`IntClosedRange<0,·10,·2>`·will·create·a·union·of·`0·|·2·|·4·|·6·|·8·|·10`. |
| 7 | Note:·`Start`·or·`End`·must·be·non-negative·and·smaller·than·`999`. | 6 | Note:·`Start`·or·`End`·must·be·non-negative·and·smaller·than·`999`. |
| 8 | Use-cases: | 7 | Use-cases: |
| 9 | 1.·This·can·be·used·to·define·a·set·of·valid·input/output·values.·for·example: | 8 | 1.·This·can·be·used·to·define·a·set·of·valid·input/output·values.·for·example: |
| Offset 1, 14 lines modified | Offset 1, 12 lines modified | ||
| 1 | import·type·{TupleOf}·from·'./tuple-of.d.ts'; | 1 | import·type·{TupleOf}·from·'./tuple-of.d.ts'; |
| 2 | import·type·{Subtract}·from·'./subtract.d.ts'; | 2 | import·type·{Subtract}·from·'./subtract.d.ts'; |
| 3 | /** | 3 | /** |
| 4 | Generate·a·union·of·numbers·between·a·specified·start·(inclusive)·and·end·(exclusive),·with·an·optional·step. | ||
| 4 | Generate·a·union·of·numbers. | ||
| 5 | The·numbers·are·created·from·the·given·`Start`·(inclusive)·parameter·to·the·given·`End`·(exclusive)·parameter. | ||
| 6 | You·skip·over·numbers·using·the·`Step`·parameter·(defaults·to·`1`).·For·example,·`IntRange<0,·10,·2>`·will·create·a·union·of·`0·|·2·|·4·|·6·|·8`. | 5 | You·skip·over·numbers·using·the·`Step`·parameter·(defaults·to·`1`).·For·example,·`IntRange<0,·10,·2>`·will·create·a·union·of·`0·|·2·|·4·|·6·|·8`. |
| 7 | Note:·`Start`·or·`End`·must·be·non-negative·and·smaller·than·`1000`. | 6 | Note:·`Start`·or·`End`·must·be·non-negative·and·smaller·than·`1000`. |
| 8 | Use-cases: | 7 | Use-cases: |
| 9 | 1.·This·can·be·used·to·define·a·set·of·valid·input/output·values.·for·example: | 8 | 1.·This·can·be·used·to·define·a·set·of·valid·input/output·values.·for·example: |
| Offset 52, 17 lines modified | Offset 50, 17 lines modified | ||
| 52 | » End·extends·number, | 50 | » End·extends·number, |
| 53 | » Step·extends·number, | 51 | » Step·extends·number, |
| 54 | » //·The·gap·between·each·number,·gap·=·step·-·1 | 52 | » //·The·gap·between·each·number,·gap·=·step·-·1 |
| 55 | » Gap·extends·number·=·Subtract<Step,·1>, | 53 | » Gap·extends·number·=·Subtract<Step,·1>, |
| 56 | » //·The·final·`List`·is·`[...StartLengthTuple,·...[number,·...GapLengthTuple],·...[number,·...GapLengthTuple],·...·...]`,·so·can·initialize·the·`List`·with·`[...StartLengthTuple]` | 54 | » //·The·final·`List`·is·`[...StartLengthTuple,·...[number,·...GapLengthTuple],·...[number,·...GapLengthTuple],·...·...]`,·so·can·initialize·the·`List`·with·`[...StartLengthTuple]` |
| 57 | » List·extends·unknown[]·=·TupleOf<Start,·never>, | 55 | » List·extends·unknown[]·=·TupleOf<Start,·never>, |
| 58 | » EndLengthTuple·extends·unknown[]·=·TupleOf<End>, | 56 | » EndLengthTuple·extends·unknown[]·=·TupleOf<End>, |
| 59 | >·=·Gap·extends·0 | 57 | >·=·Gap·extends·0 |
| 60 | » //·Handle·the·case·that·without·`Step` | 58 | » //·Handle·the·case·that·without·`Step` |
| 61 | » List['length']·extends·End·//·The·result·of·"List[length]·===·End" | 59 | » ?·List['length']·extends·End·//·The·result·of·"List[length]·===·End" |
| 62 | » » ?·Exclude<List[number],·never>·//·All·unused·elements·are·`never`,·so·exclude·them | 60 | » » ?·Exclude<List[number],·never>·//·All·unused·elements·are·`never`,·so·exclude·them |
| 63 | » » :·PrivateIntRange<Start,·End,·Step,·Gap,·[...List,·List['length']·]> | 61 | » » :·PrivateIntRange<Start,·End,·Step,·Gap,·[...List,·List['length']·]> |
| 64 | » //·Handle·the·case·that·with·`Step` | 62 | » //·Handle·the·case·that·with·`Step` |
| 65 | » :·List·extends·[...(infer·U),·...EndLengthTuple]·//·The·result·of·"List[length]·>=·End",·because·the·`...TupleOf<Gap,·never>`·maybe·make·`List`·too·long. | 63 | » :·List·extends·[...(infer·U),·...EndLengthTuple]·//·The·result·of·"List[length]·>=·End",·because·the·`...TupleOf<Gap,·never>`·maybe·make·`List`·too·long. |
| 66 | » » ?·Exclude<List[number],·never> | 64 | » » ?·Exclude<List[number],·never> |
| 67 | » » :·PrivateIntRange<Start,·End,·Step,·Gap,·[...List,·List['length'],·...TupleOf<Gap,·never>]>; | 65 | » » :·PrivateIntRange<Start,·End,·Step,·Gap,·[...List,·List['length'],·...TupleOf<Gap,·never>]>; |
| Offset 25, 16 lines modified | Offset 25, 16 lines modified | ||
| 25 | type·A·=·[string,·number,·boolean,·...string[]]; | 25 | type·A·=·[string,·number,·boolean,·...string[]]; |
| 26 | type·B·=·StaticPartOfArray<A>; | 26 | type·B·=·StaticPartOfArray<A>; |
| 27 | //=>·[string,·number,·boolean] | 27 | //=>·[string,·number,·boolean] |
| 28 | ``` | 28 | ``` |
| 29 | */ | 29 | */ |
| 30 | export·type·StaticPartOfArray<T·extends·UnknownArray,·Result·extends·UnknownArray·=·[]>·= | 30 | export·type·StaticPartOfArray<T·extends·UnknownArray,·Result·extends·UnknownArray·=·[]>·= |
| 31 | » T·extends·unknown | 31 | » T·extends·unknown |
| 32 | » » ?·number·extends·T['length'] | 32 | » » ?·number·extends·T['length'] |
| 33 | » » » T·extends·readonly·[infer·U,·...infer·V] | 33 | » » » ?·T·extends·readonly·[infer·U,·...infer·V] |
| 34 | » » » » ?·StaticPartOfArray<V,·[...Result,·U]> | 34 | » » » » ?·StaticPartOfArray<V,·[...Result,·U]> |
| 35 | » » » » :·Result | 35 | » » » » :·Result |
| 36 | » » » :·T | 36 | » » » :·T |
| 37 | » » :·never;·//·Should·never·happen | 37 | » » :·never;·//·Should·never·happen |
| 38 | /** | 38 | /** |
| 39 | Returns·the·variable,·non-fixed-length·portion·of·the·given·array,·excluding·static-length·parts. | 39 | Returns·the·variable,·non-fixed-length·portion·of·the·given·array,·excluding·static-length·parts. |
| Offset 65, 19 lines modified | Offset 65, 19 lines modified | ||
| 65 | //=>·readonly·string[] | 65 | //=>·readonly·string[] |
| 66 | type·NormalResult·=·SetArrayAccess<ReadonlyStringArray,·false>; | 66 | type·NormalResult·=·SetArrayAccess<ReadonlyStringArray,·false>; |
| 67 | //=>·string[] | 67 | //=>·string[] |
| 68 | ``` | 68 | ``` |
| 69 | */ | 69 | */ |
| 70 | export·type·SetArrayAccess<T·extends·UnknownArray,·IsReadonly·extends·boolean>·= | 70 | export·type·SetArrayAccess<T·extends·UnknownArray,·IsReadonly·extends·boolean>·= |
| 71 | T·extends·readonly·[...infer·U] | 71 | » T·extends·readonly·[...infer·U] |
| 72 | » IsReadonly·extends·true | 72 | » » ?·IsReadonly·extends·true |
| 73 | » » ?·readonly·[...U] | 73 | » » » ?·readonly·[...U] |
| 74 | » » :·[...U] | 74 | » » » :·[...U] |
| 75 | » :·T; | 75 | » » :·T; |
| 76 | /** | 76 | /** |
| 77 | Returns·whether·the·given·array·`T`·is·readonly. | 77 | Returns·whether·the·given·array·`T`·is·readonly. |
| 78 | */ | 78 | */ |
| 79 | export·type·IsArrayReadonly<T·extends·UnknownArray>·=·If<IsNever<T>,·false,·T·extends·unknown[]·?·false·:·true>; | 79 | export·type·IsArrayReadonly<T·extends·UnknownArray>·=·If<IsNever<T>,·false,·T·extends·unknown[]·?·false·:·true>; |
| 80 | /** | 80 | /** |
| Offset 83, 18 lines modified | Offset 83, 18 lines modified | ||
| 83 | type·Key4·=·ExactKey<Object,·1>; | 83 | type·Key4·=·ExactKey<Object,·1>; |
| 84 | //=>·'1' | 84 | //=>·'1' |
| 85 | ``` | 85 | ``` |
| 86 | @category·Object | 86 | @category·Object |
| 87 | */ | 87 | */ |
| 88 | export·type·ExactKey<T·extends·object,·Key·extends·PropertyKey>·= | 88 | export·type·ExactKey<T·extends·object,·Key·extends·PropertyKey>·= |
| 89 | Key·extends·keyof·T | 89 | » Key·extends·keyof·T |
| 90 | » ?·Key | 90 | » » ?·Key |
| 91 | » :·ToString<Key>·extends·keyof·T | 91 | » » :·ToString<Key>·extends·keyof·T |
| 92 | » » ?·ToString<Key> | 92 | » » » ?·ToString<Key> |
| 93 | » » :·Key·extends·`${infer·NumberKey·extends·number}` | 93 | » » » :·Key·extends·`${infer·NumberKey·extends·number}` |
| 94 | » » » ?·NumberKey·extends·keyof·T | 94 | » » » » ?·NumberKey·extends·keyof·T |
| 95 | » » » » ?·NumberKey | 95 | » » » » » ?·NumberKey |
| 96 | » » » » :·never | 96 | » » » » » :·never |
| 97 | » » » :·never; | 97 | » » » » :·never; |
| 98 | export·{}; | 98 | export·{}; |
| Offset 1, 31 lines modified | Offset 1, 13 lines modified | ||
| 1 | import·type·{IsNever}·from·'../is-never.d.ts'; | 1 | import·type·{IsNever}·from·'../is-never.d.ts'; |
| 2 | import·type·{Finite,·NegativeInfinity,·PositiveInfinity}·from·'../numeric.d.ts'; | 2 | import·type·{Finite,·NegativeInfinity,·PositiveInfinity}·from·'../numeric.d.ts'; |
| 3 | import·type·{UnknownArray}·from·'../unknown-array.d.ts'; | 3 | import·type·{UnknownArray}·from·'../unknown-array.d.ts'; |
| 4 | import·type·{StringToNumber}·from·'./string.d.ts'; | ||
| 5 | import·type·{IfNotAnyOrNever,·IsAnyOrNever}·from·'./type.d.ts'; | 4 | import·type·{IfNotAnyOrNever,·IsAnyOrNever}·from·'./type.d.ts'; |
| 6 | /** | 5 | /** |
| 7 | Returns·the·absolute·value·of·a·given·value. | ||
| 8 | @example | ||
| 9 | ``` | ||
| 10 | type·A·=·NumberAbsolute<-1>; | ||
| 11 | //=>·1 | ||
| 12 | type·B·=·NumberAbsolute<1>; | ||
| 13 | //=>·1 | ||
| 14 | type·C·=·NumberAbsolute<NegativeInfinity>; | ||
| 15 | //=>·PositiveInfinity | ||
| 16 | ``` | ||
| 17 | */ | ||
| 18 | export·type·NumberAbsolute<N·extends·number>·=·`${N}`·extends·`-${infer·StringPositiveN}`·?·StringToNumber<StringPositiveN>·:·N; | ||
| 19 | /** | ||
| 20 | Check·whether·the·given·type·is·a·number·or·a·number·string. | 6 | Check·whether·the·given·type·is·a·number·or·a·number·string. |
| 21 | Supports·floating-point·as·a·string. | 7 | Supports·floating-point·as·a·string. |
| 22 | @example | 8 | @example |
| 23 | ``` | 9 | ``` |
| 24 | type·A·=·IsNumberLike<'1'>; | 10 | type·A·=·IsNumberLike<'1'>; |
| Offset 138, 14 lines modified | Offset 120, 22 lines modified | ||
| 138 | type·D·=·ReverseSign<PositiveInfinity>; | 120 | type·D·=·ReverseSign<PositiveInfinity>; |
| 139 | //=>·NegativeInfinity | 121 | //=>·NegativeInfinity |
| 140 | ``` | 122 | ``` |
| 141 | */ | 123 | */ |
| 142 | export·type·ReverseSign<N·extends·number>·= | 124 | export·type·ReverseSign<N·extends·number>·= |
| 143 | » //·Handle·edge·cases | 125 | » //·Handle·edge·cases |
| 144 | » N·extends·0 | 126 | » N·extends·0 |
| 127 | » » ?·0 | ||
| 128 | » » :·N·extends·PositiveInfinity | ||
| 129 | » » » ?·NegativeInfinity | ||
| 130 | » » » :·N·extends·NegativeInfinity | ||
| 131 | » » » » ?·PositiveInfinity | ||
| 145 | » //·Handle·negative·numbers | 132 | » » » » //·Handle·negative·numbers |
| 146 | » `${N}`·extends·`-${infer·P·extends·number}` | 133 | » » » » :·`${N}`·extends·`-${infer·P·extends·number}` |
| 134 | » » » » » ?·P | ||
| 147 | » » //·Handle·positive·numbers | 135 | » » » » » //·Handle·positive·numbers |
| 148 | » » :·`-${N}`·extends·`${infer·R·extends·number}` | 136 | » » » » » :·`-${N}`·extends·`${infer·R·extends·number}` |
| 137 | » » » » » » ?·R | ||
| 138 | » » » » » » :·never; | ||
| 149 | export·{}; | 139 | export·{}; |
| Offset 42, 16 lines modified | Offset 42, 16 lines modified | ||
| 42 | //=>·5 | 42 | //=>·5 |
| 43 | type·B·=·TupleMax<[1,·2,·5,·3,·99,·-1]>; | 43 | type·B·=·TupleMax<[1,·2,·5,·3,·99,·-1]>; |
| 44 | //=>·99 | 44 | //=>·99 |
| 45 | ``` | 45 | ``` |
| 46 | */ | 46 | */ |
| 47 | export·type·TupleMax<A·extends·number[],·Result·extends·number·=·NegativeInfinity>·=·number·extends·A[number] | 47 | export·type·TupleMax<A·extends·number[],·Result·extends·number·=·NegativeInfinity>·=·number·extends·A[number] |
| 48 | » ?·never | 48 | » ?·never |
| 49 | » A·extends·[infer·F·extends·number,·...infer·R·extends·number[]] | 49 | » :·A·extends·[infer·F·extends·number,·...infer·R·extends·number[]] |
| 50 | » » ?·GreaterThan<F,·Result>·extends·true | 50 | » » ?·GreaterThan<F,·Result>·extends·true |
| 51 | » » » ?·TupleMax<R,·F> | 51 | » » » ?·TupleMax<R,·F> |
| 52 | » » » :·TupleMax<R,·Result> | 52 | » » » :·TupleMax<R,·Result> |
| 53 | » » :·Result; | 53 | » » :·Result; |
| 54 | /** | 54 | /** |
| 55 | Returns·the·minimum·value·from·a·tuple·of·integers. | 55 | Returns·the·minimum·value·from·a·tuple·of·integers. |
| Offset 43, 18 lines modified | Offset 43, 18 lines modified | ||
| 43 | //=>·false | 43 | //=>·false |
| 44 | ``` | 44 | ``` |
| 45 | @category·Type·Guard | 45 | @category·Type·Guard |
| 46 | @category·Numeric | 46 | @category·Numeric |
| 47 | */ | 47 | */ |
| 48 | export·type·IsInteger<T>·= | 48 | export·type·IsInteger<T>·= |
| 49 | T·extends·bigint | 49 | » T·extends·bigint |
| 50 | » ?·true | 50 | » » ?·true |
| 51 | » :·T·extends·number | 51 | » » :·T·extends·number |
| 52 | » » ?·number·extends·T | 52 | » » » ?·number·extends·T |
| 53 | » » » ?·false | ||
| 54 | » » » :·T·extends·PositiveInfinity·|·NegativeInfinity | ||
| 55 | » » » » ?·false | 53 | » » » » ?·false |
| 54 | » » » » :·T·extends·PositiveInfinity·|·NegativeInfinity | ||
| 55 | » » » » » ?·false | ||
| 56 | » » » » :·Not<IsFloat<T>> | 56 | » » » » » :·Not<IsFloat<T>> |
| 57 | » » :·false; | 57 | » » » :·false; |
| 58 | export·{}; | 58 | export·{}; |
| Offset 117, 19 lines modified | Offset 117, 19 lines modified | ||
| 117 | export·type·IsStringLiteral<S>·=·IfNotAnyOrNever<S, | 117 | export·type·IsStringLiteral<S>·=·IfNotAnyOrNever<S, |
| 118 | » _IsStringLiteral<CollapseLiterals<S·extends·TagContainer<any>·?·UnwrapTagged<S>·:·S>>, | 118 | » _IsStringLiteral<CollapseLiterals<S·extends·TagContainer<any>·?·UnwrapTagged<S>·:·S>>, |
| 119 | » false,·false>; | 119 | » false,·false>; |
| 120 | export·type·_IsStringLiteral<S>·= | 120 | export·type·_IsStringLiteral<S>·= |
| 121 | //·If·`T`·is·an·infinite·string·type·(e.g.,·`on${string}`),·`Record<T,·never>`·produces·an·index·signature, | 121 | //·If·`T`·is·an·infinite·string·type·(e.g.,·`on${string}`),·`Record<T,·never>`·produces·an·index·signature, |
| 122 | //·and·since·`{}`·extends·index·signatures,·the·result·becomes·`false`. | 122 | //·and·since·`{}`·extends·index·signatures,·the·result·becomes·`false`. |
| 123 | S·extends·string | 123 | » S·extends·string |
| 124 | » ?·{}·extends·Record<S,·never> | 124 | » » ?·{}·extends·Record<S,·never> |
| 125 | » » ?·false | 125 | » » » ?·false |
| 126 | » » :·true | 126 | » » » :·true |
| 127 | » :·false; | 127 | » » :·false; |
| 128 | /** | 128 | /** |
| 129 | Returns·a·boolean·for·whether·the·given·type·is·a·`number`·or·`bigint`·[literal·type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types). | 129 | Returns·a·boolean·for·whether·the·given·type·is·a·`number`·or·`bigint`·[literal·type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types). |
| 130 | Useful·for: | 130 | Useful·for: |
| 131 | » -·providing·strongly-typed·functions·when·given·literal·arguments | 131 | » -·providing·strongly-typed·functions·when·given·literal·arguments |
| 132 | » -·type·utilities,·such·as·when·constructing·parsers·and·ASTs | 132 | » -·type·utilities,·such·as·when·constructing·parsers·and·ASTs |
| Offset 17, 24 lines modified | Offset 17, 24 lines modified | ||
| 17 | */ | 17 | */ |
| 18 | export·type·IsUnion<T>·=·InternalIsUnion<T>; | 18 | export·type·IsUnion<T>·=·InternalIsUnion<T>; |
| 19 | /** | 19 | /** |
| 20 | The·actual·implementation·of·`IsUnion`. | 20 | The·actual·implementation·of·`IsUnion`. |
| 21 | */ | 21 | */ |
| 22 | type·InternalIsUnion<T,·U·=·T>·= | 22 | type·InternalIsUnion<T,·U·=·T>·= |
| 23 | ( | 23 | » ( |
| 24 | » IsNever<T>·extends·true | 24 | » » IsNever<T>·extends·true |
| 25 | » » ?·false | 25 | » » » ?·false |
| 26 | » » :·T·extends·any | 26 | » » » :·T·extends·any |
| 27 | » » » ?·IsEqual<U,·T>·extends·true | 27 | » » » » ?·IsEqual<U,·T>·extends·true |
| 28 | » » » » ?·false | 28 | » » » » » ?·false |
| 29 | » » » » :·true | 29 | » » » » » :·true |
| 30 | » » » :·never | 30 | » » » » :·never |
| 31 | )·extends·infer·Result | 31 | » )·extends·infer·Result |
| 32 | » //·In·some·cases·`Result`·will·return·`false·|·true`·which·is·`boolean`, | 32 | » //·In·some·cases·`Result`·will·return·`false·|·true`·which·is·`boolean`, |
| 33 | » //·that·means·`T`·has·at·least·two·types·and·it's·a·union·type, | 33 | » //·that·means·`T`·has·at·least·two·types·and·it's·a·union·type, |
| 34 | » //·so·we·will·return·`true`·instead·of·`boolean`. | 34 | » //·so·we·will·return·`true`·instead·of·`boolean`. |
| 35 | » ?·boolean·extends·Result·?·true | 35 | » » ?·boolean·extends·Result·?·true |
| 36 | » » :·Result | 36 | » » » :·Result |
| 37 | » :·never;·//·Should·never·happen | 37 | » » :·never;·//·Should·never·happen |
| 38 | export·{}; | 38 | export·{}; |
| Offset 53, 14 lines modified | Offset 53, 14 lines modified | ||
| 53 | type·Fruit·=·IterableElement<typeof·fruits>; | 53 | type·Fruit·=·IterableElement<typeof·fruits>; |
| 54 | //=>·'🍎'·|·'🍌'·|·'🍉' | 54 | //=>·'🍎'·|·'🍌'·|·'🍉' |
| 55 | ``` | 55 | ``` |
| 56 | @category·Iterable | 56 | @category·Iterable |
| 57 | */ | 57 | */ |
| 58 | export·type·IterableElement<TargetIterable>·= | 58 | export·type·IterableElement<TargetIterable>·= |
| 59 | » TargetIterable·extends·Iterable<infer·ElementType> | 59 | » TargetIterable·extends·Iterable<infer·ElementType> |
| 60 | » » ElementType | 60 | » » ?·ElementType |
| 61 | » » TargetIterable·extends·AsyncIterable<infer·ElementType> | 61 | » » :·TargetIterable·extends·AsyncIterable<infer·ElementType> |
| 62 | » » » ElementType | 62 | » » » ?·ElementType |
| 63 | » » » never; | 63 | » » » :·never; |
| 64 | export·{}; | 64 | export·{}; |
| Offset 94, 21 lines modified | Offset 94, 21 lines modified | ||
| 94 | */ | 94 | */ |
| 95 | export·type·Jsonify<T>·=·IsAny<T>·extends·true | 95 | export·type·Jsonify<T>·=·IsAny<T>·extends·true |
| 96 | » ?·any | 96 | » ?·any |
| 97 | » :·T·extends·PositiveInfinity·|·NegativeInfinity | 97 | » :·T·extends·PositiveInfinity·|·NegativeInfinity |
| 98 | » » ?·null | 98 | » » ?·null |
| 99 | » » :·T·extends·JsonPrimitive | 99 | » » :·T·extends·JsonPrimitive |
| 100 | » » » ?·T | 100 | » » » ?·T |
| 101 | » » » | 101 | » » » //·Any·object·with·toJSON·is·special·case |
| 102 | » » » T·extends·{toJSON():·infer·J} | 102 | » » » :·T·extends·{toJSON():·infer·J} |
| 103 | » » » » ?·(()·=>·J)·extends·()·=>·JsonValue·//·Is·J·assignable·to·JsonValue? | 103 | » » » » ?·(()·=>·J)·extends·()·=>·JsonValue·//·Is·J·assignable·to·JsonValue? |
| 104 | » » » » » ?·J·//·Then·T·is·Jsonable·and·its·Jsonable·value·is·J | 104 | » » » » » ?·J·//·Then·T·is·Jsonable·and·its·Jsonable·value·is·J |
| 105 | » » » » » :·Jsonify<J>·//·Maybe·if·we·look·a·level·deeper·we'll·find·a·JsonValue | 105 | » » » » » :·Jsonify<J>·//·Maybe·if·we·look·a·level·deeper·we'll·find·a·JsonValue |
| 106 | » » » » | 106 | » » » » //·Instanced·primitives·are·objects |
| 107 | » » » » T·extends·Number | 107 | » » » » :·T·extends·Number |
| 108 | » » » » » ?·number | 108 | » » » » » ?·number |
| 109 | » » » » » :·T·extends·String | 109 | » » » » » :·T·extends·String |
| 110 | » » » » » » ?·string | 110 | » » » » » » ?·string |
| 111 | » » » » » » :·T·extends·Boolean | 111 | » » » » » » :·T·extends·Boolean |
| 112 | » » » » » » » ?·boolean | 112 | » » » » » » » ?·boolean |
| 113 | » » » » » » » :·T·extends·Map<any,·any>·|·Set<any> | 113 | » » » » » » » :·T·extends·Map<any,·any>·|·Set<any> |
| 114 | » » » » » » » » ?·EmptyObject | 114 | » » » » » » » » ?·EmptyObject |
| Offset 11, 14 lines modified | Offset 11, 15 lines modified | ||
| 11 | ``` | 11 | ``` |
| 12 | import·type·{KebabCase}·from·'type-fest'; | 12 | import·type·{KebabCase}·from·'type-fest'; |
| 13 | //·Simple | 13 | //·Simple |
| 14 | const·someVariable:·KebabCase<'fooBar'>·=·'foo-bar'; | 14 | const·someVariable:·KebabCase<'fooBar'>·=·'foo-bar'; |
| 15 | const·someVariableNoSplitOnNumbers:·KebabCase<'p2pNetwork',·{splitOnNumbers:·false}>·=·'p2p-network'; | 15 | const·someVariableNoSplitOnNumbers:·KebabCase<'p2pNetwork',·{splitOnNumbers:·false}>·=·'p2p-network'; |
| 16 | const·someVariableWithPunctuation:·KebabCase<'div.card::after',·{splitOnPunctuation:·true}>·=·'div-card-after'; | ||
| 16 | //·Advanced | 17 | //·Advanced |
| 17 | type·KebabCasedProperties<T>·=·{ | 18 | type·KebabCasedProperties<T>·=·{ |
| 18 | » [K·in·keyof·T·as·KebabCase<K>]:·T[K] | 19 | » [K·in·keyof·T·as·KebabCase<K>]:·T[K] |
| 19 | }; | 20 | }; |
| Offset 47, 14 lines modified | Offset 47, 21 lines modified | ||
| 47 | » » 'line-2':·[ | 47 | » » 'line-2':·[ |
| 48 | » » » { | 48 | » » » { |
| 49 | » » » » 'line-3':·'string', | 49 | » » » » 'line-3':·'string', |
| 50 | » » » }, | 50 | » » » }, |
| 51 | » » ], | 51 | » » ], |
| 52 | » }, | 52 | » }, |
| 53 | }; | 53 | }; |
| 54 | const·splitOnPunctuation:·KebabCasedPropertiesDeep<{'user@info':·{'user::id':·number;·'user::name':·string}},·{splitOnPunctuation:·true}>·=·{ | ||
| 55 | » 'user-info':·{ | ||
| 56 | » » 'user-id':·1, | ||
| 57 | » » 'user-name':·'Tom', | ||
| 58 | » }, | ||
| 59 | }; | ||
| 54 | ``` | 60 | ``` |
| 55 | @category·Change·case | 61 | @category·Change·case |
| 56 | @category·Template·literal | 62 | @category·Template·literal |
| 57 | @category·Object | 63 | @category·Object |
| 58 | */ | 64 | */ |
| 59 | export·type·KebabCasedPropertiesDeep< | 65 | export·type·KebabCasedPropertiesDeep< |
| Offset 1, 14 lines modified | Offset 1, 14 lines modified | ||
| 1 | import·type·{_DefaultDelimiterCaseOptions}·from·'./delimiter-case.d.ts'; | 1 | import·type·{_DefaultDelimiterCaseOptions}·from·'./delimiter-case.d.ts'; |
| 2 | import·type·{DelimiterCasedProperties}·from·'./delimiter-cased-properties.d.ts'; | 2 | import·type·{DelimiterCasedProperties}·from·'./delimiter-cased-properties.d.ts'; |
| 3 | import·type·{ApplyDefaultOptions}·from·'./internal/index.d.ts'; | 3 | import·type·{ApplyDefaultOptions}·from·'./internal/index.d.ts'; |
| 4 | import·type·{WordsOptions}·from·'./words.d.ts'; | 4 | import·type·{WordsOptions}·from·'./words.d.ts'; |
| 5 | /** | 5 | /** |
| 6 | Convert·object·properties·to·kebab·ca | 6 | Convert·top-level·object·properties·to·kebab·case. |
| 7 | This·can·be·useful·when,·for·example,·converting·some·API·types·from·a·different·style. | 7 | This·can·be·useful·when,·for·example,·converting·some·API·types·from·a·different·style. |
| 8 | @see·{@link·KebabCase} | 8 | @see·{@link·KebabCase} |
| 9 | @see·{@link·KebabCasedPropertiesDeep} | 9 | @see·{@link·KebabCasedPropertiesDeep} |
| 10 | @example | 10 | @example |
| Offset 24, 14 lines modified | Offset 24, 18 lines modified | ||
| 24 | » 'user-id':·1, | 24 | » 'user-id':·1, |
| 25 | » 'user-name':·'Tom', | 25 | » 'user-name':·'Tom', |
| 26 | }; | 26 | }; |
| 27 | const·splitOnNumbers:·KebabCasedProperties<{line1:·string},·{splitOnNumbers:·true}>·=·{ | 27 | const·splitOnNumbers:·KebabCasedProperties<{line1:·string},·{splitOnNumbers:·true}>·=·{ |
| 28 | » 'line-1':·'string', | 28 | » 'line-1':·'string', |
| 29 | }; | 29 | }; |
| 30 | const·splitOnPunctuation:·KebabCasedProperties<{'foo::bar':·string},·{splitOnPunctuation:·true}>·=·{ | ||
| 31 | » 'foo-bar':·'string', | ||
| 32 | }; | ||
| 30 | ``` | 33 | ``` |
| 31 | @category·Change·case | 34 | @category·Change·case |
| 32 | @category·Template·literal | 35 | @category·Template·literal |
| 33 | @category·Object | 36 | @category·Object |
| 34 | */ | 37 | */ |
| 35 | export·type·KebabCasedProperties< | 38 | export·type·KebabCasedProperties< |
| Offset 34, 11 lines modified | Offset 34, 11 lines modified | ||
| 34 | type·AllKeys·=·KeysOfUnion<Union>; | 34 | type·AllKeys·=·KeysOfUnion<Union>; |
| 35 | //=>·'common'·|·'a'·|·'b'·|·'c' | 35 | //=>·'common'·|·'a'·|·'b'·|·'c' |
| 36 | ``` | 36 | ``` |
| 37 | @category·Object | 37 | @category·Object |
| 38 | */ | 38 | */ |
| 39 | export·type·KeysOfUnion<ObjectType>·= | 39 | export·type·KeysOfUnion<ObjectType>·= |
| 40 | 40 | » //·Hack·to·fix·https://github.com/sindresorhus/type-fest/issues/1008 | |
| 41 | 41 | » keyof·UnionToIntersection<ObjectType·extends·unknown·?·Record<keyof·ObjectType,·never>·:·never>; | |
| 42 | export·{}; | 42 | export·{}; |
| Offset 1, 11 lines modified | Offset 1, 11 lines modified | ||
| 1 | import·type·{GreaterThan}·from·'./greater-than.d.ts'; | 1 | import·type·{GreaterThan}·from·'./greater-than.d.ts'; |
| 2 | /** | 2 | /** |
| 3 | 3 | Returns·a·boolean·for·whether·a·given·number·is·less·than·or·equal·to·another·number. | |
| 4 | @example | 4 | @example |
| 5 | ``` | 5 | ``` |
| 6 | import·type·{LessThanOrEqual}·from·'type-fest'; | 6 | import·type·{LessThanOrEqual}·from·'type-fest'; |
| 7 | type·A·=·LessThanOrEqual<1,·-5>; | 7 | type·A·=·LessThanOrEqual<1,·-5>; |
| 8 | //=>·false | 8 | //=>·false |
| Offset 1, 9 lines modified | Offset 1, 9 lines modified | ||
| 1 | /** | 1 | /** |
| 2 | Given·a·[literal·type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types)·return·the· | 2 | Given·a·[literal·type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types)·return·the·[primitive·type](https://developer.mozilla.org/en-US/docs/Glossary/Primitive)·it·belongs·to,·or·`never`·if·it's·not·a·primitive. |
| 3 | Use-case:·Working·with·generic·types·that·may·be·literal·types. | 3 | Use-case:·Working·with·generic·types·that·may·be·literal·types. |
| 4 | @example | 4 | @example |
| 5 | ``` | 5 | ``` |
| 6 | import·type·{LiteralToPrimitive}·from·'type-fest'; | 6 | import·type·{LiteralToPrimitive}·from·'type-fest'; |
| Offset 1, 13 lines modified | Offset 1, 13 lines modified | ||
| 1 | import·type·{Primitive}·from·'./primitive.d.ts'; | 1 | import·type·{Primitive}·from·'./primitive.d.ts'; |
| 2 | export·type·_LiteralStringUnion<T>·=·LiteralUnion<T,·string>; | 2 | export·type·_LiteralStringUnion<T>·=·LiteralUnion<T,·string>; |
| 3 | /** | 3 | /** |
| 4 | 4 | Create·a·union·type·by·combining·primitive·types·and·literal·types·without·sacrificing·auto-completion·in·IDEs·for·the·literal·type·part·of·the·union. | |
| 5 | Currently,·when·a·union·type·of·a·primitive·type·is·combined·with·literal·types,·TypeScript·loses·all·information·about·the·combined·literals.·Thus,·when·such·type·is·used·in·an·IDE·with·autocompletion,·no·suggestions·are·made·for·the·declared·literals. | 5 | Currently,·when·a·union·type·of·a·primitive·type·is·combined·with·literal·types,·TypeScript·loses·all·information·about·the·combined·literals.·Thus,·when·such·type·is·used·in·an·IDE·with·autocompletion,·no·suggestions·are·made·for·the·declared·literals. |
| 6 | This·type·is·a·workaround·for·[Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729).·It·will·be·removed·as·soon·as·it's·not·needed·anymore. | 6 | This·type·is·a·workaround·for·[Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729).·It·will·be·removed·as·soon·as·it's·not·needed·anymore. |
| 7 | @example | 7 | @example |
| 8 | ``` | 8 | ``` |
| Offset 34, 12 lines modified | Offset 34, 12 lines modified | ||
| 34 | exclusiveOptions·=·{exclusive1:·true,·exclusive2:·'hi'}; | 34 | exclusiveOptions·=·{exclusive1:·true,·exclusive2:·'hi'}; |
| 35 | //·Error | 35 | //·Error |
| 36 | ``` | 36 | ``` |
| 37 | @category·Object | 37 | @category·Object |
| 38 | */ | 38 | */ |
| 39 | export·type·MergeExclusive<FirstType,·SecondType>·= | 39 | export·type·MergeExclusive<FirstType,·SecondType>·= |
| 40 | » (FirstType·|·SecondType)·extends·object | 40 | » (FirstType·|·SecondType)·extends·object |
| 41 | » » (Without<FirstType,·SecondType>·&·SecondType)·|·(Without<SecondType,·FirstType>·&·FirstType) | 41 | » » ?·(Without<FirstType,·SecondType>·&·SecondType)·|·(Without<SecondType,·FirstType>·&·FirstType) |
| 42 | » » FirstType·|·SecondType; | 42 | » » :·FirstType·|·SecondType; |
| 43 | export·{}; | 43 | export·{}; |
| Offset 1, 14 lines modified | Offset 1, 14 lines modified | ||
| 1 | import·type·{Subtract}·from·'./subtract.d.ts'; | 1 | import·type·{Subtract}·from·'./subtract.d.ts'; |
| 2 | import·type·{IsEqual}·from·'./is-equal.d.ts'; | 2 | import·type·{IsEqual}·from·'./is-equal.d.ts'; |
| 3 | type·Recursive<T>·=·Array<Recursive<T>>; | 3 | type·Recursive<T>·=·Array<Recursive<T>>; |
| 4 | /** | 4 | /** |
| 5 | Create | 5 | Create·a·type·that·represents·a·multidimensional·array·of·the·given·type·and·dimension. |
| 6 | Use-cases: | 6 | Use-cases: |
| 7 | -·Return·a·n-dimensional·array·from·functions. | 7 | -·Return·a·n-dimensional·array·from·functions. |
| 8 | -·Declare·a·n-dimensional·array·by·defining·its·dimensions·rather·than·declaring·`[]`·repetitively. | 8 | -·Declare·a·n-dimensional·array·by·defining·its·dimensions·rather·than·declaring·`[]`·repetitively. |
| 9 | -·Infer·the·dimensions·of·a·n-dimensional·array·automatically·from·function·arguments. | 9 | -·Infer·the·dimensions·of·a·n-dimensional·array·automatically·from·function·arguments. |
| 10 | -·Avoid·the·need·to·know·in·advance·the·dimensions·of·a·n-dimensional·array·allowing·them·to·be·dynamic. | 10 | -·Avoid·the·need·to·know·in·advance·the·dimensions·of·a·n-dimensional·array·allowing·them·to·be·dynamic. |
| Offset 1, 14 lines modified | Offset 1, 14 lines modified | ||
| 1 | import·type·{Subtract}·from·'./subtract.d.ts'; | 1 | import·type·{Subtract}·from·'./subtract.d.ts'; |
| 2 | import·type·{IsEqual}·from·'./is-equal.d.ts'; | 2 | import·type·{IsEqual}·from·'./is-equal.d.ts'; |
| 3 | type·Recursive<T>·=·ReadonlyArray<Recursive<T>>; | 3 | type·Recursive<T>·=·ReadonlyArray<Recursive<T>>; |
| 4 | /** | 4 | /** |
| 5 | Create | 5 | Create·a·type·that·represents·a·multidimensional·readonly·array·of·the·given·type·and·dimension. |
| 6 | Use-cases: | 6 | Use-cases: |
| 7 | -·Return·a·n-dimensional·array·from·functions. | 7 | -·Return·a·n-dimensional·array·from·functions. |
| 8 | -·Declare·a·n-dimensional·array·by·defining·its·dimensions·rather·than·declaring·`[]`·repetitively. | 8 | -·Declare·a·n-dimensional·array·by·defining·its·dimensions·rather·than·declaring·`[]`·repetitively. |
| 9 | -·Infer·the·dimensions·of·a·n-dimensional·array·automatically·from·function·arguments. | 9 | -·Infer·the·dimensions·of·a·n-dimensional·array·automatically·from·function·arguments. |
| 10 | -·Avoid·the·need·to·know·in·advance·the·dimensions·of·a·n-dimensional·array·allowing·them·to·be·dynamic. | 10 | -·Avoid·the·need·to·know·in·advance·the·dimensions·of·a·n-dimensional·array·allowing·them·to·be·dynamic. |
| Offset 117, 17 lines modified | Offset 117, 17 lines modified | ||
| 117 | ``` | 117 | ``` |
| 118 | @see·{@link·Integer} | 118 | @see·{@link·Integer} |
| 119 | @category·Numeric | 119 | @category·Numeric |
| 120 | */ | 120 | */ |
| 121 | export·type·Float<T>·= | 121 | export·type·Float<T>·= |
| 122 | T·extends·unknown·//·To·distributive·type | 122 | » T·extends·unknown·//·To·distributive·type |
| 123 | » ?·IsFloat<T>·extends·true·?·T·:·never | 123 | » » ?·IsFloat<T>·extends·true·?·T·:·never |
| 124 | » :·never;·//·Never·happens | 124 | » » :·never;·//·Never·happens |
| 125 | /** | 125 | /** |
| 126 | A·negative·(`-∞·<·x·<·0`)·`number`·that·is·not·an·integer. | 126 | A·negative·(`-∞·<·x·<·0`)·`number`·that·is·not·an·integer. |
| 127 | Equivalent·to·`Negative<Float<T>>`. | 127 | Equivalent·to·`Negative<Float<T>>`. |
| 128 | Use-case:·Validating·and·documenting·parameters. | 128 | Use-case:·Validating·and·documenting·parameters. |
| Offset 13, 15 lines modified | Offset 13, 15 lines modified | ||
| 13 | It·supports·recursing·into·arrays. | 13 | It·supports·recursing·into·arrays. |
| 14 | It·supports·removing·specific·items·from·an·array,·replacing·each·removed·item·with·unknown·at·the·specified·index. | 14 | It·supports·removing·specific·items·from·an·array,·replacing·each·removed·item·with·unknown·at·the·specified·index. |
| 15 | Use-case:·Remove·unneeded·parts·of·complex·objects. | 15 | Use-case:·Remove·unneeded·parts·of·complex·objects. |
| 16 | Use·[`Omit`](https://www.typescriptlang.org/docs/handbook/utility-types.html#omittype-keys)·if·you·only·need·one·level·deep. | 16 | Use·[`Omit<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#omittype-keys)·if·you·only·need·one·level·deep. |
| 17 | @example | 17 | @example |
| 18 | ``` | 18 | ``` |
| 19 | import·type·{OmitDeep}·from·'type-fest'; | 19 | import·type·{OmitDeep}·from·'type-fest'; |
| 20 | type·Info·=·{ | 20 | type·Info·=·{ |
| 21 | » userInfo:·{ | 21 | » userInfo:·{ |
| Offset 89, 42 lines modified | Offset 89, 42 lines modified | ||
| 89 | » » ?·OmitDeepHelper<OmitDeepWithOnePath<T,·Path·&·(string·|·number)>,·RestPaths> | 89 | » » ?·OmitDeepHelper<OmitDeepWithOnePath<T,·Path·&·(string·|·number)>,·RestPaths> |
| 90 | » » :·T; | 90 | » » :·T; |
| 91 | /** | 91 | /** |
| 92 | Omit·one·path·from·the·given·object/array. | 92 | Omit·one·path·from·the·given·object/array. |
| 93 | */ | 93 | */ |
| 94 | type·OmitDeepWithOnePath<T,·Path·extends·string·|·number>·= | 94 | type·OmitDeepWithOnePath<T,·Path·extends·string·|·number>·= |
| 95 | T·extends·NonRecursiveType | 95 | » T·extends·NonRecursiveType |
| 96 | » ?·T | 96 | » » ?·T |
| 97 | » :·T·extends·UnknownArray·?·SetArrayAccess<OmitDeepArrayWithOnePath<T,·Path>,·IsArrayReadonly<T>> | 97 | » » :·T·extends·UnknownArray·?·SetArrayAccess<OmitDeepArrayWithOnePath<T,·Path>,·IsArrayReadonly<T>> |
| 98 | » » :·T·extends·object·?·OmitDeepObjectWithOnePath<T,·Path> | 98 | » » » :·T·extends·object·?·OmitDeepObjectWithOnePath<T,·Path> |
| 99 | » » » :·T; | 99 | » » » » :·T; |
| 100 | /** | 100 | /** |
| 101 | Omit·one·path·from·the·given·object. | 101 | Omit·one·path·from·the·given·object. |
| 102 | */ | 102 | */ |
| 103 | type·OmitDeepObjectWithOnePath<ObjectT·extends·object,·P·extends·string·|·number>·= | 103 | type·OmitDeepObjectWithOnePath<ObjectT·extends·object,·P·extends·string·|·number>·= |
| 104 | P·extends·`${infer·RecordKeyInPath}.${infer·SubPath}` | 104 | » P·extends·`${infer·RecordKeyInPath}.${infer·SubPath}` |
| 105 | » ?·{ | 105 | » » ?·{ |
| 106 | » » [Key·in·keyof·ObjectT]: | 106 | » » » [Key·in·keyof·ObjectT]: |
| 107 | » » IsEqual<RecordKeyInPath,·ToString<Key>>·extends·true | 107 | » » » IsEqual<RecordKeyInPath,·ToString<Key>>·extends·true |
| 108 | » » » ?·ExactKey<ObjectT,·Key>·extends·infer·RealKey | 108 | » » » » ?·ExactKey<ObjectT,·Key>·extends·infer·RealKey |
| 109 | » » » » ?·RealKey·extends·keyof·ObjectT | 109 | » » » » » ?·RealKey·extends·keyof·ObjectT |
| 110 | » » » » » ?·OmitDeepWithOnePath<ObjectT[RealKey],·SubPath> | 110 | » » » » » » ?·OmitDeepWithOnePath<ObjectT[RealKey],·SubPath> |
| 111 | » » » » » » :·ObjectT[Key] | ||
| 111 | » » » » » :·ObjectT[Key] | 112 | » » » » » :·ObjectT[Key] |
| 112 | » » » » :·ObjectT[Key] | 113 | » » » » :·ObjectT[Key] |
| 113 | » » » :·ObjectT[Key] | ||
| 114 | » } | 114 | » » } |
| 115 | » :·ExactKey<ObjectT,·P>·extends·infer·Key | 115 | » » :·ExactKey<ObjectT,·P>·extends·infer·Key |
| 116 | » » ?·IsNever<Key>·extends·true | 116 | » » » ?·IsNever<Key>·extends·true |
| 117 | » » » ?·ObjectT | 117 | » » » » ?·ObjectT |
| 118 | » » » :·Key·extends·PropertyKey | 118 | » » » » :·Key·extends·PropertyKey |
| 119 | » » » » ?·Omit<ObjectT,·Key> | 119 | » » » » » ?·Omit<ObjectT,·Key> |
| 120 | » » » » :·ObjectT | 120 | » » » » » :·ObjectT |
| 121 | » » :·ObjectT; | 121 | » » » :·ObjectT; |
| 122 | /** | 122 | /** |
| 123 | Omit·one·path·from·from·the·given·array. | 123 | Omit·one·path·from·from·the·given·array. |
| 124 | It·replaces·the·item·to·`unknown`·at·the·given·index. | 124 | It·replaces·the·item·to·`unknown`·at·the·given·index. |
| 125 | @example | 125 | @example |
| Offset 1, 11 lines modified | Offset 1, 11 lines modified | ||
| 1 | import·type·{OrAll}·from·'./or-all.d.ts'; | 1 | import·type·{OrAll}·from·'./or-all.d.ts'; |
| 2 | /** | 2 | /** |
| 3 | Returns·a·boolean·for·whether·either·of·two·given·types·is·true. | 3 | Returns·a·boolean·for·whether·either·of·two·given·types·is·`true`. |
| 4 | Use-case:·Constructing·complex·conditional·types·where·at·least·one·condition·must·be·satisfied. | 4 | Use-case:·Constructing·complex·conditional·types·where·at·least·one·condition·must·be·satisfied. |
| 5 | @example | 5 | @example |
| 6 | ``` | 6 | ``` |
| 7 | import·type·{Or}·from·'type-fest'; | 7 | import·type·{Or}·from·'type-fest'; |
| Offset 695, 16 lines modified | Offset 695, 16 lines modified | ||
| 695 | /** | 695 | /** |
| 696 | Type·for·[npm's·`package.json`·file](https://docs.npmjs.com/creating-a-package-json-file).·Also·includes·types·for·fields·used·by·other·popular·projects,·like·TypeScript·and·Yarn. | 696 | Type·for·[npm's·`package.json`·file](https://docs.npmjs.com/creating-a-package-json-file).·Also·includes·types·for·fields·used·by·other·popular·projects,·like·TypeScript·and·Yarn. |
| 697 | @category·File | 697 | @category·File |
| 698 | */ | 698 | */ |
| 699 | export·type·PackageJson·= | 699 | export·type·PackageJson·= |
| 700 | » JsonObject | 700 | » JsonObject |
| 701 | » PackageJson.NodeJsStandard | 701 | » &·PackageJson.NodeJsStandard |
| 702 | » PackageJson.PackageJsonStandard | 702 | » &·PackageJson.PackageJsonStandard |
| 703 | » PackageJson.NonStandardEntryPoints | 703 | » &·PackageJson.NonStandardEntryPoints |
| 704 | » PackageJson.TypeScriptConfiguration | 704 | » &·PackageJson.TypeScriptConfiguration |
| 705 | » PackageJson.YarnConfiguration | 705 | » &·PackageJson.YarnConfiguration |
| 706 | » PackageJson.JSPMConfiguration; | 706 | » &·PackageJson.JSPMConfiguration; |
| 707 | export·{}; | 707 | export·{}; |
| Offset 40, 20 lines modified | Offset 40, 22 lines modified | ||
| 40 | type·DefaultPartialDeepOptions·=·{ | 40 | type·DefaultPartialDeepOptions·=·{ |
| 41 | » recurseIntoArrays:·false; | 41 | » recurseIntoArrays:·false; |
| 42 | » allowUndefinedInNonTupleArrays:·false; | 42 | » allowUndefinedInNonTupleArrays:·false; |
| 43 | }; | 43 | }; |
| 44 | /** | 44 | /** |
| 45 | Create·a· | 45 | Create·a·deeply·optional·version·of·another·type. |
| 46 | Use-cases: | 46 | Use-cases: |
| 47 | -·Merging·a·default·settings/config·object·with·another·object,·the·second·object·would·be·a·deep·partial·of·the·default·object. | 47 | -·Merging·a·default·settings/config·object·with·another·object,·the·second·object·would·be·a·deep·partial·of·the·default·object. |
| 48 | -·Mocking·and·testing·complex·entities,·where·populating·an·entire·object·with·its·keys·would·be·redundant·in·terms·of·the·mock·or·test. | 48 | -·Mocking·and·testing·complex·entities,·where·populating·an·entire·object·with·its·keys·would·be·redundant·in·terms·of·the·mock·or·test. |
| 49 | Use·[`Partial<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#partialtype)·if·you·only·need·one·level·deep. | ||
| 49 | @example | 50 | @example |
| 50 | ``` | 51 | ``` |
| 51 | import·type·{PartialDeep}·from·'type-fest'; | 52 | import·type·{PartialDeep}·from·'type-fest'; |
| 52 | let·settings·=·{ | 53 | let·settings·=·{ |
| 53 | » textEditor:·{ | 54 | » textEditor:·{ |
| 54 | » » fontSize:·14, | 55 | » » fontSize:·14, |
| Offset 8, 14 lines modified | Offset 8, 15 lines modified | ||
| 8 | ``` | 8 | ``` |
| 9 | import·type·{PascalCase}·from·'type-fest'; | 9 | import·type·{PascalCase}·from·'type-fest'; |
| 10 | //·Simple | 10 | //·Simple |
| 11 | const·someVariable:·PascalCase<'foo-bar'>·=·'FooBar'; | 11 | const·someVariable:·PascalCase<'foo-bar'>·=·'FooBar'; |
| 12 | const·preserveConsecutiveUppercase:·PascalCase<'foo-BAR-baz',·{preserveConsecutiveUppercase:·true}>·=·'FooBARBaz'; | 12 | const·preserveConsecutiveUppercase:·PascalCase<'foo-BAR-baz',·{preserveConsecutiveUppercase:·true}>·=·'FooBARBaz'; |
| 13 | const·splitOnPunctuation:·PascalCase<'foo-bar>>baz',·{splitOnPunctuation:·true}>·=·'FooBarBaz'; | ||
| 13 | //·Advanced | 14 | //·Advanced |
| 14 | type·PascalCasedProperties<T>·=·{ | 15 | type·PascalCasedProperties<T>·=·{ |
| 15 | » [K·in·keyof·T·as·PascalCase<K>]:·T[K] | 16 | » [K·in·keyof·T·as·PascalCase<K>]:·T[K] |
| 16 | }; | 17 | }; |
| Offset 44, 14 lines modified | Offset 44, 21 lines modified | ||
| 44 | const·preserveConsecutiveUppercase:·PascalCasedPropertiesDeep<{fooBAR:·{fooBARBiz:·[{fooBARBaz:·string}]}},·{preserveConsecutiveUppercase:·true}>·=·{ | 44 | const·preserveConsecutiveUppercase:·PascalCasedPropertiesDeep<{fooBAR:·{fooBARBiz:·[{fooBARBaz:·string}]}},·{preserveConsecutiveUppercase:·true}>·=·{ |
| 45 | » FooBAR:·{ | 45 | » FooBAR:·{ |
| 46 | » » FooBARBiz:·[{ | 46 | » » FooBARBiz:·[{ |
| 47 | » » » FooBARBaz:·'string', | 47 | » » » FooBARBaz:·'string', |
| 48 | » » }], | 48 | » » }], |
| 49 | » }, | 49 | » }, |
| 50 | }; | 50 | }; |
| 51 | const·splitOnPunctuation:·PascalCasedPropertiesDeep<{'user@info':·{'user::id':·number;·'user::name':·string}},·{splitOnPunctuation:·true}>·=·{ | ||
| 52 | » UserInfo:·{ | ||
| 53 | » » UserId:·1, | ||
| 54 | » » UserName:·'Tom', | ||
| 55 | » }, | ||
| 56 | }; | ||
| 51 | ``` | 57 | ``` |
| 52 | @category·Change·case | 58 | @category·Change·case |
| 53 | @category·Template·literal | 59 | @category·Template·literal |
| 54 | @category·Object | 60 | @category·Object |
| 55 | */ | 61 | */ |
| 56 | export·type·PascalCasedPropertiesDeep<Value,·Options·extends·CamelCaseOptions·=·{}>·= | 62 | export·type·PascalCasedPropertiesDeep<Value,·Options·extends·CamelCaseOptions·=·{}>·= |
| Offset 1, 13 lines modified | Offset 1, 13 lines modified | ||
| 1 | import·type·{CamelCaseOptions,·_DefaultCamelCaseOptions}·from·'./camel-case.d.ts'; | 1 | import·type·{CamelCaseOptions,·_DefaultCamelCaseOptions}·from·'./camel-case.d.ts'; |
| 2 | import·type·{ApplyDefaultOptions}·from·'./internal/index.d.ts'; | 2 | import·type·{ApplyDefaultOptions}·from·'./internal/index.d.ts'; |
| 3 | import·type·{PascalCase}·from·'./pascal-case.d.ts'; | 3 | import·type·{PascalCase}·from·'./pascal-case.d.ts'; |
| 4 | /** | 4 | /** |
| 5 | Convert·object·properties·to·pascal·ca | 5 | Convert·top-level·object·properties·to·pascal·case. |
| 6 | This·can·be·useful·when,·for·example,·converting·some·API·types·from·a·different·style. | 6 | This·can·be·useful·when,·for·example,·converting·some·API·types·from·a·different·style. |
| 7 | @see·{@link·PascalCase} | 7 | @see·{@link·PascalCase} |
| 8 | @see·{@link·PascalCasedPropertiesDeep} | 8 | @see·{@link·PascalCasedPropertiesDeep} |
| 9 | @example | 9 | @example |
| Offset 23, 14 lines modified | Offset 23, 18 lines modified | ||
| 23 | » UserId:·1, | 23 | » UserId:·1, |
| 24 | » UserName:·'Tom', | 24 | » UserName:·'Tom', |
| 25 | }; | 25 | }; |
| 26 | const·preserveConsecutiveUppercase:·PascalCasedProperties<{fooBAR:·string},·{preserveConsecutiveUppercase:·true}>·=·{ | 26 | const·preserveConsecutiveUppercase:·PascalCasedProperties<{fooBAR:·string},·{preserveConsecutiveUppercase:·true}>·=·{ |
| 27 | » FooBAR:·'string', | 27 | » FooBAR:·'string', |
| 28 | }; | 28 | }; |
| 29 | const·splitOnPunctuation:·PascalCasedProperties<{'foo::bar':·string},·{splitOnPunctuation:·true}>·=·{ | ||
| 30 | » FooBar:·'string', | ||
| 31 | }; | ||
| 29 | ``` | 32 | ``` |
| 30 | @category·Change·case | 33 | @category·Change·case |
| 31 | @category·Template·literal | 34 | @category·Template·literal |
| 32 | @category·Object | 35 | @category·Object |
| 33 | */ | 36 | */ |
| 34 | export·type·PascalCasedProperties<Value,·Options·extends·CamelCaseOptions·=·{}>·=·Value·extends·Function | 37 | export·type·PascalCasedProperties<Value,·Options·extends·CamelCaseOptions·=·{}>·=·Value·extends·Function |
| Offset 10, 14 lines modified | Offset 10, 16 lines modified | ||
| 10 | /** | 10 | /** |
| 11 | Pick·properties·from·a·deeply-nested·object. | 11 | Pick·properties·from·a·deeply-nested·object. |
| 12 | It·supports·recursing·into·arrays. | 12 | It·supports·recursing·into·arrays. |
| 13 | Use-case:·Distill·complex·objects·down·to·the·components·you·need·to·target. | 13 | Use-case:·Distill·complex·objects·down·to·the·components·you·need·to·target. |
| 14 | Use·[`Pick<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#picktype-keys)·if·you·only·need·one·level·deep. | ||
| 14 | @example | 15 | @example |
| 15 | ``` | 16 | ``` |
| 16 | import·type·{PickDeep,·PartialDeep}·from·'type-fest'; | 17 | import·type·{PickDeep,·PartialDeep}·from·'type-fest'; |
| 17 | type·Configuration·=·{ | 18 | type·Configuration·=·{ |
| 18 | » userConfig:·{ | 19 | » userConfig:·{ |
| 19 | » » name:·string; | 20 | » » name:·string; |
| Offset 1, 16 lines modified | Offset 1, 18 lines modified | ||
| 1 | import·type·{BuiltIns,·HasMultipleCallSignatures}·from·'./internal/index.d.ts'; | 1 | import·type·{BuiltIns,·HasMultipleCallSignatures}·from·'./internal/index.d.ts'; |
| 2 | /** | 2 | /** |
| 3 | C | 3 | Create·a·deeply·immutable·version·of·another·type. |
| 4 | This·is·useful·when·a·deeply·nested·structure·needs·to·be·exposed·as·completely·immutable,·for·example,·an·imported·JSON·module·or·when·receiving·an·API·response·that·is·passed·around. | 4 | This·is·useful·when·a·deeply·nested·structure·needs·to·be·exposed·as·completely·immutable,·for·example,·an·imported·JSON·module·or·when·receiving·an·API·response·that·is·passed·around. |
| 5 | Please·upvote·[this·issue](https://github.com/microsoft/TypeScript/issues/13923)·if·you·want·to·have·this·type·as·a·built-in·in·TypeScript. | 5 | Please·upvote·[this·issue](https://github.com/microsoft/TypeScript/issues/13923)·if·you·want·to·have·this·type·as·a·built-in·in·TypeScript. |
| 6 | Use·[`Readonly<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#readonlytype)·if·you·only·need·one·level·deep. | ||
| 6 | @example | 7 | @example |
| 7 | ``` | 8 | ``` |
| 8 | import·type·{ReadonlyDeep}·from·'type-fest'; | 9 | import·type·{ReadonlyDeep}·from·'type-fest'; |
| 9 | declare·const·foo:·{ | 10 | declare·const·foo:·{ |
| 10 | » a:·string; | 11 | » a:·string; |
| 11 | » b:·{c:·number}; | 12 | » b:·{c:·number}; |
| Offset 79, 16 lines modified | Offset 81, 16 lines modified | ||
| 79 | » » » » :·HasMultipleCallSignatures<T>·extends·true | 81 | » » » » :·HasMultipleCallSignatures<T>·extends·true |
| 80 | » » » » » ?·T | 82 | » » » » » ?·T |
| 81 | » » » » » :·((...arguments_:·Parameters<T>)·=>·ReturnType<T>)·&·_ReadonlyObjectDeep<T> | 83 | » » » » » :·((...arguments_:·Parameters<T>)·=>·ReturnType<T>)·&·_ReadonlyObjectDeep<T> |
| 82 | » » » :·T·extends·Readonly<ReadonlyMap<infer·KeyType,·infer·ValueType>> | 84 | » » » :·T·extends·Readonly<ReadonlyMap<infer·KeyType,·infer·ValueType>> |
| 83 | » » » » ?·ReadonlyMapDeep<KeyType,·ValueType> | 85 | » » » » ?·ReadonlyMapDeep<KeyType,·ValueType> |
| 84 | » » » » :·T·extends·Readonly<ReadonlySet<infer·ItemType>> | 86 | » » » » :·T·extends·Readonly<ReadonlySet<infer·ItemType>> |
| 85 | » » » » » ?·ReadonlySetDeep<ItemType> | 87 | » » » » » ?·ReadonlySetDeep<ItemType> |
| 86 | » » » » » | 88 | » » » » » //·Identify·tuples·to·avoid·converting·them·to·arrays·inadvertently;·special·case·`readonly·[...never[]]`,·as·it·emerges·undesirably·from·recursive·invocations·of·ReadonlyDeep·below. |
| 87 | » » » » » T·extends·readonly·[]·|·readonly·[...never[]] | 89 | » » » » » :·T·extends·readonly·[]·|·readonly·[...never[]] |
| 88 | » » » » » » ?·readonly·[] | 90 | » » » » » » ?·readonly·[] |
| 89 | » » » » » » :·T·extends·readonly·[infer·U,·...infer·V] | 91 | » » » » » » :·T·extends·readonly·[infer·U,·...infer·V] |
| 90 | » » » » » » » ?·readonly·[ReadonlyDeep<U>,·...ReadonlyDeep<V>] | 92 | » » » » » » » ?·readonly·[ReadonlyDeep<U>,·...ReadonlyDeep<V>] |
| 91 | » » » » » » » :·T·extends·readonly·[...infer·U,·infer·V] | 93 | » » » » » » » :·T·extends·readonly·[...infer·U,·infer·V] |
| 92 | » » » » » » » » ?·readonly·[...ReadonlyDeep<U>,·ReadonlyDeep<V>] | 94 | » » » » » » » » ?·readonly·[...ReadonlyDeep<U>,·ReadonlyDeep<V>] |
| 93 | » » » » » » » » :·T·extends·ReadonlyArray<infer·ItemType> | 95 | » » » » » » » » :·T·extends·ReadonlyArray<infer·ItemType> |
| 94 | » » » » » » » » » ?·ReadonlyArray<ReadonlyDeep<ItemType>> | 96 | » » » » » » » » » ?·ReadonlyArray<ReadonlyDeep<ItemType>> |
| Offset 106, 27 lines modified | Offset 106, 27 lines modified | ||
| 106 | @see·{@link·RemovePrefixOptions} | 106 | @see·{@link·RemovePrefixOptions} |
| 107 | @category·String | 107 | @category·String |
| 108 | @category·Template·literal | 108 | @category·Template·literal |
| 109 | */ | 109 | */ |
| 110 | export·type·RemovePrefix<S·extends·string,·Prefix·extends·string,·Options·extends·RemovePrefixOptions·=·{}>·= | 110 | export·type·RemovePrefix<S·extends·string,·Prefix·extends·string,·Options·extends·RemovePrefixOptions·=·{}>·= |
| 111 | IfNotAnyOrNever< | ||
| 112 | » S, | ||
| 113 | » IfNotAnyOrNever< | 111 | » IfNotAnyOrNever< |
| 112 | » » S, | ||
| 113 | » » IfNotAnyOrNever< | ||
| 114 | » » Prefix, | 114 | » » » Prefix, |
| 115 | » » _RemovePrefix<S,·Prefix,·ApplyDefaultOptions<RemovePrefixOptions,·DefaultRemovePrefixOptions,·Options>>, | 115 | » » » _RemovePrefix<S,·Prefix,·ApplyDefaultOptions<RemovePrefixOptions,·DefaultRemovePrefixOptions,·Options>>, |
| 116 | » » string, | 116 | » » » string, |
| 117 | » » S | 117 | » » » S |
| 118 | » > | 118 | » » > |
| 119 | >; | 119 | » >; |
| 120 | type·_RemovePrefix<S·extends·string,·Prefix·extends·string,·Options·extends·Required<RemovePrefixOptions>>·= | 120 | type·_RemovePrefix<S·extends·string,·Prefix·extends·string,·Options·extends·Required<RemovePrefixOptions>>·= |
| 121 | Prefix·extends·string·//·For·distributing·`Prefix` | 121 | » Prefix·extends·string·//·For·distributing·`Prefix` |
| 122 | » ?·S·extends·`${Prefix}${infer·Rest}` | 122 | » » ?·S·extends·`${Prefix}${infer·Rest}` |
| 123 | » » ?·Or<IsStringLiteral<Prefix>,·Not<Options['strict']>>·extends·true | 123 | » » » ?·Or<IsStringLiteral<Prefix>,·Not<Options['strict']>>·extends·true |
| 124 | » » » ?·Rest | 124 | » » » » ?·Rest |
| 125 | » » » :·string·//·Fallback·to·`string`·when·`Prefix`·is·non-literal·and·`strict`·is·disabled | 125 | » » » » :·string·//·Fallback·to·`string`·when·`Prefix`·is·non-literal·and·`strict`·is·disabled |
| 126 | » » :·S·//·Return·back·`S`·when·`Prefix`·is·not·present·at·the·start·of·`S` | 126 | » » » :·S·//·Return·back·`S`·when·`Prefix`·is·not·present·at·the·start·of·`S` |
| 127 | » :·never; | 127 | » » :·never; |
| 128 | export·{}; | 128 | export·{}; |
| Offset 23, 25 lines modified | Offset 23, 25 lines modified | ||
| 23 | declare·function·replace< | 23 | declare·function·replace< |
| 24 | » Input·extends·string, | 24 | » Input·extends·string, |
| 25 | » Search·extends·string, | 25 | » Search·extends·string, |
| 26 | » Replacement·extends·string, | 26 | » Replacement·extends·string, |
| 27 | >( | 27 | >( |
| 28 | » input:·Input, | 28 | » input:·Input, |
| 29 | » search:·Search, | 29 | » search:·Search, |
| 30 | » replacement:·Replacement | 30 | » replacement:·Replacement, |
| 31 | ):·Replace<Input,·Search,·Replacement>; | 31 | ):·Replace<Input,·Search,·Replacement>; |
| 32 | declare·function·replaceAll< | 32 | declare·function·replaceAll< |
| 33 | » Input·extends·string, | 33 | » Input·extends·string, |
| 34 | » Search·extends·string, | 34 | » Search·extends·string, |
| 35 | » Replacement·extends·string, | 35 | » Replacement·extends·string, |
| 36 | >( | 36 | >( |
| 37 | » input:·Input, | 37 | » input:·Input, |
| 38 | » search:·Search, | 38 | » search:·Search, |
| 39 | » replacement:·Replacement | 39 | » replacement:·Replacement, |
| 40 | ):·Replace<Input,·Search,·Replacement,·{all:·true}>; | 40 | ):·Replace<Input,·Search,·Replacement,·{all:·true}>; |
| 41 | //·The·return·type·is·the·exact·string·literal,·not·just·`string`. | 41 | //·The·return·type·is·the·exact·string·literal,·not·just·`string`. |
| 42 | replace('hello·?',·'?',·'🦄'); | 42 | replace('hello·?',·'?',·'🦄'); |
| 43 | //=>·'hello·🦄' | 43 | //=>·'hello·🦄' |
| Offset 5, 15 lines modified | Offset 5, 15 lines modified | ||
| 5 | /** | 5 | /** |
| 6 | Requires·all·of·the·keys·in·the·given·object. | 6 | Requires·all·of·the·keys·in·the·given·object. |
| 7 | */ | 7 | */ |
| 8 | type·RequireAll<ObjectType,·KeysType·extends·keyof·ObjectType>·=·Required<Pick<ObjectType,·KeysType>>; | 8 | type·RequireAll<ObjectType,·KeysType·extends·keyof·ObjectType>·=·Required<Pick<ObjectType,·KeysType>>; |
| 9 | /** | 9 | /** |
| 10 | Create·a·type·that·requires·all·of·the·given·keys·or·none·of·the·given·keys | 10 | Create·a·type·that·requires·all·of·the·given·keys·or·none·of·the·given·keys,·while·keeping·the·remaining·keys·as·is. |
| 11 | Use-cases: | 11 | Use-cases: |
| 12 | -·Creating·interfaces·for·components·with·mutually-inclusive·keys. | 12 | -·Creating·interfaces·for·components·with·mutually-inclusive·keys. |
| 13 | The·caveat·with·`RequireAllOrNone`·is·that·TypeScript·doesn't·always·know·at·compile·time·every·key·that·will·exist·at·runtime.·Therefore·`RequireAllOrNone`·can't·do·anything·to·prevent·extra·keys·it·doesn't·know·about. | 13 | The·caveat·with·`RequireAllOrNone`·is·that·TypeScript·doesn't·always·know·at·compile·time·every·key·that·will·exist·at·runtime.·Therefore·`RequireAllOrNone`·can't·do·anything·to·prevent·extra·keys·it·doesn't·know·about. |
| 14 | @example | 14 | @example |
| Offset 1, 15 lines modified | Offset 1, 15 lines modified | ||
| 1 | import·type·{Except}·from·'./except.d.ts'; | 1 | import·type·{Except}·from·'./except.d.ts'; |
| 2 | import·type·{If}·from·'./if.d.ts'; | 2 | import·type·{If}·from·'./if.d.ts'; |
| 3 | import·type·{IfNotAnyOrNever}·from·'./internal/index.d.ts'; | 3 | import·type·{IfNotAnyOrNever}·from·'./internal/index.d.ts'; |
| 4 | import·type·{IsAny}·from·'./is-any.d.ts'; | 4 | import·type·{IsAny}·from·'./is-any.d.ts'; |
| 5 | import·type·{IsNever}·from·'./is-never.d.ts'; | 5 | import·type·{IsNever}·from·'./is-never.d.ts'; |
| 6 | /** | 6 | /** |
| 7 | Create·a·type·that·requires·at·least·one·of·the·given·keys | 7 | Create·a·type·that·requires·at·least·one·of·the·given·keys,·while·keeping·the·remaining·keys·as·is. |
| 8 | @example | 8 | @example |
| 9 | ``` | 9 | ``` |
| 10 | import·type·{RequireAtLeastOne}·from·'type-fest'; | 10 | import·type·{RequireAtLeastOne}·from·'type-fest'; |
| 11 | type·Responder·=·{ | 11 | type·Responder·=·{ |
| 12 | » text?:·()·=>·string; | 12 | » text?:·()·=>·string; |
| Offset 36, 15 lines modified | Offset 36, 13 lines modified | ||
| 36 | » » >>; | 36 | » » >>; |
| 37 | type·_RequireAtLeastOne< | 37 | type·_RequireAtLeastOne< |
| 38 | » ObjectType, | 38 | » ObjectType, |
| 39 | » KeysType·extends·keyof·ObjectType, | 39 | » KeysType·extends·keyof·ObjectType, |
| 40 | >·=·{ | 40 | >·=·{ |
| 41 | » //·For·each·`Key`·in·`KeysType`·make·a·mapped·type: | 41 | » //·For·each·`Key`·in·`KeysType`·make·a·mapped·type: |
| 42 | » [Key·in·KeysType]-?:·Required<Pick<ObjectType,·Key>>· | 42 | » [Key·in·KeysType]-?:·Required<Pick<ObjectType,·Key>>·//·1.·Make·`Key`'s·type·required |
| 43 | » » &·Partial<Pick<ObjectType,·Exclude<KeysType,·Key>>>;·//·2.·Make·all·other·keys·in·`KeysType`·optional | ||
| 43 | » //·2.·Make·all·other·keys·in·`KeysType`·optional | ||
| 44 | » » Partial<Pick<ObjectType,·Exclude<KeysType,·Key>>>; | ||
| 45 | }[KeysType] | 44 | }[KeysType] |
| 45 | &·Except<ObjectType,·KeysType>;·//·3.·Add·the·remaining·keys·not·in·`KeysType` | ||
| 46 | //·3.·Add·the·remaining·keys·not·in·`KeysType` | ||
| 47 | Except<ObjectType,·KeysType>; | ||
| 48 | export·{}; | 46 | export·{}; |
| Offset 1, 14 lines modified | Offset 1, 14 lines modified | ||
| 1 | import·type·{If}·from·'./if.d.ts'; | 1 | import·type·{If}·from·'./if.d.ts'; |
| 2 | import·type·{IfNotAnyOrNever}·from·'./internal/index.d.ts'; | 2 | import·type·{IfNotAnyOrNever}·from·'./internal/index.d.ts'; |
| 3 | import·type·{IsAny}·from·'./is-any.d.ts'; | 3 | import·type·{IsAny}·from·'./is-any.d.ts'; |
| 4 | import·type·{IsNever}·from·'./is-never.d.ts'; | 4 | import·type·{IsNever}·from·'./is-never.d.ts'; |
| 5 | /** | 5 | /** |
| 6 | Create·a·type·that·requires·exactly·one·of·the·given·keys·and·disallows·more | 6 | Create·a·type·that·requires·exactly·one·of·the·given·keys·and·disallows·more,·while·keeping·the·remaining·keys·as·is. |
| 7 | Use-cases: | 7 | Use-cases: |
| 8 | -·Creating·interfaces·for·components·that·only·need·one·of·the·keys·to·display·properly. | 8 | -·Creating·interfaces·for·components·that·only·need·one·of·the·keys·to·display·properly. |
| 9 | -·Declaring·generic·keys·in·a·single·place·for·a·single·use-case·that·gets·narrowed·down·via·`RequireExactlyOne`. | 9 | -·Declaring·generic·keys·in·a·single·place·for·a·single·use-case·that·gets·narrowed·down·via·`RequireExactlyOne`. |
| 10 | The·caveat·with·`RequireExactlyOne`·is·that·TypeScript·doesn't·always·know·at·compile·time·every·key·that·will·exist·at·runtime.·Therefore·`RequireExactlyOne`·can't·do·anything·to·prevent·extra·keys·it·doesn't·know·about. | 10 | The·caveat·with·`RequireExactlyOne`·is·that·TypeScript·doesn't·always·know·at·compile·time·every·key·that·will·exist·at·runtime.·Therefore·`RequireExactlyOne`·can't·do·anything·to·prevent·extra·keys·it·doesn't·know·about. |
| Offset 37, 12 lines modified | Offset 37, 12 lines modified | ||
| 37 | » » If<IsNever<KeysType>, | 37 | » » If<IsNever<KeysType>, |
| 38 | » » » never, | 38 | » » » never, |
| 39 | » » » _RequireExactlyOne<ObjectType,·If<IsAny<KeysType>,·keyof·ObjectType,·KeysType>> | 39 | » » » _RequireExactlyOne<ObjectType,·If<IsAny<KeysType>,·keyof·ObjectType,·KeysType>> |
| 40 | » » >>; | 40 | » » >>; |
| 41 | type·_RequireExactlyOne<ObjectType,·KeysType·extends·keyof·ObjectType>·= | 41 | type·_RequireExactlyOne<ObjectType,·KeysType·extends·keyof·ObjectType>·= |
| 42 | » {[Key·in·KeysType]:·( | 42 | » {[Key·in·KeysType]:·( |
| 43 | » » Required<Pick<ObjectType,·Key>> | 43 | » » Required<Pick<ObjectType,·Key>> |
| 44 | » » Partial<Record<Exclude<KeysType,·Key>,·never>> | 44 | » » &·Partial<Record<Exclude<KeysType,·Key>,·never>> |
| 45 | » )}[KeysType]·&·Omit<ObjectType,·KeysType>; | 45 | » )}[KeysType]·&·Omit<ObjectType,·KeysType>; |
| 46 | export·{}; | 46 | export·{}; |
| Offset 1, 15 lines modified | Offset 1, 15 lines modified | ||
| 1 | import·type·{RequireExactlyOne}·from·'./require-exactly-one.d.ts'; | 1 | import·type·{RequireExactlyOne}·from·'./require-exactly-one.d.ts'; |
| 2 | import·type·{IfNotAnyOrNever,·RequireNone}·from·'./internal/index.d.ts'; | 2 | import·type·{IfNotAnyOrNever,·RequireNone}·from·'./internal/index.d.ts'; |
| 3 | import·type·{If}·from·'./if.d.ts'; | 3 | import·type·{If}·from·'./if.d.ts'; |
| 4 | import·type·{IsAny}·from·'./is-any.d.ts'; | 4 | import·type·{IsAny}·from·'./is-any.d.ts'; |
| 5 | import·type·{IsNever}·from·'./is-never.d.ts'; | 5 | import·type·{IsNever}·from·'./is-never.d.ts'; |
| 6 | /** | 6 | /** |
| 7 | Create·a·type·that·requires·exactly·one·of·the·given·keys· | 7 | Create·a·type·that·requires·exactly·one·of·the·given·keys·or·none·of·the·given·keys,·while·keeping·the·remaining·keys·as·is. |
| 8 | @example | 8 | @example |
| 9 | ``` | 9 | ``` |
| 10 | import·type·{RequireOneOrNone}·from·'type-fest'; | 10 | import·type·{RequireOneOrNone}·from·'type-fest'; |
| 11 | type·Responder·=·RequireOneOrNone<{ | 11 | type·Responder·=·RequireOneOrNone<{ |
| 12 | » text:·()·=>·string; | 12 | » text:·()·=>·string; |
| Offset 1, 18 lines modified | Offset 1, 20 lines modified | ||
| 1 | import·type·{BuiltIns,·HasMultipleCallSignatures}·from·'./internal/index.d.ts'; | 1 | import·type·{BuiltIns,·HasMultipleCallSignatures}·from·'./internal/index.d.ts'; |
| 2 | import·type·{IsNever}·from·'./is-never.d.ts'; | 2 | import·type·{IsNever}·from·'./is-never.d.ts'; |
| 3 | import·type·{Simplify}·from·'./simplify.d.ts'; | 3 | import·type·{Simplify}·from·'./simplify.d.ts'; |
| 4 | /** | 4 | /** |
| 5 | Create·a· | 5 | Create·a·deeply·required·version·of·another·type. |
| 6 | Use-cases: | 6 | Use-cases: |
| 7 | -·Creating·optional·configuration·interfaces·where·the·underlying·implementation·still·requires·all·options·to·be·fully·specified. | 7 | -·Creating·optional·configuration·interfaces·where·the·underlying·implementation·still·requires·all·options·to·be·fully·specified. |
| 8 | -·Modeling·the·resulting·type·after·a·deep·merge·with·a·set·of·defaults. | 8 | -·Modeling·the·resulting·type·after·a·deep·merge·with·a·set·of·defaults. |
| 9 | Use·[`Required<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#requiredtype)·if·you·only·need·one·level·deep. | ||
| 9 | @example | 10 | @example |
| 10 | ``` | 11 | ``` |
| 11 | import·type·{RequiredDeep}·from·'type-fest'; | 12 | import·type·{RequiredDeep}·from·'type-fest'; |
| 12 | type·Settings·=·{ | 13 | type·Settings·=·{ |
| 13 | » textEditor?:·{ | 14 | » textEditor?:·{ |
| 14 | » » fontSize?:·number; | 15 | » » fontSize?:·number; |
| Offset 10, 14 lines modified | Offset 10, 15 lines modified | ||
| 10 | @example | 10 | @example |
| 11 | ``` | 11 | ``` |
| 12 | import·type·{ScreamingSnakeCase}·from·'type-fest'; | 12 | import·type·{ScreamingSnakeCase}·from·'type-fest'; |
| 13 | const·someVariable:·ScreamingSnakeCase<'fooBar'>·=·'FOO_BAR'; | 13 | const·someVariable:·ScreamingSnakeCase<'fooBar'>·=·'FOO_BAR'; |
| 14 | const·someVariableNoSplitOnNumbers:·ScreamingSnakeCase<'p2pNetwork',·{splitOnNumbers:·false}>·=·'P2P_NETWORK'; | 14 | const·someVariableNoSplitOnNumbers:·ScreamingSnakeCase<'p2pNetwork',·{splitOnNumbers:·false}>·=·'P2P_NETWORK'; |
| 15 | const·someVariableWithPunctuation:·ScreamingSnakeCase<'div.card::after',·{splitOnPunctuation:·true}>·=·'DIV_CARD_AFTER'; | ||
| 15 | ``` | 16 | ``` |
| 16 | @category·Change·case | 17 | @category·Change·case |
| 17 | @category·Template·literal | 18 | @category·Template·literal |
| 18 | ·*/ | 19 | ·*/ |
| 19 | export·type·ScreamingSnakeCase< | 20 | export·type·ScreamingSnakeCase< |
| Offset 1, 18 lines modified | Offset 1, 20 lines modified | ||
| 1 | import·type·{NonRecursiveType,·StringToNumber}·from·'./internal/index.d.ts'; | 1 | import·type·{NonRecursiveType,·StringToNumber}·from·'./internal/index.d.ts'; |
| 2 | import·type·{IsAny}·from·'./is-any.d.ts'; | ||
| 3 | import·type·{NonNullableDeep}·from·'./non-nullable-deep.d.ts'; | ||
| 2 | import·type·{Paths}·from·'./paths.d.ts'; | 4 | import·type·{Paths}·from·'./paths.d.ts'; |
| 3 | import·type·{SetNonNullable}·from·'./set-non-nullable.d.ts'; | 5 | import·type·{SetNonNullable}·from·'./set-non-nullable.d.ts'; |
| 4 | import·type·{Simplify}·from·'./simplify.d.ts'; | 6 | import·type·{Simplify}·from·'./simplify.d.ts'; |
| 5 | import·type·{UnionToTuple}·from·'./union-to-tuple.d.ts'; | 7 | import·type·{UnionToTuple}·from·'./union-to-tuple.d.ts'; |
| 6 | import·type·{UnknownArray}·from·'./unknown-array.d.ts'; | 8 | import·type·{UnknownArray}·from·'./unknown-array.d.ts'; |
| 7 | /** | 9 | /** |
| 8 | Create·a·type·that·makes·the·specified·keys·non-nullable·(removes·`null`·and·`undefined`),·supports·deeply·nested·key·paths,·and·leaves·all·other·keys·unchanged. | 10 | Create·a·type·that·makes·the·specified·keys·non-nullable·(removes·`null`·and·`undefined`),·supports·deeply·nested·key·paths,·and·leaves·all·other·keys·unchanged. |
| 9 | NOTE:·Optional·modifiers·(`?`)·are·not·removed·from·properties.·For·example,·`SetNonNullableDeep<{foo?:·string·|·null·|·undefined},·'foo'>`·will·result·in·`{foo?:·string}`. | 11 | NOTE:·Optional·modifiers·(`?`)·are·not·removed·from·properties.·For·example,·`SetNonNullableDeep<{foo?:·string·|·null·|·undefined},·'foo'>`·will·result·in·`{foo?:·string}`.·To·remove·both·optional·modifiers·and·nullables,·use·{@link·SetRequiredDeep}·in·conjunction·with·this·type. |
| 10 | @example | 12 | @example |
| 11 | ``` | 13 | ``` |
| 12 | import·type·{SetNonNullableDeep}·from·'type-fest'; | 14 | import·type·{SetNonNullableDeep}·from·'type-fest'; |
| 13 | type·User·=·{ | 15 | type·User·=·{ |
| 14 | » name:·string; | 16 | » name:·string; |
| Offset 51, 16 lines modified | Offset 53, 17 lines modified | ||
| 51 | //·Optional·modifier·(`?`)·is·not·removed. | 53 | //·Optional·modifier·(`?`)·is·not·removed. |
| 52 | type·ArrayExample2·=·SetNonNullableDeep<{a:·[(number·|·null)?,·(number·|·null)?]},·'a.1'>; | 54 | type·ArrayExample2·=·SetNonNullableDeep<{a:·[(number·|·null)?,·(number·|·null)?]},·'a.1'>; |
| 53 | //=>·{a:·[(number·|·null)?,·number?]} | 55 | //=>·{a:·[(number·|·null)?,·number?]} |
| 54 | ``` | 56 | ``` |
| 55 | @category·Object | 57 | @category·Object |
| 56 | */ | 58 | */ |
| 57 | export·type·SetNonNullableDeep<BaseType,·KeyPaths·extends·Paths<BaseType>>·= | 59 | export·type·SetNonNullableDeep<BaseType,·KeyPaths·extends·Paths<BaseType>>·=·IsAny<KeyPaths>·extends·true |
| 60 | » ?·NonNullableDeep<BaseType> | ||
| 58 | » SetNonNullableDeepHelper<BaseType,·UnionToTuple<KeyPaths>>; | 61 | » :·SetNonNullableDeepHelper<BaseType,·UnionToTuple<KeyPaths>>; |
| 59 | /** | 62 | /** |
| 60 | Internal·helper·for·{@link·SetNonNullableDeep}. | 63 | Internal·helper·for·{@link·SetNonNullableDeep}. |
| 61 | Recursively·transforms·the·`BaseType`·by·applying·{@link·SetNonNullableDeepSinglePath}·for·each·path·in·`KeyPathsTuple`. | 64 | Recursively·transforms·the·`BaseType`·by·applying·{@link·SetNonNullableDeepSinglePath}·for·each·path·in·`KeyPathsTuple`. |
| 62 | */ | 65 | */ |
| 63 | type·SetNonNullableDeepHelper<BaseType,·KeyPathsTuple·extends·UnknownArray>·= | 66 | type·SetNonNullableDeepHelper<BaseType,·KeyPathsTuple·extends·UnknownArray>·= |
| Offset 1, 9 lines modified | Offset 1, 9 lines modified | ||
| 1 | /** | 1 | /** |
| 2 | Create·a·type·that·makes·the·given·keys·non-nullable,·whe | 2 | Create·a·type·that·makes·the·given·keys·non-nullable,·while·keeping·the·remaining·keys·as·is. |
| 3 | If·no·keys·are·given,·all·keys·will·be·made·non-nullable. | 3 | If·no·keys·are·given,·all·keys·will·be·made·non-nullable. |
| 4 | Use-case:·You·want·to·define·a·single·model·where·the·only·thing·that·changes·is·whether·or·not·some·or·all·of·the·keys·are·non-nullable. | 4 | Use-case:·You·want·to·define·a·single·model·where·the·only·thing·that·changes·is·whether·or·not·some·or·all·of·the·keys·are·non-nullable. |
| 5 | @example | 5 | @example |
| 6 | ``` | 6 | ``` |
| Offset 1, 13 lines modified | Offset 1, 13 lines modified | ||
| 1 | import·type·{Except}·from·'./except.d.ts'; | 1 | import·type·{Except}·from·'./except.d.ts'; |
| 2 | import·type·{HomomorphicPick}·from·'./internal/index.d.ts'; | 2 | import·type·{HomomorphicPick}·from·'./internal/index.d.ts'; |
| 3 | import·type·{Simplify}·from·'./simplify.d.ts'; | 3 | import·type·{Simplify}·from·'./simplify.d.ts'; |
| 4 | /** | 4 | /** |
| 5 | Create·a·type·that·makes·the·given·keys·optional | 5 | Create·a·type·that·makes·the·given·keys·optional,·while·keeping·the·remaining·keys·as·is. |
| 6 | Use-case:·You·want·to·define·a·single·model·where·the·only·thing·that·changes·is·whether·or·not·some·of·the·keys·are·optional. | 6 | Use-case:·You·want·to·define·a·single·model·where·the·only·thing·that·changes·is·whether·or·not·some·of·the·keys·are·optional. |
| 7 | @example | 7 | @example |
| 8 | ``` | 8 | ``` |
| 9 | import·type·{SetOptional}·from·'type-fest'; | 9 | import·type·{SetOptional}·from·'type-fest'; |
| Offset 28, 15 lines modified | Offset 28, 15 lines modified | ||
| 28 | » » ?·(...arguments_:·Parameters<BaseType>)·=>·ReturnType<BaseType> | 28 | » » ?·(...arguments_:·Parameters<BaseType>)·=>·ReturnType<BaseType> |
| 29 | » » :·unknown) | 29 | » » :·unknown) |
| 30 | » &·_SetOptional<BaseType,·Keys>; | 30 | » &·_SetOptional<BaseType,·Keys>; |
| 31 | type·_SetOptional<BaseType,·Keys·extends·keyof·BaseType>·= | 31 | type·_SetOptional<BaseType,·Keys·extends·keyof·BaseType>·= |
| 32 | » BaseType·extends·unknown·//·To·distribute·`BaseType`·when·it's·a·union·type. | 32 | » BaseType·extends·unknown·//·To·distribute·`BaseType`·when·it's·a·union·type. |
| 33 | » » ?·Simplify< | 33 | » » ?·Simplify< |
| 34 | » » //·Pick·just·the·keys·that·are·readonly·from·the·base·type. | 34 | » » » //·Pick·just·the·keys·that·are·readonly·from·the·base·type. |
| 35 | » » » Except<BaseType,·Keys> | 35 | » » » Except<BaseType,·Keys> |
| 36 | » » //·Pick·the·keys·that·should·be·mutable·from·the·base·type·and·make·them·mutable. | 36 | » » » //·Pick·the·keys·that·should·be·mutable·from·the·base·type·and·make·them·mutable. |
| 37 | » » » Partial<HomomorphicPick<BaseType,·Keys>> | 37 | » » » &·Partial<HomomorphicPick<BaseType,·Keys>> |
| 38 | » » > | 38 | » » > |
| 39 | » » :·never; | 39 | » » :·never; |
| 40 | export·{}; | 40 | export·{}; |
| Offset 1, 13 lines modified | Offset 1, 13 lines modified | ||
| 1 | import·type·{Except}·from·'./except.d.ts'; | 1 | import·type·{Except}·from·'./except.d.ts'; |
| 2 | import·type·{HomomorphicPick}·from·'./internal/index.d.ts'; | 2 | import·type·{HomomorphicPick}·from·'./internal/index.d.ts'; |
| 3 | import·type·{Simplify}·from·'./simplify.d.ts'; | 3 | import·type·{Simplify}·from·'./simplify.d.ts'; |
| 4 | /** | 4 | /** |
| 5 | Create·a·type·that·makes·the·given·keys·readonly | 5 | Create·a·type·that·makes·the·given·keys·readonly,·while·keeping·the·remaining·keys·as·is. |
| 6 | Use-case:·You·want·to·define·a·single·model·where·the·only·thing·that·changes·is·whether·or·not·some·of·the·keys·are·readonly. | 6 | Use-case:·You·want·to·define·a·single·model·where·the·only·thing·that·changes·is·whether·or·not·some·of·the·keys·are·readonly. |
| 7 | @example | 7 | @example |
| 8 | ``` | 8 | ``` |
| 9 | import·type·{SetReadonly}·from·'type-fest'; | 9 | import·type·{SetReadonly}·from·'type-fest'; |
| Offset 28, 13 lines modified | Offset 28, 13 lines modified | ||
| 28 | » » ?·(...arguments_:·Parameters<BaseType>)·=>·ReturnType<BaseType> | 28 | » » ?·(...arguments_:·Parameters<BaseType>)·=>·ReturnType<BaseType> |
| 29 | » » :·unknown) | 29 | » » :·unknown) |
| 30 | » &·_SetReadonly<BaseType,·Keys>; | 30 | » &·_SetReadonly<BaseType,·Keys>; |
| 31 | export·type·_SetReadonly<BaseType,·Keys·extends·keyof·BaseType>·= | 31 | export·type·_SetReadonly<BaseType,·Keys·extends·keyof·BaseType>·= |
| 32 | » BaseType·extends·unknown·//·To·distribute·`BaseType`·when·it's·a·union·type. | 32 | » BaseType·extends·unknown·//·To·distribute·`BaseType`·when·it's·a·union·type. |
| 33 | » » ?·Simplify< | 33 | » » ?·Simplify< |
| 34 | » » » Except<BaseType,·Keys> | 34 | » » » Except<BaseType,·Keys> |
| 35 | » » » Readonly<HomomorphicPick<BaseType,·Keys>> | 35 | » » » &·Readonly<HomomorphicPick<BaseType,·Keys>> |
| 36 | » » > | 36 | » » > |
| 37 | » » :·never; | 37 | » » :·never; |
| 38 | export·{}; | 38 | export·{}; |
| Offset 4, 15 lines modified | Offset 4, 15 lines modified | ||
| 4 | import·type·{SetRequired}·from·'./set-required.d.ts'; | 4 | import·type·{SetRequired}·from·'./set-required.d.ts'; |
| 5 | import·type·{SimplifyDeep}·from·'./simplify-deep.d.ts'; | 5 | import·type·{SimplifyDeep}·from·'./simplify-deep.d.ts'; |
| 6 | import·type·{UnionToTuple}·from·'./union-to-tuple.d.ts'; | 6 | import·type·{UnionToTuple}·from·'./union-to-tuple.d.ts'; |
| 7 | import·type·{RequiredDeep}·from·'./required-deep.d.ts'; | 7 | import·type·{RequiredDeep}·from·'./required-deep.d.ts'; |
| 8 | import·type·{UnknownArray}·from·'./unknown-array.d.ts'; | 8 | import·type·{UnknownArray}·from·'./unknown-array.d.ts'; |
| 9 | /** | 9 | /** |
| 10 | Create·a·type·that·makes·the·given·keys·required | 10 | Create·a·type·that·makes·the·given·keys·required,·with·support·for·deeply·nested·key·paths,·while·keeping·the·remaining·keys·as·is. |
| 11 | Use-case:·Selectively·make·nested·properties·required·in·complex·types·like·models. | 11 | Use-case:·Selectively·make·nested·properties·required·in·complex·types·like·models. |
| 12 | @example | 12 | @example |
| 13 | ``` | 13 | ``` |
| 14 | import·type·{SetRequiredDeep}·from·'type-fest'; | 14 | import·type·{SetRequiredDeep}·from·'type-fest'; |
| Offset 2, 15 lines modified | Offset 2, 15 lines modified | ||
| 2 | import·type·{If}·from·'./if.d.ts'; | 2 | import·type·{If}·from·'./if.d.ts'; |
| 3 | import·type·{HomomorphicPick,·IsArrayReadonly}·from·'./internal/index.d.ts'; | 3 | import·type·{HomomorphicPick,·IsArrayReadonly}·from·'./internal/index.d.ts'; |
| 4 | import·type·{OptionalKeysOf}·from·'./optional-keys-of.d.ts'; | 4 | import·type·{OptionalKeysOf}·from·'./optional-keys-of.d.ts'; |
| 5 | import·type·{Simplify}·from·'./simplify.d.ts'; | 5 | import·type·{Simplify}·from·'./simplify.d.ts'; |
| 6 | import·type·{UnknownArray}·from·'./unknown-array.d.ts'; | 6 | import·type·{UnknownArray}·from·'./unknown-array.d.ts'; |
| 7 | /** | 7 | /** |
| 8 | Create·a·type·that·makes·the·given·keys·required | 8 | Create·a·type·that·makes·the·given·keys·required,·while·keeping·the·remaining·keys·as·is. |
| 9 | Use-case:·You·want·to·define·a·single·model·where·the·only·thing·that·changes·is·whether·or·not·some·of·the·keys·are·required. | 9 | Use-case:·You·want·to·define·a·single·model·where·the·only·thing·that·changes·is·whether·or·not·some·of·the·keys·are·required. |
| 10 | @example | 10 | @example |
| 11 | ``` | 11 | ``` |
| 12 | import·type·{SetRequired}·from·'type-fest'; | 12 | import·type·{SetRequired}·from·'type-fest'; |
| Offset 39, 17 lines modified | Offset 39, 17 lines modified | ||
| 39 | type·_SetRequired<BaseType,·Keys·extends·keyof·BaseType>·= | 39 | type·_SetRequired<BaseType,·Keys·extends·keyof·BaseType>·= |
| 40 | » BaseType·extends·UnknownArray | 40 | » BaseType·extends·UnknownArray |
| 41 | » » ?·SetArrayRequired<BaseType,·Keys>·extends·infer·ResultantArray | 41 | » » ?·SetArrayRequired<BaseType,·Keys>·extends·infer·ResultantArray |
| 42 | » » » ?·If<IsArrayReadonly<BaseType>,·Readonly<ResultantArray>,·ResultantArray> | 42 | » » » ?·If<IsArrayReadonly<BaseType>,·Readonly<ResultantArray>,·ResultantArray> |
| 43 | » » » :·never | 43 | » » » :·never |
| 44 | » » :·Simplify< | 44 | » » :·Simplify< |
| 45 | » » //·Pick·just·the·keys·that·are·optional·from·the·base·type. | 45 | » » //·Pick·just·the·keys·that·are·optional·from·the·base·type. |
| 46 | » » » Except<BaseType,·Keys> | 46 | » » » Except<BaseType,·Keys> |
| 47 | » » //·Pick·the·keys·that·should·be·required·from·the·base·type·and·make·them·required. | 47 | » » //·Pick·the·keys·that·should·be·required·from·the·base·type·and·make·them·required. |
| 48 | » » » Required<HomomorphicPick<BaseType,·Keys>> | 48 | » » » &·Required<HomomorphicPick<BaseType,·Keys>> |
| 49 | » » >; | 49 | » » >; |
| 50 | /** | 50 | /** |
| 51 | Remove·the·optional·modifier·from·the·specified·keys·in·an·array. | 51 | Remove·the·optional·modifier·from·the·specified·keys·in·an·array. |
| 52 | */ | 52 | */ |
| 53 | type·SetArrayRequired< | 53 | type·SetArrayRequired< |
| 54 | » TArray·extends·UnknownArray, | 54 | » TArray·extends·UnknownArray, |
| Offset 62, 18 lines modified | Offset 62, 18 lines modified | ||
| 62 | @see·{@link·SharedUnionFieldsDeep} | 62 | @see·{@link·SharedUnionFieldsDeep} |
| 63 | @see·{@link·AllUnionFields} | 63 | @see·{@link·AllUnionFields} |
| 64 | @category·Object | 64 | @category·Object |
| 65 | @category·Union | 65 | @category·Union |
| 66 | */ | 66 | */ |
| 67 | export·type·SharedUnionFields<Union>·= | 67 | export·type·SharedUnionFields<Union>·= |
| 68 | Extract<Union,·NonRecursiveType·|·ReadonlyMap<unknown,·unknown>·|·ReadonlySet<unknown>·|·UnknownArray>·extends·infer·SkippedMembers | 68 | » Extract<Union,·NonRecursiveType·|·ReadonlyMap<unknown,·unknown>·|·ReadonlySet<unknown>·|·UnknownArray>·extends·infer·SkippedMembers |
| 69 | » ?·Exclude<Union,·SkippedMembers>·extends·infer·RelevantMembers | 69 | » » ?·Exclude<Union,·SkippedMembers>·extends·infer·RelevantMembers |
| 70 | » » ? | 70 | » » » ?·//·eslint-disable-line·@stylistic/operator-linebreak |
| 71 | » » |·SkippedMembers | 71 | » » » |·SkippedMembers |
| 72 | » » |·(IsNever<RelevantMembers>·extends·true | 72 | » » » |·(IsNever<RelevantMembers>·extends·true |
| 73 | » » » ?·never | 73 | » » » » ?·never |
| 74 | » » » :·Simplify<Pick<RelevantMembers,·keyof·RelevantMembers>>) | 74 | » » » » :·Simplify<Pick<RelevantMembers,·keyof·RelevantMembers>>) |
| 75 | » » :·never | 75 | » » » :·never |
| 76 | » :·never; | 76 | » » :·never; |
| 77 | export·{}; | 77 | export·{}; |
| Offset 12, 14 lines modified | Offset 12, 15 lines modified | ||
| 12 | import·type·{SnakeCase}·from·'type-fest'; | 12 | import·type·{SnakeCase}·from·'type-fest'; |
| 13 | //·Simple | 13 | //·Simple |
| 14 | const·someVariable:·SnakeCase<'fooBar'>·=·'foo_bar'; | 14 | const·someVariable:·SnakeCase<'fooBar'>·=·'foo_bar'; |
| 15 | const·noSplitOnNumbers:·SnakeCase<'p2pNetwork'>·=·'p2p_network'; | 15 | const·noSplitOnNumbers:·SnakeCase<'p2pNetwork'>·=·'p2p_network'; |
| 16 | const·splitOnNumbers:·SnakeCase<'p2pNetwork',·{splitOnNumbers:·true}>·=·'p_2_p_network'; | 16 | const·splitOnNumbers:·SnakeCase<'p2pNetwork',·{splitOnNumbers:·true}>·=·'p_2_p_network'; |
| 17 | const·splitOnPunctuation:·SnakeCase<'div.card::after',·{splitOnPunctuation:·true}>·=·'div_card_after'; | ||
| 17 | //·Advanced | 18 | //·Advanced |
| 18 | type·SnakeCasedProperties<T>·=·{ | 19 | type·SnakeCasedProperties<T>·=·{ |
| 19 | » [K·in·keyof·T·as·SnakeCase<K>]:·T[K] | 20 | » [K·in·keyof·T·as·SnakeCase<K>]:·T[K] |
| 20 | }; | 21 | }; |
| Offset 47, 14 lines modified | Offset 47, 21 lines modified | ||
| 47 | » » line_2:·[ | 47 | » » line_2:·[ |
| 48 | » » » { | 48 | » » » { |
| 49 | » » » » line_3:·'string', | 49 | » » » » line_3:·'string', |
| 50 | » » » }, | 50 | » » » }, |
| 51 | » » ], | 51 | » » ], |
| 52 | » }, | 52 | » }, |
| 53 | }; | 53 | }; |
| 54 | const·splitOnPunctuation:·SnakeCasedPropertiesDeep<{'user@info':·{'user::id':·number;·'user::name':·string}},·{splitOnPunctuation:·true}>·=·{ | ||
| 55 | » 'user_info':·{ | ||
| 56 | » » 'user_id':·1, | ||
| 57 | » » 'user_name':·'Tom', | ||
| 58 | » }, | ||
| 59 | }; | ||
| 54 | ``` | 60 | ``` |
| 55 | @category·Change·case | 61 | @category·Change·case |
| 56 | @category·Template·literal | 62 | @category·Template·literal |
| 57 | @category·Object | 63 | @category·Object |
| 58 | */ | 64 | */ |
| 59 | export·type·SnakeCasedPropertiesDeep< | 65 | export·type·SnakeCasedPropertiesDeep< |
| Offset 1, 14 lines modified | Offset 1, 14 lines modified | ||
| 1 | import·type·{_DefaultDelimiterCaseOptions}·from·'./delimiter-case.d.ts'; | 1 | import·type·{_DefaultDelimiterCaseOptions}·from·'./delimiter-case.d.ts'; |
| 2 | import·type·{DelimiterCasedProperties}·from·'./delimiter-cased-properties.d.ts'; | 2 | import·type·{DelimiterCasedProperties}·from·'./delimiter-cased-properties.d.ts'; |
| 3 | import·type·{ApplyDefaultOptions}·from·'./internal/index.d.ts'; | 3 | import·type·{ApplyDefaultOptions}·from·'./internal/index.d.ts'; |
| 4 | import·type·{WordsOptions}·from·'./words.d.ts'; | 4 | import·type·{WordsOptions}·from·'./words.d.ts'; |
| 5 | /** | 5 | /** |
| 6 | Convert·object·properties·to·snake·ca | 6 | Convert·top-level·object·properties·to·snake·case. |
| 7 | This·can·be·useful·when,·for·example,·converting·some·API·types·from·a·different·style. | 7 | This·can·be·useful·when,·for·example,·converting·some·API·types·from·a·different·style. |
| 8 | @see·{@link·SnakeCase} | 8 | @see·{@link·SnakeCase} |
| 9 | @see·{@link·SnakeCasedPropertiesDeep} | 9 | @see·{@link·SnakeCasedPropertiesDeep} |
| 10 | @example | 10 | @example |
| Offset 24, 14 lines modified | Offset 24, 18 lines modified | ||
| 24 | » user_id:·1, | 24 | » user_id:·1, |
| 25 | » user_name:·'Tom', | 25 | » user_name:·'Tom', |
| 26 | }; | 26 | }; |
| 27 | const·splitOnNumbers:·SnakeCasedProperties<{line1:·string},·{splitOnNumbers:·true}>·=·{ | 27 | const·splitOnNumbers:·SnakeCasedProperties<{line1:·string},·{splitOnNumbers:·true}>·=·{ |
| 28 | » 'line_1':·'string', | 28 | » 'line_1':·'string', |
| 29 | }; | 29 | }; |
| 30 | const·splitOnPunctuation:·SnakeCasedProperties<{'foo::bar':·string},·{splitOnPunctuation:·true}>·=·{ | ||
| 31 | » 'foo_bar':·'string', | ||
| 32 | }; | ||
| 30 | ``` | 33 | ``` |
| 31 | @category·Change·case | 34 | @category·Change·case |
| 32 | @category·Template·literal | 35 | @category·Template·literal |
| 33 | @category·Object | 36 | @category·Object |
| 34 | */ | 37 | */ |
| 35 | export·type·SnakeCasedProperties< | 38 | export·type·SnakeCasedProperties< |
| Offset 1, 11 lines modified | Offset 1, 12 lines modified | ||
| 1 | import·type·{ | 1 | import·type·{ReverseSign}·from·'./internal/index.d.ts'; |
| 2 | import·type·{PositiveInfinity,·NegativeInfinity,·IsNegative}·from·'./numeric.d.ts'; | 2 | import·type·{PositiveInfinity,·NegativeInfinity,·IsNegative}·from·'./numeric.d.ts'; |
| 3 | import·type·{LessThan}·from·'./less-than.d.ts'; | 3 | import·type·{LessThan}·from·'./less-than.d.ts'; |
| 4 | import·type·{TupleOf}·from·'./tuple-of.d.ts'; | 4 | import·type·{TupleOf}·from·'./tuple-of.d.ts'; |
| 5 | import·type·{Absolute}·from·'./absolute.d.ts'; | ||
| 5 | /** | 6 | /** |
| 6 | Returns·the·difference·between·two·numbers. | 7 | Returns·the·difference·between·two·numbers. |
| 7 | Note: | 8 | Note: |
| 8 | -·A·or·B·can·only·support·`-999`·~·`999`. | 9 | -·A·or·B·can·only·support·`-999`·~·`999`. |
| Offset 55, 17 lines modified | Offset 56, 17 lines modified | ||
| 55 | Subtracts·two·numbers·A·and·B,·such·that·they·are·not·equal·and·neither·of·them·are·0,·+/-·infinity·or·the·`number`·type | 56 | Subtracts·two·numbers·A·and·B,·such·that·they·are·not·equal·and·neither·of·them·are·0,·+/-·infinity·or·the·`number`·type |
| 56 | */ | 57 | */ |
| 57 | type·SubtractPostChecks<A·extends·number,·B·extends·number,·AreNegative·=·[IsNegative<A>,·IsNegative<B>]>·= | 58 | type·SubtractPostChecks<A·extends·number,·B·extends·number,·AreNegative·=·[IsNegative<A>,·IsNegative<B>]>·= |
| 58 | » AreNegative·extends·[false,·false] | 59 | » AreNegative·extends·[false,·false] |
| 59 | » » ?·SubtractPositives<A,·B> | 60 | » » ?·SubtractPositives<A,·B> |
| 60 | » » :·AreNegative·extends·[true,·true] | 61 | » » :·AreNegative·extends·[true,·true] |
| 61 | » » » //·When·both·numbers·are·negative·we·subtract·the·absolute·values·and·then·reverse·the·sign | 62 | » » » //·When·both·numbers·are·negative·we·subtract·the·absolute·values·and·then·reverse·the·sign |
| 62 | » » » ?·ReverseSign<SubtractPositives< | 63 | » » » ?·ReverseSign<SubtractPositives<Absolute<A>,·Absolute<B>>> |
| 63 | » » » //·When·the·signs·are·different·we·can·add·the·absolute·values·and·then·reverse·the·sign·if·A·<·B | 64 | » » » //·When·the·signs·are·different·we·can·add·the·absolute·values·and·then·reverse·the·sign·if·A·<·B |
| 64 | » » » :·[...TupleOf< | 65 | » » » :·[...TupleOf<Absolute<A>>,·...TupleOf<Absolute<B>>]·extends·infer·R·extends·unknown[] |
| 65 | » » » » ?·LessThan<A,·B>·extends·true·?·ReverseSign<R['length']>·:·R['length'] | 66 | » » » » ?·LessThan<A,·B>·extends·true·?·ReverseSign<R['length']>·:·R['length'] |
| 66 | » » » » :·never; | 67 | » » » » :·never; |
| 67 | /** | 68 | /** |
| 68 | Subtracts·two·positive·numbers. | 69 | Subtracts·two·positive·numbers. |
| 69 | */ | 70 | */ |
| 70 | type·SubtractPositives<A·extends·number,·B·extends·number>·= | 71 | type·SubtractPositives<A·extends·number,·B·extends·number>·= |
| Offset 1, 11 lines modified | Offset 1, 12 lines modified | ||
| 1 | import·type·{TupleOf}·from·'./tuple-of.d.ts'; | 1 | import·type·{TupleOf}·from·'./tuple-of.d.ts'; |
| 2 | import·type·{ | 2 | import·type·{TupleMax,·ReverseSign}·from·'./internal/index.d.ts'; |
| 3 | import·type·{PositiveInfinity,·NegativeInfinity,·IsNegative}·from·'./numeric.d.ts'; | 3 | import·type·{PositiveInfinity,·NegativeInfinity,·IsNegative}·from·'./numeric.d.ts'; |
| 4 | import·type·{Subtract}·from·'./subtract.d.ts'; | 4 | import·type·{Subtract}·from·'./subtract.d.ts'; |
| 5 | import·type·{Absolute}·from·'./absolute.d.ts'; | ||
| 5 | /** | 6 | /** |
| 6 | Returns·the·sum·of·two·numbers. | 7 | Returns·the·sum·of·two·numbers. |
| 7 | Note: | 8 | Note: |
| 8 | -·A·or·B·can·only·support·`-999`·~·`999`. | 9 | -·A·or·B·can·only·support·`-999`·~·`999`. |
| Offset 53, 19 lines modified | Offset 54, 19 lines modified | ||
| 53 | */ | 54 | */ |
| 54 | type·SumPostChecks<A·extends·number,·B·extends·number,·AreNegative·=·[IsNegative<A>,·IsNegative<B>]>·= | 55 | type·SumPostChecks<A·extends·number,·B·extends·number,·AreNegative·=·[IsNegative<A>,·IsNegative<B>]>·= |
| 55 | » AreNegative·extends·[false,·false] | 56 | » AreNegative·extends·[false,·false] |
| 56 | » » //·When·both·numbers·are·positive·we·can·add·them·together | 57 | » » //·When·both·numbers·are·positive·we·can·add·them·together |
| 57 | » » ?·SumPositives<A,·B> | 58 | » » ?·SumPositives<A,·B> |
| 58 | » » :·AreNegative·extends·[true,·true] | 59 | » » :·AreNegative·extends·[true,·true] |
| 59 | » » » //·When·both·numbers·are·negative·we·add·the·absolute·values·and·then·reverse·the·sign | 60 | » » » //·When·both·numbers·are·negative·we·add·the·absolute·values·and·then·reverse·the·sign |
| 60 | » » » ?·ReverseSign<SumPositives< | 61 | » » » ?·ReverseSign<SumPositives<Absolute<A>,·Absolute<B>>> |
| 61 | » » » //·When·the·signs·are·different·we·can·subtract·the·absolute·values,·remove·the·sign | 62 | » » » //·When·the·signs·are·different·we·can·subtract·the·absolute·values,·remove·the·sign |
| 62 | » » » //·and·then·reverse·the·sign·if·the·larger·absolute·value·is·negative | 63 | » » » //·and·then·reverse·the·sign·if·the·larger·absolute·value·is·negative |
| 63 | » » » :· | 64 | » » » :·Absolute<Subtract<Absolute<A>,·Absolute<B>>>·extends·infer·Result·extends·number |
| 64 | » » » » ?·TupleMax<[ | 65 | » » » » ?·TupleMax<[Absolute<A>,·Absolute<B>]>·extends·infer·Max_·extends·number |
| 65 | » » » » » ?·Max_·extends·A·|·B | 66 | » » » » » ?·Max_·extends·A·|·B |
| 66 | » » » » » » //·The·larger·absolute·value·is·positive,·so·the·result·is·positive | 67 | » » » » » » //·The·larger·absolute·value·is·positive,·so·the·result·is·positive |
| 67 | » » » » » » ?·Result | 68 | » » » » » » ?·Result |
| 68 | » » » » » » //·The·larger·absolute·value·is·negative,·so·the·result·is·negative | 69 | » » » » » » //·The·larger·absolute·value·is·negative,·so·the·result·is·negative |
| 69 | » » » » » » :·ReverseSign<Result> | 70 | » » » » » » :·ReverseSign<Result> |
| 70 | » » » » » :·never | 71 | » » » » » :·never |
| 71 | » » » » :·never; | 72 | » » » » :·never; |
| Offset 4, 20 lines modified | Offset 4, 18 lines modified | ||
| 4 | export·type·TagContainer<Token>·=·{ | 4 | export·type·TagContainer<Token>·=·{ |
| 5 | » readonly·[tag]:·Token; | 5 | » readonly·[tag]:·Token; |
| 6 | }; | 6 | }; |
| 7 | type·Tag<Token·extends·PropertyKey,·TagMetadata>·=·TagContainer<{[K·in·Token]:·TagMetadata}>; | 7 | type·Tag<Token·extends·PropertyKey,·TagMetadata>·=·TagContainer<{[K·in·Token]:·TagMetadata}>; |
| 8 | /** | 8 | /** |
| 9 | 9 | Create·a·[tagged·type](https://medium.com/@KevinBGreene/surviving-the-typescript-ecosystem-branding-and-type-tagging-6cf6e516523d)·that·can·support·[multiple·tags](https://github.com/sindresorhus/type-fest/issues/665)·and·[per-tag·metadata](https://medium.[·...·truncated·by·diffoscope;·len:·99,·SHA:·3fd8c7a5ebcae5c18ca9e42cbf2316354997c57f4e24714709786008b221556b·...·] | |
| 10 | A·type·returned·by·`Tagged`·can·be·passed·to·`Tagged`·again,·to·create·a·type·with·multiple·tags. | 10 | A·type·returned·by·`Tagged`·can·be·passed·to·`Tagged`·again,·to·create·a·type·with·multiple·tags. |
| 11 | [Read·more·about·tagged·types.](https://medium.com/@KevinBGreene/surviving-the-typescript-ecosystem-branding-and-type-tagging-6cf6e516523d) | ||
| 12 | A·tag's·name·is·usually·a·string·(and·must·be·a·string,·number,·or·symbol),·but·each·application·of·a·tag·can·also·contain·an·arbitrary·type·as·its·"metadata".·See·{@link·GetTagMetadata}·for·examples·and·explanation. | 11 | A·tag's·name·is·usually·a·string·(and·must·be·a·string,·number,·or·symbol),·but·each·application·of·a·tag·can·also·contain·an·arbitrary·type·as·its·"metadata".·See·{@link·GetTagMetadata}·for·examples·and·explanation. |
| 13 | A·type·`A`·returned·by·`Tagged`·is·assignable·to·another·type·`B`·returned·by·`Tagged`·if·and·only·if: | 12 | A·type·`A`·returned·by·`Tagged`·is·assignable·to·another·type·`B`·returned·by·`Tagged`·if·and·only·if: |
| 14 | ··-·the·underlying·(untagged)·type·of·`A`·is·assignable·to·the·underlying·type·of·`B`; | 13 | ··-·the·underlying·(untagged)·type·of·`A`·is·assignable·to·the·underlying·type·of·`B`; |
| 15 | » -·`A`·contains·at·least·all·the·tags·`B`·has; | 14 | » -·`A`·contains·at·least·all·the·tags·`B`·has; |
| 16 | » -·and·the·metadata·type·for·each·of·`A`'s·tags·is·assignable·to·the·metadata·type·of·`B`'s·corresponding·tag. | 15 | » -·and·the·metadata·type·for·each·of·`A`'s·tags·is·assignable·to·the·metadata·type·of·`B`'s·corresponding·tag. |
| Offset 96, 15 lines modified | Offset 94, 15 lines modified | ||
| 96 | ``` | 94 | ``` |
| 97 | @category·Type | 95 | @category·Type |
| 98 | */ | 96 | */ |
| 99 | export·type·GetTagMetadata<Type·extends·Tag<TagName,·unknown>,·TagName·extends·PropertyKey>·=·Type[typeof·tag][TagName]; | 97 | export·type·GetTagMetadata<Type·extends·Tag<TagName,·unknown>,·TagName·extends·PropertyKey>·=·Type[typeof·tag][TagName]; |
| 100 | /** | 98 | /** |
| 101 | 99 | Get·the·untagged·portion·of·a·tagged·type·created·with·`Tagged`. | |
| 102 | Why·is·this·necessary? | 100 | Why·is·this·necessary? |
| 103 | 1.·Use·a·`Tagged`·type·as·object·keys | 101 | 1.·Use·a·`Tagged`·type·as·object·keys |
| 104 | 2.·Prevent·TS4058·error:·"Return·type·of·exported·function·has·or·is·using·name·X·from·external·module·Y·but·cannot·be·named" | 102 | 2.·Prevent·TS4058·error:·"Return·type·of·exported·function·has·or·is·using·name·X·from·external·module·Y·but·cannot·be·named" |
| 105 | @example | 103 | @example |
| Offset 125, 15 lines modified | Offset 123, 15 lines modified | ||
| 125 | //·@ts-expect-error | 123 | //·@ts-expect-error |
| 126 | type·WontWork·=·UnwrapTagged<string>; | 124 | type·WontWork·=·UnwrapTagged<string>; |
| 127 | ``` | 125 | ``` |
| 128 | @category·Type | 126 | @category·Type |
| 129 | */ | 127 | */ |
| 130 | export·type·UnwrapTagged<TaggedType·extends·Tag<PropertyKey,·any>>·= | 128 | export·type·UnwrapTagged<TaggedType·extends·Tag<PropertyKey,·any>>·= |
| 131 | RemoveAllTags<TaggedType>; | 129 | » RemoveAllTags<TaggedType>; |
| 132 | type·RemoveAllTags<T>·=·T·extends·Tag<PropertyKey,·any> | 130 | type·RemoveAllTags<T>·=·T·extends·Tag<PropertyKey,·any> |
| 133 | » ?·{ | 131 | » ?·{ |
| 134 | » » [ThisTag·in·keyof·T[typeof·tag]]:·T·extends·Tagged<infer·Type,·ThisTag,·T[typeof·tag][ThisTag]> | 132 | » » [ThisTag·in·keyof·T[typeof·tag]]:·T·extends·Tagged<infer·Type,·ThisTag,·T[typeof·tag][ThisTag]> |
| 135 | » » » ?·RemoveAllTags<Type> | 133 | » » » ?·RemoveAllTags<Type> |
| 136 | » » » :·never | 134 | » » » :·never |
| 137 | » }[keyof·T[typeof·tag]] | 135 | » }[keyof·T[typeof·tag]] |
| Offset 57, 14 lines modified | Offset 57, 15 lines modified | ||
| 57 | » » » |·'ES2018' | 57 | » » » |·'ES2018' |
| 58 | » » » |·'ES2019' | 58 | » » » |·'ES2019' |
| 59 | » » » |·'ES2020' | 59 | » » » |·'ES2020' |
| 60 | » » » |·'ES2021' | 60 | » » » |·'ES2021' |
| 61 | » » » |·'ES2022' | 61 | » » » |·'ES2022' |
| 62 | » » » |·'ES2023' | 62 | » » » |·'ES2023' |
| 63 | » » » |·'ES2024' | 63 | » » » |·'ES2024' |
| 64 | » » » |·'ES2025' | ||
| 64 | » » » |·'ESNext' | 65 | » » » |·'ESNext' |
| 65 | » » » //·Lowercase·alternatives | 66 | » » » //·Lowercase·alternatives |
| 66 | » » » |·'es3' | 67 | » » » |·'es3' |
| 67 | » » » |·'es5' | 68 | » » » |·'es5' |
| 68 | » » » |·'es6' | 69 | » » » |·'es6' |
| 69 | » » » |·'es2015' | 70 | » » » |·'es2015' |
| 70 | » » » |·'es2016' | 71 | » » » |·'es2016' |
| Offset 72, 14 lines modified | Offset 73, 15 lines modified | ||
| 72 | » » » |·'es2018' | 73 | » » » |·'es2018' |
| 73 | » » » |·'es2019' | 74 | » » » |·'es2019' |
| 74 | » » » |·'es2020' | 75 | » » » |·'es2020' |
| 75 | » » » |·'es2021' | 76 | » » » |·'es2021' |
| 76 | » » » |·'es2022' | 77 | » » » |·'es2022' |
| 77 | » » » |·'es2023' | 78 | » » » |·'es2023' |
| 78 | » » » |·'es2024' | 79 | » » » |·'es2024' |
| 80 | » » » |·'es2025' | ||
| 79 | » » » |·'esnext'; | 81 | » » » |·'esnext'; |
| 80 | » » type·Lib·= | 82 | » » type·Lib·= |
| 81 | » » » |·'ES5' | 83 | » » » |·'ES5' |
| 82 | » » » |·'ES6' | 84 | » » » |·'ES6' |
| 83 | » » » |·'ES7' | 85 | » » » |·'ES7' |
| 84 | » » » |·'ES2015' | 86 | » » » |·'ES2015' |
| Offset 144, 29 lines modified | Offset 146, 38 lines modified | ||
| 144 | » » » |·'ES2024.ArrayBuffer' | 146 | » » » |·'ES2024.ArrayBuffer' |
| 145 | » » » |·'ES2024.Collection' | 147 | » » » |·'ES2024.Collection' |
| 146 | » » » |·'ES2024.Object' | 148 | » » » |·'ES2024.Object' |
| 147 | » » » |·'ES2024.Promise' | 149 | » » » |·'ES2024.Promise' |
| 148 | » » » |·'ES2024.Regexp' | 150 | » » » |·'ES2024.Regexp' |
| 149 | » » » |·'ES2024.SharedMemory' | 151 | » » » |·'ES2024.SharedMemory' |
| 150 | » » » |·'ES2024.String' | 152 | » » » |·'ES2024.String' |
| 153 | » » » |·'ES2025' | ||
| 154 | » » » |·'ES2025.Collection' | ||
| 155 | » » » |·'ES2025.Float16' | ||
| 156 | » » » |·'ES2025.Intl' | ||
| 157 | » » » |·'ES2025.Iterator' | ||
| 158 | » » » |·'ES2025.Promise' | ||
| 159 | » » » |·'ES2025.RegExp' | ||
| 151 | » » » |·'ESNext' | 160 | » » » |·'ESNext' |
| 152 | » » » |·'ESNext.Array' | 161 | » » » |·'ESNext.Array' |
| 153 | » » » |·'ESNext.AsyncIterable' | 162 | » » » |·'ESNext.AsyncIterable' |
| 154 | » » » |·'ESNext.BigInt' | 163 | » » » |·'ESNext.BigInt' |
| 155 | » » » |·'ESNext.Collection' | 164 | » » » |·'ESNext.Collection' |
| 156 | » » » |·'ESNext.Decorators' | 165 | » » » |·'ESNext.Decorators' |
| 157 | » » » |·'ESNext.Disposable' | 166 | » » » |·'ESNext.Disposable' |
| 158 | » » » |·'ESNext.Error' | 167 | » » » |·'ESNext.Error' |
| 168 | » » » |·'ESNext.Float16' | ||
| 159 | » » » |·'ESNext.Intl' | 169 | » » » |·'ESNext.Intl' |
| 160 | » » » |·'ESNext.Iterator' | 170 | » » » |·'ESNext.Iterator' |
| 161 | » » » |·'ESNext.Object' | 171 | » » » |·'ESNext.Object' |
| 162 | » » » |·'ESNext.Promise' | 172 | » » » |·'ESNext.Promise' |
| 163 | » » » |·'ESNext.Regexp' | 173 | » » » |·'ESNext.Regexp' |
| 164 | » » » |·'ESNext.String' | 174 | » » » |·'ESNext.String' |
| 165 | » » » |·'ESNext.Symbol' | 175 | » » » |·'ESNext.Symbol' |
| 176 | » » » |·'ESNext.Temporal' | ||
| 166 | » » » |·'ESNext.WeakRef' | 177 | » » » |·'ESNext.WeakRef' |
| 167 | » » » |·'DOM' | 178 | » » » |·'DOM' |
| 168 | » » » |·'DOM.AsyncIterable' | 179 | » » » |·'DOM.AsyncIterable' |
| 169 | » » » |·'DOM.Iterable' | 180 | » » » |·'DOM.Iterable' |
| 170 | » » » |·'Decorators' | 181 | » » » |·'Decorators' |
| 171 | » » » |·'Decorators.Legacy' | 182 | » » » |·'Decorators.Legacy' |
| 172 | » » » |·'ScriptHost' | 183 | » » » |·'ScriptHost' |
| Offset 240, 29 lines modified | Offset 251, 38 lines modified | ||
| 240 | » » » |·'es2024.arraybuffer' | 251 | » » » |·'es2024.arraybuffer' |
| 241 | » » » |·'es2024.collection' | 252 | » » » |·'es2024.collection' |
| 242 | » » » |·'es2024.object' | 253 | » » » |·'es2024.object' |
| 243 | » » » |·'es2024.promise' | 254 | » » » |·'es2024.promise' |
| 244 | » » » |·'es2024.regexp' | 255 | » » » |·'es2024.regexp' |
| 245 | » » » |·'es2024.sharedmemory' | 256 | » » » |·'es2024.sharedmemory' |
| 246 | » » » |·'es2024.string' | 257 | » » » |·'es2024.string' |
| 258 | » » » |·'es2025' | ||
| 259 | » » » |·'es2025.collection' | ||
| 260 | » » » |·'es2025.float16' | ||
| 261 | » » » |·'es2025.intl' | ||
| 262 | » » » |·'es2025.iterator' | ||
| 263 | » » » |·'es2025.promise' | ||
| 264 | » » » |·'es2025.regexp' | ||
| 247 | » » » |·'esnext' | 265 | » » » |·'esnext' |
| 248 | » » » |·'esnext.array' | 266 | » » » |·'esnext.array' |
| 249 | » » » |·'esnext.asynciterable' | 267 | » » » |·'esnext.asynciterable' |
| 250 | » » » |·'esnext.bigint' | 268 | » » » |·'esnext.bigint' |
| 251 | » » » |·'esnext.collection' | 269 | » » » |·'esnext.collection' |
| 252 | » » » |·'esnext.decorators' | 270 | » » » |·'esnext.decorators' |
| 253 | » » » |·'esnext.disposable' | 271 | » » » |·'esnext.disposable' |
| 254 | » » » |·'esnext.error' | 272 | » » » |·'esnext.error' |
| 273 | » » » |·'esnext.float16' | ||
| 255 | » » » |·'esnext.intl' | 274 | » » » |·'esnext.intl' |
| 256 | » » » |·'esnext.iterator' | 275 | » » » |·'esnext.iterator' |
| 257 | » » » |·'esnext.object' | 276 | » » » |·'esnext.object' |
| 258 | » » » |·'esnext.promise' | 277 | » » » |·'esnext.promise' |
| 259 | » » » |·'esnext.regexp' | 278 | » » » |·'esnext.regexp' |
| Max diff block lines reached; 4334/6374 bytes (67.99%) of diff not shown. | |||
| Offset 1, 9 lines modified | Offset 1, 9 lines modified | ||
| 1 | /** | 1 | /** |
| 2 | Convert·a·union·type·to·an·intersection·type | 2 | Convert·a·union·type·to·an·intersection·type. |
| 3 | Inspired·by·[this·Stack·Overflow·answer](https://stackoverflow.com/a/50375286/2172153). | 3 | Inspired·by·[this·Stack·Overflow·answer](https://stackoverflow.com/a/50375286/2172153). |
| 4 | @example | 4 | @example |
| 5 | ``` | 5 | ``` |
| 6 | import·type·{UnionToIntersection}·from·'type-fest'; | 6 | import·type·{UnionToIntersection}·from·'type-fest'; |
| Offset 1, 10 lines modified | Offset 1, 11 lines modified | ||
| 1 | import·type·{ExcludeExactly}·from·'./exclude-exactly.d.ts'; | 1 | import·type·{ExcludeExactly}·from·'./exclude-exactly.d.ts'; |
| 2 | import·type·{IsNever}·from·'./is-never.d.ts'; | 2 | import·type·{IsNever}·from·'./is-never.d.ts'; |
| 3 | import·type·{UnionMember}·from·'./union-member.d.ts'; | 3 | import·type·{UnionMember}·from·'./union-member.d.ts'; |
| 4 | import·type·{UnknownArray}·from·'./unknown-array.d.ts'; | ||
| 4 | /** | 5 | /** |
| 5 | Convert·a·union·type·into·an·unordered·tuple·type·of·its·elements. | 6 | Convert·a·union·type·into·an·unordered·tuple·type·of·its·elements. |
| 6 | "Unordered"·means·the·elements·of·the·tuple·are·not·guaranteed·to·be·in·the·same·order·as·in·the·union·type.·The·arrangement·can·appear·random·and·may·change·at·any·time. | 7 | "Unordered"·means·the·elements·of·the·tuple·are·not·guaranteed·to·be·in·the·same·order·as·in·the·union·type.·The·arrangement·can·appear·random·and·may·change·at·any·time. |
| 7 | This·can·be·useful·when·you·have·objects·with·a·finite·set·of·keys·and·want·a·type·defining·only·the·allowed·keys,·but·do·not·want·to·repeat·yourself. | 8 | This·can·be·useful·when·you·have·objects·with·a·finite·set·of·keys·and·want·a·type·defining·only·the·allowed·keys,·but·do·not·want·to·repeat·yourself. |
| Offset 33, 13 lines modified | Offset 34, 16 lines modified | ||
| 33 | const·petList·=·Object.keys(pets)·as·UnionToTuple<Pet>; | 34 | const·petList·=·Object.keys(pets)·as·UnionToTuple<Pet>; |
| 34 | //=>·['dog',·'cat',·'snake'] | 35 | //=>·['dog',·'cat',·'snake'] |
| 35 | ``` | 36 | ``` |
| 36 | @category·Array | 37 | @category·Array |
| 37 | */ | 38 | */ |
| 38 | export·type·UnionToTuple< | 39 | export·type·UnionToTuple<Union>·= |
| 39 | IsNever<T>·extends·false | ||
| 40 | » ?·[...UnionToTuple<ExcludeExactly<T,·L>>,·L] | ||
| 41 | » :· | 40 | » _UnionToTuple<Union>·extends·infer·Result·extends·UnknownArray·?·Result·:·never;·//·Nudges·the·compiler·that·`UnionToTuple`·always·yields·an·array. |
| 41 | type·_UnionToTuple<Union,·Accumulator·extends·UnknownArray·=·[],·Member·=·UnionMember<Union>>·= | ||
| 42 | » IsNever<Union>·extends·true | ||
| 43 | » » ?·Accumulator | ||
| 44 | » » :·_UnionToTuple<ExcludeExactly<Union,·Member>,·[Member,·...Accumulator]>; | ||
| 42 | export·{}; | 45 | export·{}; |
| Offset 1, 9 lines modified | Offset 1, 10 lines modified | ||
| 1 | import·type·{ | 1 | import·type·{ |
| 2 | » ApplyDefaultOptions, | 2 | » ApplyDefaultOptions, |
| 3 | » AsciiPunctuation, | ||
| 3 | » IsNumeric, | 4 | » IsNumeric, |
| 4 | » WordSeparators, | 5 | » WordSeparators, |
| 5 | }·from·'./internal/index.d.ts'; | 6 | }·from·'./internal/index.d.ts'; |
| 6 | import·type·{IsLowercase}·from·'./is-lowercase.d.ts'; | 7 | import·type·{IsLowercase}·from·'./is-lowercase.d.ts'; |
| 7 | import·type·{IsUppercase}·from·'./is-uppercase.d.ts'; | 8 | import·type·{IsUppercase}·from·'./is-uppercase.d.ts'; |
| 8 | type·SkipEmptyWord<Word·extends·string>·=·Word·extends·''·?·[]·:·[Word]; | 9 | type·SkipEmptyWord<Word·extends·string>·=·Word·extends·''·?·[]·:·[Word]; |
| Offset 34, 25 lines modified | Offset 35, 42 lines modified | ||
| 34 | » //=>·['p',·'2',·'p',·'Network'] | 35 | » //=>·['p',·'2',·'p',·'Network'] |
| 35 | » type·Example2·=·Words<'p2pNetwork',·{splitOnNumbers:·false}>; | 36 | » type·Example2·=·Words<'p2pNetwork',·{splitOnNumbers:·false}>; |
| 36 | » //=>·['p2p',·'Network'] | 37 | » //=>·['p2p',·'Network'] |
| 37 | » ``` | 38 | » ``` |
| 38 | » */ | 39 | » */ |
| 39 | » splitOnNumbers?:·boolean; | 40 | » splitOnNumbers?:·boolean; |
| 41 | » /** | ||
| 42 | » Split·on·{@link·AsciiPunctuation·|·punctuation·characters}·(e.g.,·`#`,·`&`,·`*`,·`:`,·`?`,·`@`,·`~`). | ||
| 43 | » @example | ||
| 44 | » ``` | ||
| 45 | » import·type·{Words}·from·'type-fest'; | ||
| 46 | » type·Example1·=·Words<'hello:world',·{splitOnPunctuation:·true}>; | ||
| 47 | » //=>·['hello',·'world'] | ||
| 48 | » type·Example2·=·Words<'hello:world',·{splitOnPunctuation:·false}>; | ||
| 49 | » //=>·['hello',·':world'] | ||
| 50 | » ``` | ||
| 51 | » */ | ||
| 52 | » splitOnPunctuation?:·boolean; | ||
| 40 | }; | 53 | }; |
| 41 | export·type·_DefaultWordsOptions·=·{ | 54 | export·type·_DefaultWordsOptions·=·{ |
| 42 | » splitOnNumbers:·true; | 55 | » splitOnNumbers:·true; |
| 56 | » splitOnPunctuation:·false; | ||
| 43 | }; | 57 | }; |
| 44 | /** | 58 | /** |
| 45 | Split·a·string· | 59 | Split·a·string·similar·to·Lodash's·`_.words()`·function. |
| 46 | -·Split·on·each·word·that·begins·with·a·capital·letter. | 60 | -·Split·on·each·word·that·begins·with·a·capital·letter. |
| 47 | -·Split·on·each·{@link·WordSeparators}. | 61 | -·Split·on·each·{@link·WordSeparators}. |
| 62 | -·Split·on·each·{@link·AsciiPunctuation}·(if·{@link·WordsOptions.splitOnPunctuation}·is·enabled). | ||
| 48 | -·Split·on·numeric·sequence. | 63 | -·Split·on·numeric·sequence. |
| 49 | @example | 64 | @example |
| 50 | ``` | 65 | ``` |
| 51 | import·type·{Words}·from·'type-fest'; | 66 | import·type·{Words}·from·'type-fest'; |
| 52 | type·Words0·=·Words<'helloWorld'>; | 67 | type·Words0·=·Words<'helloWorld'>; |
| Offset 68, 29 lines modified | Offset 86, 37 lines modified | ||
| 68 | //=>·['hello',·'the',·'world'] | 86 | //=>·['hello',·'the',·'world'] |
| 69 | type·Words4·=·Words<'lifeIs42'>; | 87 | type·Words4·=·Words<'lifeIs42'>; |
| 70 | //=>·['life',·'Is',·'42'] | 88 | //=>·['life',·'Is',·'42'] |
| 71 | type·Words5·=·Words<'p2pNetwork',·{splitOnNumbers:·false}>; | 89 | type·Words5·=·Words<'p2pNetwork',·{splitOnNumbers:·false}>; |
| 72 | //=>·['p2p',·'Network'] | 90 | //=>·['p2p',·'Network'] |
| 91 | type·Words6·=·Words<'hello:world',·{splitOnPunctuation:·true}>; | ||
| 92 | //=>·['hello',·'world'] | ||
| 93 | type·Words7·=·Words<'hello:world',·{splitOnPunctuation:·false}>; | ||
| 94 | //=>·['hello',·':world'] | ||
| 95 | type·Words8·=·Words<'hello::world',·{splitOnPunctuation:·true}>; | ||
| 96 | //=>·['hello',·'world'] | ||
| 73 | ``` | 97 | ``` |
| 74 | @category·Change·case | 98 | @category·Change·case |
| 75 | @category·Template·literal | 99 | @category·Template·literal |
| 76 | */ | 100 | */ |
| 101 | export·type·Words<Sentence·extends·string,·Options·extends·WordsOptions·=·{}>·=·WordsImplementation<Sentence,·ApplyDefaultOptions<WordsOptions,·_DefaultWordsOptions,·Options>>; | ||
| 77 | export·type·Words<Sentence·extends·string,·Options·extends·WordsOptions·=·{}>·= | ||
| 78 | » WordsImplementation<Sentence,·ApplyDefaultOptions<WordsOptions,·_DefaultWordsOptions,·Options>>; | ||
| 79 | type·WordsImplementation< | 102 | type·WordsImplementation< |
| 80 | » Sentence·extends·string, | 103 | » Sentence·extends·string, |
| 81 | » Options·extends·Required<WordsOptions>, | 104 | » Options·extends·Required<WordsOptions>, |
| 82 | » LastCharacter·extends·string·=·'', | 105 | » LastCharacter·extends·string·=·'', |
| 83 | » CurrentWord·extends·string·=·'', | 106 | » CurrentWord·extends·string·=·'', |
| 84 | >·=·Sentence·extends·`${infer·FirstCharacter}${infer·RemainingCharacters}` | 107 | >·=·Sentence·extends·`${infer·FirstCharacter}${infer·RemainingCharacters}` |
| 85 | » ?·FirstCharacter·extends·WordSeparators | 108 | » ?·FirstCharacter·extends·WordSeparators·|·(Options['splitOnPunctuation']·extends·true·?·AsciiPunctuation·:·never) |
| 86 | » » //·Skip·word·separator | 109 | » » //·Skip·word·separator |
| 87 | » » ?·[...SkipEmptyWord<CurrentWord>,·...WordsImplementation<RemainingCharacters,·Options>] | 110 | » » ?·[...SkipEmptyWord<CurrentWord>,·...WordsImplementation<RemainingCharacters,·Options>] |
| 88 | » » :·LastCharacter·extends·'' | 111 | » » :·LastCharacter·extends·'' |
| 89 | » » » //·Fist·char·of·word | 112 | » » » //·Fist·char·of·word |
| 90 | » » » ?·WordsImplementation<RemainingCharacters,·Options,·FirstCharacter,·FirstCharacter> | 113 | » » » ?·WordsImplementation<RemainingCharacters,·Options,·FirstCharacter,·FirstCharacter> |
| 91 | » » » //·Case·change:·non-numeric·to·numeric | 114 | » » » //·Case·change:·non-numeric·to·numeric |
| 92 | » » » :·[false,·true]·extends·[IsNumeric<LastCharacter>,·IsNumeric<FirstCharacter>] | 115 | » » » :·[false,·true]·extends·[IsNumeric<LastCharacter>,·IsNumeric<FirstCharacter>] |
| Offset 46, 23 lines modified | Offset 46, 23 lines modified | ||
| 46 | const·writableArray:·Writable<typeof·readonlyArray>·=·readonlyArray·as·Writable<typeof·readonlyArray>; | 46 | const·writableArray:·Writable<typeof·readonlyArray>·=·readonlyArray·as·Writable<typeof·readonlyArray>; |
| 47 | writableArray.push(4);·//·Will·work·as·the·array·itself·is·now·writable. | 47 | writableArray.push(4);·//·Will·work·as·the·array·itself·is·now·writable. |
| 48 | ``` | 48 | ``` |
| 49 | @category·Object | 49 | @category·Object |
| 50 | */ | 50 | */ |
| 51 | export·type·Writable<BaseType,·Keys·extends·keyof·BaseType·=·keyof·BaseType>·= | 51 | export·type·Writable<BaseType,·Keys·extends·keyof·BaseType·=·keyof·BaseType>·= |
| 52 | BaseType·extends·ReadonlyMap<infer·KeyType,·infer·ValueType> | 52 | » BaseType·extends·ReadonlyMap<infer·KeyType,·infer·ValueType> |
| 53 | » ?·Map<KeyType,·ValueType> | 53 | » » ?·Map<KeyType,·ValueType> |
| 54 | » :·BaseType·extends·ReadonlySet<infer·ItemType> | 54 | » » :·BaseType·extends·ReadonlySet<infer·ItemType> |
| 55 | » » ?·Set<ItemType> | 55 | » » » ?·Set<ItemType> |
| 56 | » » :·BaseType·extends·readonly·unknown[] | 56 | » » » :·BaseType·extends·readonly·unknown[] |
| 57 | » » » //·Handle·array | 57 | » » » » //·Handle·array |
| 58 | » » » ?·WritableArray<BaseType> | 58 | » » » » ?·WritableArray<BaseType> |
| 59 | » » » //·Handle·object | 59 | » » » » //·Handle·object |
| 60 | » » » :·Simplify< | 60 | » » » » :·Simplify< |
| 61 | » » » //·Pick·just·the·keys·that·are·not·writable·from·the·base·type. | 61 | » » » » » //·Pick·just·the·keys·that·are·not·writable·from·the·base·type. |
| 62 | » » » » Except<BaseType,·Keys> | 62 | » » » » » Except<BaseType,·Keys> |
| 63 | » » » //·Pick·the·keys·that·should·be·writable·from·the·base·type·and·make·them·writable·by·removing·the·`readonly`·modifier·from·the·key. | 63 | » » » » » //·Pick·the·keys·that·should·be·writable·from·the·base·type·and·make·them·writable·by·removing·the·`readonly`·modifier·from·the·key. |
| 64 | » » » » {-readonly·[KeyType·in·keyof·Pick<BaseType,·Keys>]:·Pick<BaseType,·Keys>[KeyType]} | 64 | » » » » » &·{-readonly·[KeyType·in·keyof·Pick<BaseType,·Keys>]:·Pick<BaseType,·Keys>[KeyType]} |
| 65 | » » » >; | 65 | » » » » >; |
| 66 | export·{}; | 66 | export·{}; |
| Offset 1, 13 lines modified | Offset 1, 13 lines modified | ||
| 1 | import·type·{Not}·from·'./internal/type.d.ts'; | 1 | import·type·{Not}·from·'./internal/type.d.ts'; |
| 2 | import·type·{And}·from·'./and.d.ts'; | 2 | import·type·{And}·from·'./and.d.ts'; |
| 3 | import·type·{Or}·from·'./or.d.ts'; | 3 | import·type·{Or}·from·'./or.d.ts'; |
| 4 | /** | 4 | /** |
| 5 | Returns·a·boolean·for·whether·only·one·of·two·given·types·is·true. | 5 | Returns·a·boolean·for·whether·only·one·of·two·given·types·is·`true`. |
| 6 | Use-case:·Constructing·complex·conditional·types·where·one·single·condition·must·be·satisfied. | 6 | Use-case:·Constructing·complex·conditional·types·where·one·single·condition·must·be·satisfied. |
| 7 | @example | 7 | @example |
| 8 | ``` | 8 | ``` |
| 9 | import·type·{Xor}·from·'type-fest'; | 9 | import·type·{Xor}·from·'type-fest'; |
| Offset 48, 14 lines modified | Offset 48, 15 lines modified | ||
| 48 | export·type·{InvariantOf}·from·'./source/invariant-of.d.ts'; | 48 | export·type·{InvariantOf}·from·'./source/invariant-of.d.ts'; |
| 49 | export·type·{SetOptional}·from·'./source/set-optional.d.ts'; | 49 | export·type·{SetOptional}·from·'./source/set-optional.d.ts'; |
| 50 | export·type·{SetReadonly}·from·'./source/set-readonly.d.ts'; | 50 | export·type·{SetReadonly}·from·'./source/set-readonly.d.ts'; |
| 51 | export·type·{SetRequired}·from·'./source/set-required.d.ts'; | 51 | export·type·{SetRequired}·from·'./source/set-required.d.ts'; |
| 52 | export·type·{SetRequiredDeep}·from·'./source/set-required-deep.d.ts'; | 52 | export·type·{SetRequiredDeep}·from·'./source/set-required-deep.d.ts'; |
| 53 | export·type·{SetNonNullable}·from·'./source/set-non-nullable.d.ts'; | 53 | export·type·{SetNonNullable}·from·'./source/set-non-nullable.d.ts'; |
| 54 | export·type·{SetNonNullableDeep}·from·'./source/set-non-nullable-deep.d.ts'; | 54 | export·type·{SetNonNullableDeep}·from·'./source/set-non-nullable-deep.d.ts'; |
| 55 | export·type·{NonNullableDeep}·from·'./source/non-nullable-deep.d.ts'; | ||
| 55 | export·type·{ValueOf}·from·'./source/value-of.d.ts'; | 56 | export·type·{ValueOf}·from·'./source/value-of.d.ts'; |
| 56 | export·type·{AsyncReturnType}·from·'./source/async-return-type.d.ts'; | 57 | export·type·{AsyncReturnType}·from·'./source/async-return-type.d.ts'; |
| 57 | export·type·{ConditionalExcept}·from·'./source/conditional-except.d.ts'; | 58 | export·type·{ConditionalExcept}·from·'./source/conditional-except.d.ts'; |
| 58 | export·type·{ConditionalKeys}·from·'./source/conditional-keys.d.ts'; | 59 | export·type·{ConditionalKeys}·from·'./source/conditional-keys.d.ts'; |
| 59 | export·type·{ConditionalPick}·from·'./source/conditional-pick.d.ts'; | 60 | export·type·{ConditionalPick}·from·'./source/conditional-pick.d.ts'; |
| 60 | export·type·{ConditionalPickDeep,·ConditionalPickDeepOptions}·from·'./source/conditional-pick-deep.d.ts'; | 61 | export·type·{ConditionalPickDeep,·ConditionalPickDeepOptions}·from·'./source/conditional-pick-deep.d.ts'; |
| 61 | export·type·{UnionToIntersection}·from·'./source/union-to-intersection.d.ts'; | 62 | export·type·{UnionToIntersection}·from·'./source/union-to-intersection.d.ts'; |
| Offset 169, 14 lines modified | Offset 170, 16 lines modified | ||
| 169 | export·type·{IsUppercase}·from·'./source/is-uppercase.d.ts'; | 170 | export·type·{IsUppercase}·from·'./source/is-uppercase.d.ts'; |
| 170 | export·type·{IsOptional}·from·'./source/is-optional.d.ts'; | 171 | export·type·{IsOptional}·from·'./source/is-optional.d.ts'; |
| 171 | export·type·{IsNullable}·from·'./source/is-nullable.d.ts'; | 172 | export·type·{IsNullable}·from·'./source/is-nullable.d.ts'; |
| 172 | export·type·{TupleOf}·from·'./source/tuple-of.d.ts'; | 173 | export·type·{TupleOf}·from·'./source/tuple-of.d.ts'; |
| 173 | export·type·{ExclusifyUnion}·from·'./source/exclusify-union.d.ts'; | 174 | export·type·{ExclusifyUnion}·from·'./source/exclusify-union.d.ts'; |
| 174 | export·type·{ArrayReverse}·from·'./source/array-reverse.d.ts'; | 175 | export·type·{ArrayReverse}·from·'./source/array-reverse.d.ts'; |
| 175 | export·type·{UnionMember}·from·'./source/union-member.d.ts'; | 176 | export·type·{UnionMember}·from·'./source/union-member.d.ts'; |
| 177 | export·type·{Absolute}·from·'./source/absolute.d.ts'; | ||
| 178 | export·type·{UnionLength}·from·'./source/union-length.d.ts'; | ||
| 176 | //·Template·literal·types | 179 | //·Template·literal·types |
| 177 | export·type·{CamelCase,·CamelCaseOptions}·from·'./source/camel-case.d.ts'; | 180 | export·type·{CamelCase,·CamelCaseOptions}·from·'./source/camel-case.d.ts'; |
| 178 | export·type·{CamelCasedProperties}·from·'./source/camel-cased-properties.d.ts'; | 181 | export·type·{CamelCasedProperties}·from·'./source/camel-cased-properties.d.ts'; |
| 179 | export·type·{CamelCasedPropertiesDeep}·from·'./source/camel-cased-properties-deep.d.ts'; | 182 | export·type·{CamelCasedPropertiesDeep}·from·'./source/camel-cased-properties-deep.d.ts'; |
| 180 | export·type·{KebabCase}·from·'./source/kebab-case.d.ts'; | 183 | export·type·{KebabCase}·from·'./source/kebab-case.d.ts'; |
| 181 | export·type·{KebabCasedProperties}·from·'./source/kebab-cased-properties.d.ts'; | 184 | export·type·{KebabCasedProperties}·from·'./source/kebab-cased-properties.d.ts'; |
| Offset 5, 25 lines modified | Offset 5, 27 lines modified | ||
| 5 | ········"url":·"https://sindresorhus.com" | 5 | ········"url":·"https://sindresorhus.com" |
| 6 | ····}, | 6 | ····}, |
| 7 | ····"dependencies":·{ | 7 | ····"dependencies":·{ |
| 8 | ········"tagged-tag":·"^1.0.0" | 8 | ········"tagged-tag":·"^1.0.0" |
| 9 | ····}, | 9 | ····}, |
| 10 | ····"description":·"A·collection·of·essential·TypeScript·types", | 10 | ····"description":·"A·collection·of·essential·TypeScript·types", |
| 11 | ····"devDependencies":·{ | 11 | ····"devDependencies":·{ |
| 12 | ········"@eslint/markdown":·"^8.0.1", | ||
| 12 | ········"@sindresorhus/tsconfig":·"^8.0.1", | 13 | ········"@sindresorhus/tsconfig":·"^8.0.1", |
| 14 | ········"@types/node":·"^25.5.0", | ||
| 13 | ········"@typescript-eslint/parser":·"^8.44.0", | 15 | ········"@typescript-eslint/parser":·"^8.44.0", |
| 14 | ········"@typescript/vfs":·"^1.6.1", | 16 | ········"@typescript/vfs":·"^1.6.1", |
| 15 | ········"dedent":·"^1.7.0", | 17 | ········"dedent":·"^1.7.0", |
| 16 | ········"eslint":·"^ | 18 | ········"eslint":·"^10.1.0", |
| 17 | ········"expect-type":·"^1.2.2", | 19 | ········"expect-type":·"^1.2.2", |
| 18 | ········"npm-run-all2":·"^8.0.4", | 20 | ········"npm-run-all2":·"^8.0.4", |
| 19 | ········"tsd":·"^0.33.0", | 21 | ········"tsd":·"^0.33.0", |
| 20 | ········"typescript":·"^5.9.2", | 22 | ········"typescript":·"^5.9.2", |
| 21 | ········"typescript-eslint":·"^8.47.0", | 23 | ········"typescript-eslint":·"^8.47.0", |
| 22 | ········"xo":·"^ | 24 | ········"xo":·"^2.0.2" |
| 23 | ····}, | 25 | ····}, |
| 24 | ····"engines":·{ | 26 | ····"engines":·{ |
| 25 | ········"node":·">=20" | 27 | ········"node":·">=20" |
| 26 | ····}, | 28 | ····}, |
| 27 | ····"exports":·{ | 29 | ····"exports":·{ |
| 28 | ········".":·{ | 30 | ········".":·{ |
| 29 | ············"types":·"./index.d.ts" | 31 | ············"types":·"./index.d.ts" |
| Offset 55, 19 lines modified | Offset 57, 19 lines modified | ||
| 55 | ····"name":·"type-fest", | 57 | ····"name":·"type-fest", |
| 56 | ····"repository":·"sindresorhus/type-fest", | 58 | ····"repository":·"sindresorhus/type-fest", |
| 57 | ····"scripts":·{ | 59 | ····"scripts":·{ |
| 58 | ········"test":·"run-p·test:*", | 60 | ········"test":·"run-p·test:*", |
| 59 | ········"test:linter":·"node·--test", | 61 | ········"test:linter":·"node·--test", |
| 60 | ········"test:tsc":·"node·--max-old-space-size=6144·./node_modules/.bin/tsc", | 62 | ········"test:tsc":·"node·--max-old-space-size=6144·./node_modules/.bin/tsc", |
| 61 | ········"test:tsd":·"node·--max-old-space-size=6144·./node_modules/.bin/tsd", | 63 | ········"test:tsd":·"node·--max-old-space-size=6144·./node_modules/.bin/tsd", |
| 62 | ········"test:xo":·"node·--max-old-space-size=6144·./node_modules/.bin/xo·--ignores=lint-processors/fixtures/**/*.d.ts" | 64 | ········"test:xo":·"node·--max-old-space-size=6144·./node_modules/.bin/xo·--ignores=lint-processors/fixtures/**/*.d.ts·'**/*.{js,ts,md}'" |
| 63 | ····}, | 65 | ····}, |
| 64 | ····"sideEffects":·false, | 66 | ····"sideEffects":·false, |
| 65 | ····"tsd":·{ | 67 | ····"tsd":·{ |
| 66 | ········"compilerOptions":·{ | 68 | ········"compilerOptions":·{ |
| 67 | ············"noUnusedLocals":·false | 69 | ············"noUnusedLocals":·false |
| 68 | ········} | 70 | ········} |
| 69 | ····}, | 71 | ····}, |
| 70 | ····"type":·"module", | 72 | ····"type":·"module", |
| 71 | ····"types":·"./index.d.ts", | 73 | ····"types":·"./index.d.ts", |
| 72 | ····"version":·"5. | 74 | ····"version":·"5.6.0" |
| 73 | } | 75 | } |
| Offset 25, 14 lines modified | Offset 25, 25 lines modified | ||
| 25 | » » » » » <img·width="230"·src="https://sindresorhus.com/assets/thanks/nitric-logo.svg"·alt="nitric·logo"> | 25 | » » » » » <img·width="230"·src="https://sindresorhus.com/assets/thanks/nitric-logo.svg"·alt="nitric·logo"> |
| 26 | » » » » </div> | 26 | » » » » </div> |
| 27 | » » » » <b>Effortless·backends·with·infrastructure·from·code</b> | 27 | » » » » <b>Effortless·backends·with·infrastructure·from·code</b> |
| 28 | » » » » <div> | 28 | » » » » <div> |
| 29 | » » » » » <sup>An·open-source·framework·that·supports·any·programming·language,·cloud·provider,·or·deployment·automation·tool.</sup> | 29 | » » » » » <sup>An·open-source·framework·that·supports·any·programming·language,·cloud·provider,·or·deployment·automation·tool.</sup> |
| 30 | » » » » </div> | 30 | » » » » </div> |
| 31 | » » » </a> | 31 | » » » </a> |
| 32 | » » » <br> | ||
| 33 | » » » <br> | ||
| 34 | » » » <a·href="https://circleback.ai?utm_source=sindresorhus&utm_medium=sponsorship&utm_campaign=awesome-list&utm_id=type-fest"> | ||
| 35 | » » » » <div> | ||
| 36 | » » » » » <img·width="300"·src="https://sindresorhus.com/assets/thanks/circleback-logo.png?x"·alt="Circleback·logo"> | ||
| 37 | » » » » </div> | ||
| 38 | » » » » <b>Get·the·most·out·of·every·conversation.</b> | ||
| 39 | » » » » <div> | ||
| 40 | » » » » » <sup>AI-powered·meeting·notes,·automations,·and·search.·Give·AI·agents·the·context·they·need·to·get·things·done.</sup> | ||
| 41 | » » » » </div> | ||
| 42 | » » » </a> | ||
| 32 | » » </p> | 43 | » » </p> |
| 33 | » </div> | 44 | » </div> |
| 34 | » <br> | 45 | » <br> |
| 35 | » <hr> | 46 | » <hr> |
| 36 | </div> | 47 | </div> |
| 37 | <br> | 48 | <br> |
| 38 | <br> | 49 | <br> |
| Offset 98, 92 lines modified | Offset 109, 93 lines modified | ||
| 98 | -·[`EmptyObject`](source/empty-object.d.ts)·-·Represents·a·strictly·empty·plain·object,·the·`{}`·value. | 109 | -·[`EmptyObject`](source/empty-object.d.ts)·-·Represents·a·strictly·empty·plain·object,·the·`{}`·value. |
| 99 | -·[`NonEmptyObject`](source/non-empty-object.d.ts)·-·Represents·an·object·with·at·least·1·non-optional·key. | 110 | -·[`NonEmptyObject`](source/non-empty-object.d.ts)·-·Represents·an·object·with·at·least·1·non-optional·key. |
| 100 | -·[`UnknownRecord`](source/unknown-record.d.ts)·-·Represents·an·object·with·`unknown`·value.·You·probably·want·this·instead·of·`{}`. | 111 | -·[`UnknownRecord`](source/unknown-record.d.ts)·-·Represents·an·object·with·`unknown`·value.·You·probably·want·this·instead·of·`{}`. |
| 101 | -·[`UnknownArray`](source/unknown-array.d.ts)·-·Represents·an·array·with·`unknown`·value. | 112 | -·[`UnknownArray`](source/unknown-array.d.ts)·-·Represents·an·array·with·`unknown`·value. |
| 102 | -·[`UnknownMap`](source/unknown-map.d.ts)·-·Represents·a·map·with·`unknown`·key·and·value. | 113 | -·[`UnknownMap`](source/unknown-map.d.ts)·-·Represents·a·map·with·`unknown`·key·and·value. |
| 103 | -·[`UnknownSet`](source/unknown-set.d.ts)·-·Represents·a·set·with·`unknown`·value. | 114 | -·[`UnknownSet`](source/unknown-set.d.ts)·-·Represents·a·set·with·`unknown`·value. |
| 104 | -·[`Except`](source/except.d.ts)·-·Create·a·type·from·an·object·type·without·certain·keys. | 115 | -·[`Except`](source/except.d.ts)·-·Create·a·type·from·an·object·type·without·certain·keys. |
| 105 | -·[`Writable`](source/writable.d.ts)·-·Create·a·type·that·strips·`readonly`·from·the·given·type.·Inverse·of·`Readonly<T>`. | 116 | -·[`Writable`](source/writable.d.ts)·-·Create·a·type·that·strips·`readonly`·from·the·given·type.·Inverse·of·`Readonly<T>`. |
| 106 | -·[`WritableDeep`](source/writable-deep.d.ts)·-·Create·a·deeply·mutable·version·of·an·`object`/`ReadonlyMap`/`ReadonlySet`/`ReadonlyArray`·type.·The·inverse·of·`ReadonlyDeep<T>`.·Use·`Writable<T>`·if·you·only·need·one·level·deep. | 117 | -·[`WritableDeep`](source/writable-deep.d.ts)·-·Create·a·deeply·mutable·version·of·an·`object`/`ReadonlyMap`/`ReadonlySet`/`ReadonlyArray`·type.·The·inverse·of·`ReadonlyDeep<T>`.·Use·`Writable<T>`·if·you·only·need·one·level·deep. |
| 107 | -·[`Merge`](source/merge.d.ts)·-·Merge·two·types·into·a·new·type.·Keys·of·the·second·type·overrides·keys·of·the·first·type. | 118 | -·[`Merge`](source/merge.d.ts)·-·Merge·two·types·into·a·new·type.·Keys·of·the·second·type·overrides·keys·of·the·first·type. |
| 108 | -·[`ObjectMerge`](source/object-merge.d.ts)·-·Merge·two·object·types·into·a·new·object·type,·where·keys·from·the·second·override·keys·from·the·first. | 119 | -·[`ObjectMerge`](source/object-merge.d.ts)·-·Merge·two·object·types·into·a·new·object·type,·where·keys·from·the·second·override·keys·from·the·first. |
| 109 | -·[`MergeDeep`](source/merge-deep.d.ts)·-·Merge·two·objects·or·two·arrays/tuples·recursively·into·a·new·type. | 120 | -·[`MergeDeep`](source/merge-deep.d.ts)·-·Merge·two·objects·or·two·arrays/tuples·recursively·into·a·new·type. |
| 110 | -·[`MergeExclusive`](source/merge-exclusive.d.ts)·-·Create·a·type·that·has·mutually·exclusive·keys. | 121 | -·[`MergeExclusive`](source/merge-exclusive.d.ts)·-·Create·a·type·that·has·mutually·exclusive·keys. |
| 111 | -·[`OverrideProperties`](source/override-properties.d.ts)·-·Override· | 122 | -·[`OverrideProperties`](source/override-properties.d.ts)·-·Override·existing·properties·of·the·given·type.·Similar·to·`Merge`,·but·enforces·that·the·original·type·has·the·properties·you·want·to·override. |
| 112 | -·[`RequireAtLeastOne`](source/require-at-least-one.d.ts)·-·Create·a·type·that·requires·at·least·one·of·the·given·keys. | 123 | -·[`RequireAtLeastOne`](source/require-at-least-one.d.ts)·-·Create·a·type·that·requires·at·least·one·of·the·given·keys,·while·keeping·the·remaining·keys·as·is. |
| 113 | -·[`RequireExactlyOne`](source/require-exactly-one.d.ts)·-·Create·a·type·that·requires·exactly· | 124 | -·[`RequireExactlyOne`](source/require-exactly-one.d.ts)·-·Create·a·type·that·requires·exactly·one·of·the·given·keys·and·disallows·more,·while·keeping·the·remaining·keys·as·is. |
| 114 | -·[`RequireAllOrNone`](source/require-all-or-none.d.ts)·-·Create·a·type·that·requires·all·of·the·given·keys·or·none·of·the·given·keys. | 125 | -·[`RequireAllOrNone`](source/require-all-or-none.d.ts)·-·Create·a·type·that·requires·all·of·the·given·keys·or·none·of·the·given·keys,·while·keeping·the·remaining·keys·as·is. |
| 115 | -·[`RequireOneOrNone`](source/require-one-or-none.d.ts)·-·Create·a·type·that·requires·exactly· | 126 | -·[`RequireOneOrNone`](source/require-one-or-none.d.ts)·-·Create·a·type·that·requires·exactly·one·of·the·given·keys·or·none·of·the·given·keys,·while·keeping·the·remaining·keys·as·is. |
| 116 | -·[`SingleKeyObject`](source/single-key-object.d.ts)·-·Create·a·type·that·only·accepts·an·object·with·a·single·key. | 127 | -·[`SingleKeyObject`](source/single-key-object.d.ts)·-·Create·a·type·that·only·accepts·an·object·with·a·single·key. |
| 117 | -·[`RequiredDeep`](source/required-deep.d.ts)·-·Create·a·deeply·required·version·of·another·type.·Use·[`Required<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#requiredtype)·if·you·only·need·one·level·deep. | ||
| 118 | -·[`PickDeep`](source/pick-deep.d.ts)·-·Pick·properties·from·a·deeply-nested·object.·Use·[`Pick<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#picktype-keys)·if·you·only·need·one·level·deep. | ||
| 119 | -·[` | 128 | -·[`RequiredDeep`](source/required-deep.d.ts)·-·Create·a·deeply·required·version·of·another·type. |
| 129 | -·[`PickDeep`](source/pick-deep.d.ts)·-·Pick·properties·from·a·deeply-nested·object. | ||
| 130 | -·[`OmitDeep`](source/omit-deep.d.ts)·-·Omit·properties·from·a·deeply-nested·object. | ||
| 120 | -·[`OmitIndexSignature`](source/omit-index-signature.d.ts)·-·Omit·any·index·signatures·from·the·given·object·type,·leaving·only·explicitly·defined·properties. | 131 | -·[`OmitIndexSignature`](source/omit-index-signature.d.ts)·-·Omit·any·index·signatures·from·the·given·object·type,·leaving·only·explicitly·defined·properties. |
| 121 | -·[`PickIndexSignature`](source/pick-index-signature.d.ts)·-·Pick·only·index·signatures·from·the·given·object·type,·leaving·out·all·explicitly·defined·properties. | 132 | -·[`PickIndexSignature`](source/pick-index-signature.d.ts)·-·Pick·only·index·signatures·from·the·given·object·type,·leaving·out·all·explicitly·defined·properties. |
| 122 | -·[`PartialDeep`](source/partial-deep.d.ts)·-·Create·a·deeply·optional·version·of·another·type. | 133 | -·[`PartialDeep`](source/partial-deep.d.ts)·-·Create·a·deeply·optional·version·of·another·type. |
| 123 | -·[`PartialOnUndefinedDeep`](source/partial-on-undefined-deep.d.ts)·-·Create·a·deep·version·of·another·type·where·all·keys·accepting·`undefined`·type·are·set·to·optional. | 134 | -·[`PartialOnUndefinedDeep`](source/partial-on-undefined-deep.d.ts)·-·Create·a·deep·version·of·another·type·where·all·keys·accepting·`undefined`·type·are·set·to·optional. |
| 124 | -·[`UndefinedOnPartialDeep`](source/undefined-on-partial-deep.d.ts)·-·Create·a·deep·version·of·another·type·where·all·optional·keys·are·set·to·also·accept·`undefined`. | 135 | -·[`UndefinedOnPartialDeep`](source/undefined-on-partial-deep.d.ts)·-·Create·a·deep·version·of·another·type·where·all·optional·keys·are·set·to·also·accept·`undefined`. |
| 125 | -·[`UnwrapPartial`](source/unwrap-partial.d.ts)·-·Revert·the·`Partial`·modifier·on·an·object·type. | 136 | -·[`UnwrapPartial`](source/unwrap-partial.d.ts)·-·Revert·the·`Partial`·modifier·on·an·object·type. |
| 126 | -·[`ReadonlyDeep`](source/readonly-deep.d.ts)·-·Create·a·deeply·immutable·version·of·an | 137 | -·[`ReadonlyDeep`](source/readonly-deep.d.ts)·-·Create·a·deeply·immutable·version·of·another·type. |
| 127 | -·[`LiteralUnion`](source/literal-union.d.ts)·-·Create·a·union·type·by·combining·primitive·types·and·literal·types·without·sacrificing·auto-completion·in·IDEs·for·the·literal·type·part·of·the·union. | 138 | -·[`LiteralUnion`](source/literal-union.d.ts)·-·Create·a·union·type·by·combining·primitive·types·and·literal·types·without·sacrificing·auto-completion·in·IDEs·for·the·literal·type·part·of·the·union. |
| 128 | -·[`Tagged`](source/tagged.d.ts)·-·Create·a·[tagged·type](https://medium.com/@KevinBGreene/surviving-the-typescript-ecosystem-branding-and-type-tagging-6cf6e516523d)·that·can·support·[multiple·tags](https://github.com/sindresorhus/type-fest/issues/665)·and·[per-tag·metadata](https://medium.com/@ethanresnick/advanced-typescript-tagged-types-improved-with-type-level-metadata-5072fc125fcf). | 139 | -·[`Tagged`](source/tagged.d.ts)·-·Create·a·[tagged·type](https://medium.com/@KevinBGreene/surviving-the-typescript-ecosystem-branding-and-type-tagging-6cf6e516523d)·that·can·support·[multiple·tags](https://github.com/sindresorhus/type-fest/issues/665)·and·[per-tag·metadata](https://medium.com/@ethanresnick/advanced-typescript-tagged-types-improved-with-type-level-metadata-5072fc125fcf). |
| 129 | -·[`UnwrapTagged`](source/tagged.d.ts)·-·Get·the·untagged·portion·of·a·tagged·type·created·with·`Tagged`. | 140 | -·[`UnwrapTagged`](source/tagged.d.ts)·-·Get·the·untagged·portion·of·a·tagged·type·created·with·`Tagged`. |
| 130 | -·[`InvariantOf`](source/invariant-of.d.ts)·-·Create·an·[invariant·type](https://basarat.gitbook.io/typescript/type-system/type-compatibility#footnote-invariance),·which·is·a·type·that·does·not·accept·supertypes·and·subtypes. | 141 | -·[`InvariantOf`](source/invariant-of.d.ts)·-·Create·an·[invariant·type](https://basarat.gitbook.io/typescript/type-system/type-compatibility#footnote-invariance),·which·is·a·type·that·does·not·accept·supertypes·and·subtypes. |
| 131 | -·[`SetOptional`](source/set-optional.d.ts)·-·Create·a·type·that·makes·the·given·keys·optional. | 142 | -·[`SetOptional`](source/set-optional.d.ts)·-·Create·a·type·that·makes·the·given·keys·optional,·while·keeping·the·remaining·keys·as·is. |
| 132 | -·[`SetReadonly`](source/set-readonly.d.ts)·-·Create·a·type·that·makes·the·given·keys·readonly. | 143 | -·[`SetReadonly`](source/set-readonly.d.ts)·-·Create·a·type·that·makes·the·given·keys·readonly,·while·keeping·the·remaining·keys·as·is. |
| 133 | -·[`SetRequired`](source/set-required.d.ts)·-·Create·a·type·that·makes·the·given·keys·required. | 144 | -·[`SetRequired`](source/set-required.d.ts)·-·Create·a·type·that·makes·the·given·keys·required,·while·keeping·the·remaining·keys·as·is. |
| 134 | -·[`SetRequiredDeep`](source/set-required-deep.d.ts)·-· | 145 | -·[`SetRequiredDeep`](source/set-required-deep.d.ts)·-·Create·a·type·that·makes·the·given·keys·required,·with·support·for·deeply·nested·key·paths,·while·keeping·the·remaining·keys·as·is. |
| 135 | -·[`SetNonNullable`](source/set-non-nullable.d.ts)·-·Create·a·type·that·makes·the·given·keys·non-nullable. | 146 | -·[`SetNonNullable`](source/set-non-nullable.d.ts)·-·Create·a·type·that·makes·the·given·keys·non-nullable,·while·keeping·the·remaining·keys·as·is. |
| 136 | -·[`SetNonNullableDeep`](source/set-non-nullable-deep.d.ts)·-·Create·a·type·that·makes·the·specified·keys·non-nullable·(removes·`null`·and·`undefined`),·supports·deeply·nested·key·paths,·and·leaves·all·other·keys·unchanged. | 147 | -·[`SetNonNullableDeep`](source/set-non-nullable-deep.d.ts)·-·Create·a·type·that·makes·the·specified·keys·non-nullable·(removes·`null`·and·`undefined`),·supports·deeply·nested·key·paths,·and·leaves·all·other·keys·unchanged. |
| 148 | -·[`NonNullableDeep`](source/non-nullable-deep.d.ts)·-·Recursively·removes·`null`·and·`undefined`·from·the·specified·type. | ||
| 137 | -·[`ValueOf`](source/value-of.d.ts)·-·Create·a·union·of·the·given·object's·values,·and·optionally·specify·which·keys·to·get·the·values·from. | 149 | -·[`ValueOf`](source/value-of.d.ts)·-·Create·a·union·of·the·given·object's·values,·and·optionally·specify·which·keys·to·get·the·values·from. |
| 138 | -·[`ConditionalKeys`](source/conditional-keys.d.ts)·-·Extract·keys·from·a· | 150 | -·[`ConditionalKeys`](source/conditional-keys.d.ts)·-·Extract·the·keys·from·a·type·where·the·value·type·of·the·key·extends·the·given·`Condition`. |
| 139 | -·[`ConditionalPick`](source/conditional-pick.d.ts)·-·Like·`Pick`·except·it·selects·properties·from·a·shape·where·the·values·extend·the·given·`Condition`·type. | ||
| 140 | -·[`ConditionalPickDeep`](source/conditional-pick-deep.d.ts)·-·Like·`ConditionalPick`·except·that·it·selects·the·properties·deeply. | ||
| 141 | -·[`Conditional | 151 | -·[`ConditionalPick`](source/conditional-pick.d.ts)·-·Pick·keys·from·the·shape·that·matches·the·given·`Condition`. |
| 152 | -·[`ConditionalPickDeep`](source/conditional-pick-deep.d.ts)·-·Pick·keys·recursively·from·the·shape·that·matches·the·given·condition. | ||
| 153 | -·[`ConditionalExcept`](source/conditional-except.d.ts)·-·Exclude·keys·from·a·shape·that·matches·the·given·`Condition`. | ||
| 142 | -·[`UnionToIntersection`](source/union-to-intersection.d.ts)·-·Convert·a·union·type·to·an·intersection·type. | 154 | -·[`UnionToIntersection`](source/union-to-intersection.d.ts)·-·Convert·a·union·type·to·an·intersection·type. |
| 143 | -·[`LiteralToPrimitive`](source/literal-to-primitive.d.ts)·-· | 155 | -·[`LiteralToPrimitive`](source/literal-to-primitive.d.ts)·-·Given·a·[literal·type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types)·return·the·[primitive·type](https://developer.mozilla.org/en-US/docs/Glossary/Primitive)·it·belongs·to,·or·`never`·if·it's·not·a·primitive. |
| 144 | -·[`LiteralToPrimitiveDeep`](source/literal-to-primitive-deep.d.ts)·-·Like·`LiteralToPrimitive`·except·it·converts·literal·types·inside·an·object·or·array·deeply. | 156 | -·[`LiteralToPrimitiveDeep`](source/literal-to-primitive-deep.d.ts)·-·Like·`LiteralToPrimitive`·except·it·converts·literal·types·inside·an·object·or·array·deeply. |
| 145 | -·[`Stringified`](source/stringified.d.ts)·-·Create·a·type·with·the·keys·of·the·given·type·changed·to·`string`·type. | 157 | -·[`Stringified`](source/stringified.d.ts)·-·Create·a·type·with·the·keys·of·the·given·type·changed·to·`string`·type. |
| 146 | -·[`IterableElement`](source/iterable-element.d.ts)·-·Get·the·element·type·of·an·`Iterable`/`AsyncIterable`.·For·example,·`Array`,·`Set`,·`Map`,·generator,·stream,·etc. | 158 | -·[`IterableElement`](source/iterable-element.d.ts)·-·Get·the·element·type·of·an·`Iterable`/`AsyncIterable`.·For·example,·`Array`,·`Set`,·`Map`,·generator,·stream,·etc. |
| 147 | -·[`Entry`](source/entry.d.ts)·-·Create·a·type·that·represents·the·type·of·an·entry·of·a·collection. | ||
| 148 | -·[`Entr | 159 | -·[`Entry`](source/entry.d.ts)·-·Create·a·type·that·describes·a·single·key-value·pair·produced·when·calling·a·collection’s·`entries`·method. |
| 160 | -·[`Entries`](source/entries.d.ts)·-·Create·a·type·that·describes·the·key-value·pairs·produced·when·calling·a·collection’s·`entries`·method. | ||
| 149 | -·[`SetReturnType`](source/set-return-type.d.ts)·-·Create·a·function·type·with·a·return·type·of·your·choice·and·the·same·parameters·as·the·given·function·type. | 161 | -·[`SetReturnType`](source/set-return-type.d.ts)·-·Create·a·function·type·with·a·return·type·of·your·choice·and·the·same·parameters·as·the·given·function·type. |
| 150 | -·[`SetParameterType`](source/set-parameter-type.d.ts)·-·Create·a·function·that·replaces·some·parameters·with·the·given·parameters. | 162 | -·[`SetParameterType`](source/set-parameter-type.d.ts)·-·Create·a·function·that·replaces·some·parameters·with·the·given·parameters. |
| 151 | -·[`Simplify`](source/simplify.d.ts)·-·Useful·to·flatten·the·type·output·to·improve·type·hints·shown·in·editors.·And·also·to·transform·an·interface·into·a·type·to·aide·with·assignability. | 163 | -·[`Simplify`](source/simplify.d.ts)·-·Useful·to·flatten·the·type·output·to·improve·type·hints·shown·in·editors.·And·also·to·transform·an·interface·into·a·type·to·aide·with·assignability. |
| 152 | -·[`SimplifyDeep`](source/simplify-deep.d.ts)·-·Deeply·simplifies·an·object·type. | 164 | -·[`SimplifyDeep`](source/simplify-deep.d.ts)·-·Deeply·simplifies·an·object·type. |
| 153 | -·[`Get`](source/get.d.ts)·-·Get·a·deeply-nested·property·from·an·object·using·a·key·path,·like·[Lodash's·`.get()`](https://lodash.com/docs/latest#get)·function. | 165 | -·[`Get`](source/get.d.ts)·-·Get·a·deeply-nested·property·from·an·object·using·a·key·path,·like·[Lodash's·`.get()`](https://lodash.com/docs/latest#get)·function. |
| 154 | -·[`KeyAsString`](source/key-as-string.d.ts)·-·Get·keys·of·the·given·type·as·strings. | 166 | -·[`KeyAsString`](source/key-as-string.d.ts)·-·Get·keys·of·the·given·type·as·strings. |
| 155 | -·[`Schema`](source/schema.d.ts)·-·Create·a·deep·version·of·another·object·type·where·property·values·are·recursively·replaced·into·a·given·value·type. | 167 | -·[`Schema`](source/schema.d.ts)·-·Create·a·deep·version·of·another·object·type·where·property·values·are·recursively·replaced·into·a·given·value·type. |
| 156 | -·[`Exact`](source/exact.d.ts)·-·Create·a·type·that·does·not·allow·extra·properties. | 168 | -·[`Exact`](source/exact.d.ts)·-·Create·a·type·that·does·not·allow·extra·properties,·meaning·it·only·allows·properties·that·are·explicitly·declared. |
| 157 | -·[`KeysOfUnion`](source/keys-of-union.d.ts)·-·Create·a·union·of·all·keys·from·a·given·type,·even·those·exclusive·to·specific·union·members. | 169 | -·[`KeysOfUnion`](source/keys-of-union.d.ts)·-·Create·a·union·of·all·keys·from·a·given·type,·even·those·exclusive·to·specific·union·members. |
| 158 | -·[`OptionalKeysOf`](source/optional-keys-of.d.ts)·-·Extract·all·optional·keys·from·the·given·type. | 170 | -·[`OptionalKeysOf`](source/optional-keys-of.d.ts)·-·Extract·all·optional·keys·from·the·given·type. |
| 159 | -·[`HasOptionalKeys`](source/has-optional-keys.d.ts)·-· | 171 | -·[`HasOptionalKeys`](source/has-optional-keys.d.ts)·-·Returns·a·boolean·for·whether·the·given·type·has·any·optional·fields. |
| 160 | -·[`RequiredKeysOf`](source/required-keys-of.d.ts)·-·Extract·all·required·keys·from·the·given·type. | 172 | -·[`RequiredKeysOf`](source/required-keys-of.d.ts)·-·Extract·all·required·keys·from·the·given·type. |
| 161 | -·[`HasRequiredKeys`](source/has-required-keys.d.ts)·-· | 173 | -·[`HasRequiredKeys`](source/has-required-keys.d.ts)·-·Returns·a·boolean·for·whether·the·given·type·has·any·required·fields. |
| 162 | -·[`ReadonlyKeysOf`](source/readonly-keys-of.d.ts)·-·Extract·all·readonly·keys·from·the·given·type. | 174 | -·[`ReadonlyKeysOf`](source/readonly-keys-of.d.ts)·-·Extract·all·readonly·keys·from·the·given·type. |
| 163 | -·[`HasReadonlyKeys`](source/has-readonly-keys.d.ts)·-· | 175 | -·[`HasReadonlyKeys`](source/has-readonly-keys.d.ts)·-·Returns·a·boolean·for·whether·the·given·type·has·any·readonly·fields. |
| Max diff block lines reached; 17177/33503 bytes (51.27%) of diff not shown. | |||
| Offset 65, 27 lines modified | Offset 65, 27 lines modified | ||
| 65 | @see·{@link·SharedUnionFields} | 65 | @see·{@link·SharedUnionFields} |
| 66 | @category·Object | 66 | @category·Object |
| 67 | @category·Union | 67 | @category·Union |
| 68 | */ | 68 | */ |
| 69 | export·type·AllUnionFields<Union>·= | 69 | export·type·AllUnionFields<Union>·= |
| 70 | Extract<Union,·NonRecursiveType·|·ReadonlyMap<unknown,·unknown>·|·ReadonlySet<unknown>·|·UnknownArray>·extends·infer·SkippedMembers | 70 | » Extract<Union,·NonRecursiveType·|·ReadonlyMap<unknown,·unknown>·|·ReadonlySet<unknown>·|·UnknownArray>·extends·infer·SkippedMembers |
| 71 | » ?·Exclude<Union,·SkippedMembers>·extends·infer·RelevantMembers | 71 | » » ?·Exclude<Union,·SkippedMembers>·extends·infer·RelevantMembers |
| 72 | » » ? | 72 | » » » ?·//·eslint-disable-line·@stylistic/operator-linebreak |
| 73 | » » |·SkippedMembers | 73 | » » » |·SkippedMembers |
| 74 | » » |·Simplify< | 74 | » » » |·Simplify< |
| 75 | » » //·Include·fields·that·are·common·in·all·union·members | 75 | » » » » //·Include·fields·that·are·common·in·all·union·members |
| 76 | » » » SharedUnionFields<RelevantMembers> | 76 | » » » » SharedUnionFields<RelevantMembers> |
| 77 | » » //·Include·readonly·fields·present·in·any·union·member | 77 | » » » » //·Include·readonly·fields·present·in·any·union·member |
| 78 | » » » { | 78 | » » » » &·{ |
| 79 | » » » » readonly·[P·in·ReadonlyKeysOfUnion<RelevantMembers>]?:·ValueOfUnion<RelevantMembers,·P·&·KeysOfUnion<RelevantMembers>> | 79 | » » » » » readonly·[P·in·ReadonlyKeysOfUnion<RelevantMembers>]?:·ValueOfUnion<RelevantMembers,·P·&·KeysOfUnion<RelevantMembers>> |
| 80 | » » » | 80 | » » » » } |
| 81 | » » //·Include·remaining·fields·that·are·neither·common·nor·readonly | 81 | » » » » //·Include·remaining·fields·that·are·neither·common·nor·readonly |
| 82 | » » » { | 82 | » » » » &·{ |
| 83 | » » » » [P·in·Exclude<KeysOfUnion<RelevantMembers>,·ReadonlyKeysOfUnion<RelevantMembers>·|·keyof·RelevantMembers>]?:·ValueOfUnion<RelevantMembers,·P> | 83 | » » » » » [P·in·Exclude<KeysOfUnion<RelevantMembers>,·ReadonlyKeysOfUnion<RelevantMembers>·|·keyof·RelevantMembers>]?:·ValueOfUnion<RelevantMembers,·P> |
| 84 | » » » } | 84 | » » » » } |
| 85 | » » > | 85 | » » » > |
| 86 | » » :·never | 86 | » » » :·never |
| 87 | » :·never; | 87 | » » :·never; |
| 88 | export·{}; | 88 | export·{}; |
| Offset 1, 11 lines modified | Offset 1, 11 lines modified | ||
| 1 | import·type·{AndAll}·from·'./and-all.d.ts'; | 1 | import·type·{AndAll}·from·'./and-all.d.ts'; |
| 2 | /** | 2 | /** |
| 3 | Returns·a·boolean·for·whether·two·given·types·are·both·true. | 3 | Returns·a·boolean·for·whether·two·given·types·are·both·`true`. |
| 4 | Use-case:·Constructing·complex·conditional·types·where·multiple·conditions·must·be·satisfied. | 4 | Use-case:·Constructing·complex·conditional·types·where·multiple·conditions·must·be·satisfied. |
| 5 | @example | 5 | @example |
| 6 | ``` | 6 | ``` |
| 7 | import·type·{And}·from·'type-fest'; | 7 | import·type·{And}·from·'type-fest'; |
| Offset 4, 49 lines modified | Offset 4, 49 lines modified | ||
| 4 | import·type·{UnknownArray}·from·'./unknown-array.d.ts'; | 4 | import·type·{UnknownArray}·from·'./unknown-array.d.ts'; |
| 5 | import·type·{TupleOf}·from·'./tuple-of.d.ts'; | 5 | import·type·{TupleOf}·from·'./tuple-of.d.ts'; |
| 6 | /** | 6 | /** |
| 7 | The·implementation·of·`SplitArrayByIndex`·for·fixed·length·arrays. | 7 | The·implementation·of·`SplitArrayByIndex`·for·fixed·length·arrays. |
| 8 | */ | 8 | */ |
| 9 | type·SplitFixedArrayByIndex<T·extends·UnknownArray,·SplitIndex·extends·number>·= | 9 | type·SplitFixedArrayByIndex<T·extends·UnknownArray,·SplitIndex·extends·number>·= |
| 10 | SplitIndex·extends·0 | 10 | » SplitIndex·extends·0 |
| 11 | » ?·[[],·T] | 11 | » » ?·[[],·T] |
| 12 | » :·T·extends·readonly·[...TupleOf<SplitIndex>,·...infer·V] | 12 | » » :·T·extends·readonly·[...TupleOf<SplitIndex>,·...infer·V] |
| 13 | » » ?·T·extends·readonly·[...infer·U,·...V] | 13 | » » » ?·T·extends·readonly·[...infer·U,·...V] |
| 14 | » » » ?·[U,·V] | 14 | » » » » ?·[U,·V] |
| 15 | » » » :·[never,·never] | 15 | » » » » :·[never,·never] |
| 16 | » » :·[never,·never]; | 16 | » » » :·[never,·never]; |
| 17 | /** | 17 | /** |
| 18 | The·implementation·of·`SplitArrayByIndex`·for·variable·length·arrays. | 18 | The·implementation·of·`SplitArrayByIndex`·for·variable·length·arrays. |
| 19 | */ | 19 | */ |
| 20 | type·SplitVariableArrayByIndex<T·extends·UnknownArray, | 20 | type·SplitVariableArrayByIndex<T·extends·UnknownArray, |
| 21 | » SplitIndex·extends·number, | 21 | » SplitIndex·extends·number, |
| 22 | » T1·=·Subtract<SplitIndex,·StaticPartOfArray<T>['length']>, | 22 | » T1·=·Subtract<SplitIndex,·StaticPartOfArray<T>['length']>, |
| 23 | » T2·=·T1·extends·number | 23 | » T2·=·T1·extends·number |
| 24 | » » ?·TupleOf<GreaterThanOrEqual<T1,·0>·extends·true·?·T1·:·number,·VariablePartOfArray<T>[number]> | 24 | » » ?·TupleOf<GreaterThanOrEqual<T1,·0>·extends·true·?·T1·:·number,·VariablePartOfArray<T>[number]> |
| 25 | » » :·[], | 25 | » » :·[], |
| 26 | >·= | 26 | >·= |
| 27 | SplitIndex·extends·0 | 27 | » SplitIndex·extends·0 |
| 28 | » ?·[[],·T] | 28 | » » ?·[[],·T] |
| 29 | » :·GreaterThanOrEqual<StaticPartOfArray<T>['length'],·SplitIndex>·extends·true | 29 | » » :·GreaterThanOrEqual<StaticPartOfArray<T>['length'],·SplitIndex>·extends·true |
| 30 | » » ?·[ | 30 | » » » ?·[ |
| 31 | » » » SplitFixedArrayByIndex<StaticPartOfArray<T>,·SplitIndex>[0], | 31 | » » » » SplitFixedArrayByIndex<StaticPartOfArray<T>,·SplitIndex>[0], |
| 32 | » » » [ | 32 | » » » » [ |
| 33 | » » » » ...SplitFixedArrayByIndex<StaticPartOfArray<T>,·SplitIndex>[1], | 33 | » » » » » ...SplitFixedArrayByIndex<StaticPartOfArray<T>,·SplitIndex>[1], |
| 34 | » » » » ...VariablePartOfArray<T>, | 34 | » » » » » ...VariablePartOfArray<T>, |
| 35 | » » » ], | 35 | » » » » ], |
| 36 | » » ] | 36 | » » » ] |
| 37 | » » :·[ | 37 | » » » :·[ |
| 38 | » » » [ | 38 | » » » » [ |
| 39 | » » » » ...StaticPartOfArray<T>, | 39 | » » » » » ...StaticPartOfArray<T>, |
| 40 | » » » » ...(T2·extends·UnknownArray·?·T2·:·[]), | 40 | » » » » » ...(T2·extends·UnknownArray·?·T2·:·[]), |
| 41 | » » » ], | 41 | » » » » ], |
| 42 | » » » VariablePartOfArray<T>, | 42 | » » » » VariablePartOfArray<T>, |
| 43 | » » ]; | 43 | » » » ]; |
| 44 | /** | 44 | /** |
| 45 | Split·the·given·array·`T`·by·the·given·`SplitIndex`. | 45 | Split·the·given·array·`T`·by·the·given·`SplitIndex`. |
| 46 | @example | 46 | @example |
| 47 | ``` | 47 | ``` |
| 48 | type·A·=·SplitArrayByIndex<[1,·2,·3,·4],·2>; | 48 | type·A·=·SplitArrayByIndex<[1,·2,·3,·4],·2>; |
| Offset 1, 30 lines modified | Offset 1, 56 lines modified | ||
| 1 | import·type·{ApplyDefaultOptions}·from·'./internal/index.d.ts'; | 1 | import·type·{ApplyDefaultOptions}·from·'./internal/index.d.ts'; |
| 2 | import·type·{Words,·WordsOptions}·from·'./words.d.ts'; | 2 | import·type·{_DefaultWordsOptions,·Words,·WordsOptions}·from·'./words.d.ts'; |
| 3 | /** | 3 | /** |
| 4 | CamelCase·options. | 4 | CamelCase·options. |
| 5 | @see·{@link·CamelCase} | 5 | @see·{@link·CamelCase} |
| 6 | */ | 6 | */ |
| 7 | export·type·CamelCaseOptions·=·WordsOptions·&·{ | 7 | export·type·CamelCaseOptions·=·WordsOptions·&·{ |
| 8 | » /** | 8 | » /** |
| 9 | » Whether·to·preserved·consecutive·uppercase·letter. | 9 | » Whether·to·preserved·consecutive·uppercase·letter. |
| 10 | » @default·false | 10 | » @default·false |
| 11 | » */ | 11 | » */ |
| 12 | » preserveConsecutiveUppercase?:·boolean; | 12 | » preserveConsecutiveUppercase?:·boolean; |
| 13 | » /** | ||
| 14 | » Whether·to·preserve·leading·underscores. | ||
| 15 | » This·matches·the·behavior·of·the·[`camelcase`](https://github.com/sindresorhus/camelcase)·package·v9+. | ||
| 16 | » @default·false | ||
| 17 | » */ | ||
| 18 | » preserveLeadingUnderscores?:·boolean; | ||
| 13 | }; | 19 | }; |
| 14 | export·type·_DefaultCamelCaseOptions·=·{ | 20 | export·type·_DefaultCamelCaseOptions·=·_DefaultWordsOptions·&·{ |
| 15 | » splitOnNumbers:·true; | ||
| 16 | » preserveConsecutiveUppercase:·false; | 21 | » preserveConsecutiveUppercase:·false; |
| 22 | » preserveLeadingUnderscores:·false; | ||
| 17 | }; | 23 | }; |
| 18 | /** | 24 | /** |
| 25 | Extract·leading·underscores·from·a·string. | ||
| 26 | @example | ||
| 27 | ``` | ||
| 28 | type·A·=·LeadingUnderscores<'__foo_bar'>; | ||
| 29 | //=>·'__' | ||
| 30 | type·B·=·LeadingUnderscores<'foo_bar'>; | ||
| 31 | //=>·'' | ||
| 32 | ``` | ||
| 33 | */ | ||
| 34 | type·LeadingUnderscores<Type·extends·string,·Underscores·extends·string·=·''>·= | ||
| 35 | » Type·extends·`_${infer·Rest}` | ||
| 36 | » » ?·LeadingUnderscores<Rest,·`_${Underscores}`> | ||
| 37 | » » :·Underscores; | ||
| 38 | /** | ||
| 19 | Convert·an·array·of·words·to·camel-case. | 39 | Convert·an·array·of·words·to·camel-case. |
| 20 | */ | 40 | */ |
| 21 | type·CamelCaseFromArray< | 41 | type·CamelCaseFromArray< |
| 22 | » Words·extends·string[], | 42 | » Words·extends·string[], |
| 23 | » Options·extends·Required<CamelCaseOptions>, | 43 | » Options·extends·Required<CamelCaseOptions>, |
| 24 | » OutputString·extends·string·=·'', | 44 | » OutputString·extends·string·=·'', |
| 25 | >·=·Words·extends·[ | 45 | >·=·Words·extends·[ |
| Offset 39, 22 lines modified | Offset 65, 26 lines modified | ||
| 39 | /** | 65 | /** |
| 40 | Convert·a·string·literal·to·camel-case. | 66 | Convert·a·string·literal·to·camel-case. |
| 41 | This·can·be·useful·when,·for·example,·converting·some·kebab-cased·command-line·flags·or·a·snake-cased·database·result. | 67 | This·can·be·useful·when,·for·example,·converting·some·kebab-cased·command-line·flags·or·a·snake-cased·database·result. |
| 42 | By·default,·consecutive·uppercase·letter·are·preserved.·See·{@link·CamelCaseOptions.preserveConsecutiveUppercase·preserveConsecutiveUppercase}·option·to·change·this·behaviour. | 68 | By·default,·consecutive·uppercase·letter·are·preserved.·See·{@link·CamelCaseOptions.preserveConsecutiveUppercase·preserveConsecutiveUppercase}·option·to·change·this·behaviour. |
| 69 | Use·the·`preserveLeadingUnderscores`·option·to·retain·leading·underscores,·matching·the·runtime·behavior·of·[`camelcase`](https://github.com/sindresorhus/camelcase)·v9+. | ||
| 43 | @example | 70 | @example |
| 44 | ``` | 71 | ``` |
| 45 | import·type·{CamelCase}·from·'type-fest'; | 72 | import·type·{CamelCase}·from·'type-fest'; |
| 46 | //·Simple | 73 | //·Simple |
| 47 | const·someVariable:·CamelCase<'foo-bar'>·=·'fooBar'; | 74 | const·someVariable:·CamelCase<'foo-bar'>·=·'fooBar'; |
| 48 | const·preserveConsecutiveUppercase:·CamelCase<'foo-BAR-baz',·{preserveConsecutiveUppercase:·true}>·=·'fooBARBaz'; | 75 | const·preserveConsecutiveUppercase:·CamelCase<'foo-BAR-baz',·{preserveConsecutiveUppercase:·true}>·=·'fooBARBaz'; |
| 76 | const·splitOnPunctuation:·CamelCase<'foo-bar:BAZ',·{splitOnPunctuation:·true}>·=·'fooBarBaz'; | ||
| 77 | const·preserveLeadingUnderscores:·CamelCase<'_foo_bar',·{preserveLeadingUnderscores:·true}>·=·'_fooBar'; | ||
| 49 | //·Advanced | 78 | //·Advanced |
| 50 | type·CamelCasedProperties<T>·=·{ | 79 | type·CamelCasedProperties<T>·=·{ |
| 51 | » [K·in·keyof·T·as·CamelCase<K>]:·T[K] | 80 | » [K·in·keyof·T·as·CamelCase<K>]:·T[K] |
| 52 | }; | 81 | }; |
| Offset 79, 14 lines modified | Offset 109, 17 lines modified | ||
| 79 | @category·Change·case | 109 | @category·Change·case |
| 80 | @category·Template·literal | 110 | @category·Template·literal |
| 81 | */ | 111 | */ |
| 82 | export·type·CamelCase<Type,·Options·extends·CamelCaseOptions·=·{}>·=·Type·extends·string | 112 | export·type·CamelCase<Type,·Options·extends·CamelCaseOptions·=·{}>·=·Type·extends·string |
| 83 | » ?·string·extends·Type | 113 | » ?·string·extends·Type |
| 84 | » » ?·Type | 114 | » » ?·Type |
| 115 | » » :·`${Options['preserveLeadingUnderscores']·extends·true | ||
| 116 | » » » ?·LeadingUnderscores<Type> | ||
| 117 | » » » :·'' | ||
| 85 | » » | 118 | » » }${Uncapitalize<CamelCaseFromArray< |
| 86 | » » » Words<Type·extends·Uppercase<Type>·?·Lowercase<Type>·:·Type,·Options>, | 119 | » » » Words<Type·extends·Uppercase<Type>·?·Lowercase<Type>·:·Type,·Options>, |
| 87 | » » » ApplyDefaultOptions<CamelCaseOptions,·_DefaultCamelCaseOptions,·Options> | 120 | » » » ApplyDefaultOptions<CamelCaseOptions,·_DefaultCamelCaseOptions,·Options> |
| 88 | » » >> | 121 | » » >>}` |
| Max diff block lines reached; 14/3107 bytes (0.45%) of diff not shown. | |||
| Offset 44, 14 lines modified | Offset 44, 21 lines modified | ||
| 44 | const·preserveConsecutiveUppercase:·CamelCasedPropertiesDeep<{fooBAR:·{fooBARBiz:·[{fooBARBaz:·string}]}},·{preserveConsecutiveUppercase:·true}>·=·{ | 44 | const·preserveConsecutiveUppercase:·CamelCasedPropertiesDeep<{fooBAR:·{fooBARBiz:·[{fooBARBaz:·string}]}},·{preserveConsecutiveUppercase:·true}>·=·{ |
| 45 | » fooBAR:·{ | 45 | » fooBAR:·{ |
| 46 | » » fooBARBiz:·[{ | 46 | » » fooBARBiz:·[{ |
| 47 | » » » fooBARBaz:·'string', | 47 | » » » fooBARBaz:·'string', |
| 48 | » » }], | 48 | » » }], |
| 49 | » }, | 49 | » }, |
| 50 | }; | 50 | }; |
| 51 | const·splitOnPunctuation:·CamelCasedPropertiesDeep<{'user@info':·{'user::id':·number;·'user::name':·string}},·{splitOnPunctuation:·true}>·=·{ | ||
| 52 | » userInfo:·{ | ||
| 53 | » » userId:·1, | ||
| 54 | » » userName:·'Tom', | ||
| 55 | » }, | ||
| 56 | }; | ||
| 51 | ``` | 57 | ``` |
| 52 | @category·Change·case | 58 | @category·Change·case |
| 53 | @category·Template·literal | 59 | @category·Template·literal |
| 54 | @category·Object | 60 | @category·Object |
| 55 | */ | 61 | */ |
| 56 | export·type·CamelCasedPropertiesDeep< | 62 | export·type·CamelCasedPropertiesDeep< |
| Offset 82, 18 lines modified | Offset 89, 18 lines modified | ||
| 82 | >·=·Value·extends·[] | 89 | >·=·Value·extends·[] |
| 83 | » ?·[] | 90 | » ?·[] |
| 84 | » //·Trailing·spread·array | 91 | » //·Trailing·spread·array |
| 85 | » :·Value·extends·[infer·U,·...infer·V] | 92 | » :·Value·extends·[infer·U,·...infer·V] |
| 86 | » » ?·[_CamelCasedPropertiesDeep<U,·Options>,·..._CamelCasedPropertiesDeep<V,·Options>] | 93 | » » ?·[_CamelCasedPropertiesDeep<U,·Options>,·..._CamelCasedPropertiesDeep<V,·Options>] |
| 87 | » » :·Value·extends·readonly·[infer·U,·...infer·V] | 94 | » » :·Value·extends·readonly·[infer·U,·...infer·V] |
| 88 | » » » ?·readonly·[_CamelCasedPropertiesDeep<U,·Options>,·..._CamelCasedPropertiesDeep<V,·Options>] | 95 | » » » ?·readonly·[_CamelCasedPropertiesDeep<U,·Options>,·..._CamelCasedPropertiesDeep<V,·Options>] |
| 89 | » » » | 96 | » » » //·Leading·spread·array |
| 90 | » » » Value·extends·readonly·[...infer·U,·infer·V] | 97 | » » » :·Value·extends·readonly·[...infer·U,·infer·V] |
| 91 | » » » » ?·[..._CamelCasedPropertiesDeep<U,·Options>,·_CamelCasedPropertiesDeep<V,·Options>] | 98 | » » » » ?·[..._CamelCasedPropertiesDeep<U,·Options>,·_CamelCasedPropertiesDeep<V,·Options>] |
| 92 | » » » » | 99 | » » » » //·Array |
| 93 | » » » » Value·extends·Array<infer·U> | 100 | » » » » :·Value·extends·Array<infer·U> |
| 94 | » » » » » ?·Array<_CamelCasedPropertiesDeep<U,·Options>> | 101 | » » » » » ?·Array<_CamelCasedPropertiesDeep<U,·Options>> |
| 95 | » » » » » :·Value·extends·ReadonlyArray<infer·U> | 102 | » » » » » :·Value·extends·ReadonlyArray<infer·U> |
| 96 | » » » » » » ?·ReadonlyArray<_CamelCasedPropertiesDeep<U,·Options>> | 103 | » » » » » » ?·ReadonlyArray<_CamelCasedPropertiesDeep<U,·Options>> |
| 97 | » » » » » » :·never; | 104 | » » » » » » :·never; |
| 98 | export·{}; | 105 | export·{}; |
| Offset 1, 12 lines modified | Offset 1, 12 lines modified | ||
| 1 | import·type·{CamelCase,·CamelCaseOptions,·_DefaultCamelCaseOptions}·from·'./camel-case.d.ts'; | 1 | import·type·{CamelCase,·CamelCaseOptions,·_DefaultCamelCaseOptions}·from·'./camel-case.d.ts'; |
| 2 | import·type·{ApplyDefaultOptions}·from·'./internal/index.d.ts'; | 2 | import·type·{ApplyDefaultOptions}·from·'./internal/index.d.ts'; |
| 3 | /** | 3 | /** |
| 4 | Convert·object·properties·to·camel·ca | 4 | Convert·top-level·object·properties·to·camel·case. |
| 5 | This·can·be·useful·when,·for·example,·converting·some·API·types·from·a·different·style. | 5 | This·can·be·useful·when,·for·example,·converting·some·API·types·from·a·different·style. |
| 6 | @see·{@link·CamelCasedPropertiesDeep} | 6 | @see·{@link·CamelCasedPropertiesDeep} |
| 7 | @see·{@link·CamelCase} | 7 | @see·{@link·CamelCase} |
| 8 | @example | 8 | @example |
| Offset 22, 14 lines modified | Offset 22, 18 lines modified | ||
| 22 | » userId:·1, | 22 | » userId:·1, |
| 23 | » userName:·'Tom', | 23 | » userName:·'Tom', |
| 24 | }; | 24 | }; |
| 25 | const·preserveConsecutiveUppercase:·CamelCasedProperties<{fooBAR:·string},·{preserveConsecutiveUppercase:·true}>·=·{ | 25 | const·preserveConsecutiveUppercase:·CamelCasedProperties<{fooBAR:·string},·{preserveConsecutiveUppercase:·true}>·=·{ |
| 26 | » fooBAR:·'string', | 26 | » fooBAR:·'string', |
| 27 | }; | 27 | }; |
| 28 | const·splitOnPunctuation:·CamelCasedProperties<{'foo::bar':·string},·{splitOnPunctuation:·true}>·=·{ | ||
| 29 | » fooBar:·'string', | ||
| 30 | }; | ||
| 28 | ``` | 31 | ``` |
| 29 | @category·Change·case | 32 | @category·Change·case |
| 30 | @category·Template·literal | 33 | @category·Template·literal |
| 31 | @category·Object | 34 | @category·Object |
| 32 | */ | 35 | */ |
| 33 | export·type·CamelCasedProperties<Value,·Options·extends·CamelCaseOptions·=·{}>·=·Value·extends·Function | 36 | export·type·CamelCasedProperties<Value,·Options·extends·CamelCaseOptions·=·{}>·=·Value·extends·Function |
| Offset 34, 14 lines modified | Offset 34, 15 lines modified | ||
| 34 | ``` | 34 | ``` |
| 35 | import·type·{DelimiterCase}·from·'type-fest'; | 35 | import·type·{DelimiterCase}·from·'type-fest'; |
| 36 | //·Simple | 36 | //·Simple |
| 37 | const·someVariable:·DelimiterCase<'fooBar',·'#'>·=·'foo#bar'; | 37 | const·someVariable:·DelimiterCase<'fooBar',·'#'>·=·'foo#bar'; |
| 38 | const·someVariableNoSplitOnNumbers:·DelimiterCase<'p2pNetwork',·'#',·{splitOnNumbers:·false}>·=·'p2p#network'; | 38 | const·someVariableNoSplitOnNumbers:·DelimiterCase<'p2pNetwork',·'#',·{splitOnNumbers:·false}>·=·'p2p#network'; |
| 39 | const·someVariableWithPunctuation:·DelimiterCase<'div.card::after',·'#',·{splitOnPunctuation:·true}>·=·'div#card#after'; | ||
| 39 | //·Advanced | 40 | //·Advanced |
| 40 | type·OddlyCasedProperties<T>·=·{ | 41 | type·OddlyCasedProperties<T>·=·{ |
| 41 | » [K·in·keyof·T·as·DelimiterCase<K,·'#'>]:·T[K] | 42 | » [K·in·keyof·T·as·DelimiterCase<K,·'#'>]:·T[K] |
| 42 | }; | 43 | }; |
| Offset 1, 14 lines modified | Offset 1, 14 lines modified | ||
| 1 | import·type·{_DefaultDelimiterCaseOptions,·DelimiterCase}·from·'./delimiter-case.d.ts'; | 1 | import·type·{_DefaultDelimiterCaseOptions,·DelimiterCase}·from·'./delimiter-case.d.ts'; |
| 2 | import·type·{ApplyDefaultOptions,·NonRecursiveType}·from·'./internal/index.d.ts'; | 2 | import·type·{ApplyDefaultOptions,·NonRecursiveType}·from·'./internal/index.d.ts'; |
| 3 | import·type·{UnknownArray}·from·'./unknown-array.d.ts'; | 3 | import·type·{UnknownArray}·from·'./unknown-array.d.ts'; |
| 4 | import·type·{WordsOptions}·from·'./words.d.ts'; | 4 | import·type·{WordsOptions}·from·'./words.d.ts'; |
| 5 | /** | 5 | /** |
| 6 | Convert·object·properties·to·delimiter·cas | 6 | Convert·object·properties·to·a·custom·string·delimiter·casing·recursively. |
| 7 | This·can·be·useful·when,·for·example,·converting·some·API·types·from·a·different·style. | 7 | This·can·be·useful·when,·for·example,·converting·some·API·types·from·a·different·style. |
| 8 | @see·{@link·DelimiterCase} | 8 | @see·{@link·DelimiterCase} |
| 9 | @see·{@link·DelimiterCasedProperties} | 9 | @see·{@link·DelimiterCasedProperties} |
| 10 | @example | 10 | @example |
| Offset 47, 14 lines modified | Offset 47, 21 lines modified | ||
| 47 | » » 'line-2':·[ | 47 | » » 'line-2':·[ |
| 48 | » » » { | 48 | » » » { |
| 49 | » » » » 'line-3':·'string', | 49 | » » » » 'line-3':·'string', |
| 50 | » » » }, | 50 | » » » }, |
| 51 | » » ], | 51 | » » ], |
| 52 | » }, | 52 | » }, |
| 53 | }; | 53 | }; |
| 54 | const·splitOnPunctuation:·DelimiterCasedPropertiesDeep<{'user@info':·{'user::id':·number;·'user::name':·string}},·'-',·{splitOnPunctuation:·true}>·=·{ | ||
| 55 | » 'user-info':·{ | ||
| 56 | » » 'user-id':·1, | ||
| 57 | » » 'user-name':·'Tom', | ||
| 58 | » }, | ||
| 59 | }; | ||
| 54 | ``` | 60 | ``` |
| 55 | @category·Change·case | 61 | @category·Change·case |
| 56 | @category·Template·literal | 62 | @category·Template·literal |
| 57 | @category·Object | 63 | @category·Object |
| 58 | */ | 64 | */ |
| 59 | export·type·DelimiterCasedPropertiesDeep< | 65 | export·type·DelimiterCasedPropertiesDeep< |
| Offset 1, 13 lines modified | Offset 1, 13 lines modified | ||
| 1 | import·type·{_DefaultDelimiterCaseOptions,·DelimiterCase}·from·'./delimiter-case.d.ts'; | 1 | import·type·{_DefaultDelimiterCaseOptions,·DelimiterCase}·from·'./delimiter-case.d.ts'; |
| 2 | import·type·{ApplyDefaultOptions}·from·'./internal/index.d.ts'; | 2 | import·type·{ApplyDefaultOptions}·from·'./internal/index.d.ts'; |
| 3 | import·type·{WordsOptions}·from·'./words.d.ts'; | 3 | import·type·{WordsOptions}·from·'./words.d.ts'; |
| 4 | /** | 4 | /** |
| 5 | Convert·object·properties·to· | 5 | Convert·object·properties·to·a·custom·string·delimiter·casing. |
| 6 | This·can·be·useful·when,·for·example,·converting·some·API·types·from·a·different·style. | 6 | This·can·be·useful·when,·for·example,·converting·some·API·types·from·a·different·style. |
| 7 | @see·{@link·DelimiterCase} | 7 | @see·{@link·DelimiterCase} |
| 8 | @see·{@link·DelimiterCasedPropertiesDeep} | 8 | @see·{@link·DelimiterCasedPropertiesDeep} |
| 9 | @example | 9 | @example |
| Offset 23, 14 lines modified | Offset 23, 18 lines modified | ||
| 23 | » 'user-id':·1, | 23 | » 'user-id':·1, |
| 24 | » 'user-name':·'Tom', | 24 | » 'user-name':·'Tom', |
| 25 | }; | 25 | }; |
| 26 | const·splitOnNumbers:·DelimiterCasedProperties<{line1:·string},·'-',·{splitOnNumbers:·true}>·=·{ | 26 | const·splitOnNumbers:·DelimiterCasedProperties<{line1:·string},·'-',·{splitOnNumbers:·true}>·=·{ |
| 27 | » 'line-1':·'string', | 27 | » 'line-1':·'string', |
| 28 | }; | 28 | }; |
| 29 | const·splitOnPunctuation:·DelimiterCasedProperties<{'foo::bar':·string},·'-',·{splitOnPunctuation:·true}>·=·{ | ||
| 30 | » 'foo-bar':·'string', | ||
| 31 | }; | ||
| 29 | ``` | 32 | ``` |
| 30 | @category·Change·case | 33 | @category·Change·case |
| 31 | @category·Template·literal | 34 | @category·Template·literal |
| 32 | @category·Object | 35 | @category·Object |
| 33 | */ | 36 | */ |
| 34 | export·type·DelimiterCasedProperties< | 37 | export·type·DelimiterCasedProperties< |
| Offset 28, 15 lines modified | Offset 28, 15 lines modified | ||
| 28 | Unfortunately,·`Record<string,·never>`,·`Record<keyof·any,·never>`·and·`Record<never,·never>`·do·not·work.·See·{@link·https://github.com/sindresorhus/type-fest/issues/395·#395}. | 28 | Unfortunately,·`Record<string,·never>`,·`Record<keyof·any,·never>`·and·`Record<never,·never>`·do·not·work.·See·{@link·https://github.com/sindresorhus/type-fest/issues/395·#395}. |
| 29 | @category·Object | 29 | @category·Object |
| 30 | */ | 30 | */ |
| 31 | export·type·EmptyObject·=·{[emptyObjectSymbol]?:·never}; | 31 | export·type·EmptyObject·=·{[emptyObjectSymbol]?:·never}; |
| 32 | /** | 32 | /** |
| 33 | Returns·a· | 33 | Returns·a·boolean·for·whether·the·type·is·strictly·equal·to·an·empty·plain·object,·the·`{}`·value. |
| 34 | @example | 34 | @example |
| 35 | ``` | 35 | ``` |
| 36 | import·type·{IsEmptyObject}·from·'type-fest'; | 36 | import·type·{IsEmptyObject}·from·'type-fest'; |
| 37 | type·Pass·=·IsEmptyObject<{}>;·//=>·true | 37 | type·Pass·=·IsEmptyObject<{}>;·//=>·true |
| 38 | type·Fail1·=·IsEmptyObject<[]>;·//=>·false | 38 | type·Fail1·=·IsEmptyObject<[]>;·//=>·false |
| Offset 2, 15 lines modified | Offset 2, 15 lines modified | ||
| 2 | type·ArrayEntries<BaseType·extends·readonly·unknown[]>·=·Array<_ArrayEntry<BaseType>>; | 2 | type·ArrayEntries<BaseType·extends·readonly·unknown[]>·=·Array<_ArrayEntry<BaseType>>; |
| 3 | type·MapEntries<BaseType>·=·Array<_MapEntry<BaseType>>; | 3 | type·MapEntries<BaseType>·=·Array<_MapEntry<BaseType>>; |
| 4 | type·ObjectEntries<BaseType>·=·Array<_ObjectEntry<BaseType>>; | 4 | type·ObjectEntries<BaseType>·=·Array<_ObjectEntry<BaseType>>; |
| 5 | type·SetEntries<BaseType·extends·Set<unknown>>·=·Array<_SetEntry<BaseType>>; | 5 | type·SetEntries<BaseType·extends·Set<unknown>>·=·Array<_SetEntry<BaseType>>; |
| 6 | /** | 6 | /** |
| 7 | 7 | Create·a·type·that·describes·the·key-value·pairs·produced·when·calling·a·collection’s·`entries`·method. | |
| 8 | For·example·the·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries|`Object`},·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/entries|`Map`},·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/entries|`Array`},·and·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/entries|`Set`}·collections·all·have·this·method.·Note·that·`WeakMap`·and·`WeakSet`·do·not·have·this·method·since·their·entries·are·not·enumerable. | 8 | For·example·the·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries|`Object`},·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/entries|`Map`},·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/entries|`Array`},·and·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/entries|`Set`}·collections·all·have·this·method.·Note·that·`WeakMap`·and·`WeakSet`·do·not·have·this·method·since·their·entries·are·not·enumerable. |
| 9 | @see·`Entry`·if·you·want·to·just·access·the·type·of·a·single·entry. | 9 | @see·`Entry`·if·you·want·to·just·access·the·type·of·a·single·entry. |
| 10 | @example | 10 | @example |
| 11 | ``` | 11 | ``` |
| Offset 1, 1 lines modified | Offset 1, 1 lines modified | ||
| 1 | u | 1 | utf-8 |
| Offset 3, 15 lines modified | Offset 3, 15 lines modified | ||
| 3 | export·type·_ArrayEntry<BaseType·extends·readonly·unknown[]>·=·[number,·BaseType[number]]; | 3 | export·type·_ArrayEntry<BaseType·extends·readonly·unknown[]>·=·[number,·BaseType[number]]; |
| 4 | export·type·_MapEntry<BaseType>·=·[MapKey<BaseType>,·MapValue<BaseType>]; | 4 | export·type·_MapEntry<BaseType>·=·[MapKey<BaseType>,·MapValue<BaseType>]; |
| 5 | export·type·_ObjectEntry<BaseType>·=·[keyof·BaseType,·BaseType[keyof·BaseType]]; | 5 | export·type·_ObjectEntry<BaseType>·=·[keyof·BaseType,·BaseType[keyof·BaseType]]; |
| 6 | export·type·_SetEntry<BaseType>·=·BaseType·extends·Set<infer·ItemType>·?·[ItemType,·ItemType]·:·never; | 6 | export·type·_SetEntry<BaseType>·=·BaseType·extends·Set<infer·ItemType>·?·[ItemType,·ItemType]·:·never; |
| 7 | /** | 7 | /** |
| 8 | 8 | Create·a·type·that·describes·a·single·key-value·pair·produced·when·calling·a·collection’s·`entries`·method. | |
| 9 | For·example·the·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries|`Object`},·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/entries|`Map`},·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/entries|`Array`},·and·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/entries|`Set`}·collections·all·have·this·method.·Note·that·`WeakMap`·and·`WeakSet`·do·not·have·this·method·since·their·entries·are·not·enumerable. | 9 | For·example·the·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries|`Object`},·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/entries|`Map`},·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/entries|`Array`},·and·{@link·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/entries|`Set`}·collections·all·have·this·method.·Note·that·`WeakMap`·and·`WeakSet`·do·not·have·this·method·since·their·entries·are·not·enumerable. |
| 10 | @see·`Entries`·if·you·want·to·just·access·the·type·of·the·array·of·entries·(which·is·the·return·of·the·`.entries()`·method). | 10 | @see·`Entries`·if·you·want·to·just·access·the·type·of·the·array·of·entries·(which·is·the·return·of·the·`.entries()`·method). |
| 11 | @example | 11 | @example |
| 12 | ``` | 12 | ``` |
| Offset 1, 1 lines modified | Offset 1, 1 lines modified | ||
| 1 | u | 1 | utf-8 |
| Offset 157, 15 lines modified | Offset 157, 15 lines modified | ||
| 157 | » » » » » ) | 157 | » » » » » ) |
| 158 | » » » » » :·Key·extends·keyof·WithStringKeys<BaseType> | 158 | » » » » » :·Key·extends·keyof·WithStringKeys<BaseType> |
| 159 | » » » » » » ?·StrictPropertyOf<WithStringKeys<BaseType>,·Key,·Options> | 159 | » » » » » » ?·StrictPropertyOf<WithStringKeys<BaseType>,·Key,·Options> |
| 160 | » » » » » » :·unknown; | 160 | » » » » » » :·unknown; |
| 161 | //·This·works·by·first·splitting·the·path·based·on·`.`·and·`[...]`·characters·into·a·tuple·of·string·keys.·Then·it·recursively·uses·the·head·key·to·get·the·next·property·of·the·current·object,·until·there·are·no·keys·left.·Number·keys·extract·the·item·type·from·arrays,·or·are·converted·to·strings·to·extract·types·from·tuples·and·dictionaries·with·number·keys. | 161 | //·This·works·by·first·splitting·the·path·based·on·`.`·and·`[...]`·characters·into·a·tuple·of·string·keys.·Then·it·recursively·uses·the·head·key·to·get·the·next·property·of·the·current·object,·until·there·are·no·keys·left.·Number·keys·extract·the·item·type·from·arrays,·or·are·converted·to·strings·to·extract·types·from·tuples·and·dictionaries·with·number·keys. |
| 162 | /** | 162 | /** |
| 163 | Get·a·deeply-nested·property·from·an·object·using·a·key·path,·like·Lodash's·`.get()`·function. | 163 | Get·a·deeply-nested·property·from·an·object·using·a·key·path,·like·[Lodash's·`.get()`](https://lodash.com/docs/latest#get)·function. |
| 164 | Use-case:·Retrieve·a·property·from·deep·inside·an·API·response·or·some·other·complex·object. | 164 | Use-case:·Retrieve·a·property·from·deep·inside·an·API·response·or·some·other·complex·object. |
| 165 | @example | 165 | @example |
| 166 | ``` | 166 | ``` |
| 167 | import·type·{Get}·from·'type-fest'; | 167 | import·type·{Get}·from·'type-fest'; |
| Offset 1, 12 lines modified | Offset 1, 13 lines modified | ||
| 1 | import·type·{ | 1 | import·type·{PositiveNumericStringGt}·from·'./internal/index.d.ts'; |
| 2 | import·type·{IsEqual}·from·'./is-equal.d.ts'; | 2 | import·type·{IsEqual}·from·'./is-equal.d.ts'; |
| 3 | import·type·{PositiveInfinity,·NegativeInfinity,·IsNegative}·from·'./numeric.d.ts'; | 3 | import·type·{PositiveInfinity,·NegativeInfinity,·IsNegative}·from·'./numeric.d.ts'; |
| 4 | import·type·{And}·from·'./and.d.ts'; | 4 | import·type·{And}·from·'./and.d.ts'; |
| 5 | import·type·{Or}·from·'./or.d.ts'; | 5 | import·type·{Or}·from·'./or.d.ts'; |
| 6 | import·type·{Absolute}·from·'./absolute.d.ts'; | ||
| 6 | /** | 7 | /** |
| 7 | Returns·a·boolean·for·whether·a·given·number·is·greater·than·another·number. | 8 | Returns·a·boolean·for·whether·a·given·number·is·greater·than·another·number. |
| 8 | @example | 9 | @example |
| 9 | ``` | 10 | ``` |
| 10 | import·type·{GreaterThan}·from·'type-fest'; | 11 | import·type·{GreaterThan}·from·'type-fest'; |
| Offset 78, 14 lines modified | Offset 79, 14 lines modified | ||
| 78 | » » » » » » » » :·[IsNegative<A>,·IsNegative<B>]·extends·infer·R·extends·[boolean,·boolean] | 79 | » » » » » » » » :·[IsNegative<A>,·IsNegative<B>]·extends·infer·R·extends·[boolean,·boolean] |
| 79 | » » » » » » » » » ?·[true,·false]·extends·R | 80 | » » » » » » » » » ?·[true,·false]·extends·R |
| 80 | » » » » » » » » » » ?·false | 81 | » » » » » » » » » » ?·false |
| 81 | » » » » » » » » » » :·[false,·true]·extends·R | 82 | » » » » » » » » » » :·[false,·true]·extends·R |
| 82 | » » » » » » » » » » » ?·true | 83 | » » » » » » » » » » » ?·true |
| 83 | » » » » » » » » » » » :·[false,·false]·extends·R | 84 | » » » » » » » » » » » :·[false,·false]·extends·R |
| 84 | » » » » » » » » » » » » ?·PositiveNumericStringGt<`${A}`,·`${B}`> | 85 | » » » » » » » » » » » » ?·PositiveNumericStringGt<`${A}`,·`${B}`> |
| 85 | » » » » » » » » » » » » :·PositiveNumericStringGt<`${ | 86 | » » » » » » » » » » » » :·PositiveNumericStringGt<`${Absolute<B>}`,·`${Absolute<A>}`> |
| 86 | » » » » » » » » » :·never | 87 | » » » » » » » » » :·never |
| 87 | » » » » » :·never | 88 | » » » » » :·never |
| 88 | » » » :·never·//·Should·never·happen | 89 | » » » :·never·//·Should·never·happen |
| 89 | » » :·never;·//·Should·never·happen | 90 | » » :·never;·//·Should·never·happen |
| 90 | export·{}; | 91 | export·{}; |
| Offset 1, 11 lines modified | Offset 1, 11 lines modified | ||
| 1 | import·type·{OptionalKeysOf}·from·'./optional-keys-of.d.ts'; | 1 | import·type·{OptionalKeysOf}·from·'./optional-keys-of.d.ts'; |
| 2 | /** | 2 | /** |
| 3 | 3 | Returns·a·boolean·for·whether·the·given·type·has·any·optional·fields. | |
| 4 | This·is·useful·when·you·want·to·create·an·API·whose·behavior·depends·on·the·presence·or·absence·of·optional·fields. | 4 | This·is·useful·when·you·want·to·create·an·API·whose·behavior·depends·on·the·presence·or·absence·of·optional·fields. |
| 5 | @example | 5 | @example |
| 6 | ``` | 6 | ``` |
| 7 | import·type·{HasOptionalKeys,·OptionalKeysOf}·from·'type-fest'; | 7 | import·type·{HasOptionalKeys,·OptionalKeysOf}·from·'type-fest'; |
| Offset 1, 11 lines modified | Offset 1, 11 lines modified | ||
| 1 | import·type·{ReadonlyKeysOf}·from·'./readonly-keys-of.d.ts'; | 1 | import·type·{ReadonlyKeysOf}·from·'./readonly-keys-of.d.ts'; |
| 2 | /** | 2 | /** |
| 3 | 3 | Returns·a·boolean·for·whether·the·given·type·has·any·readonly·fields. | |
| 4 | This·is·useful·when·you·want·to·create·an·API·whose·behavior·depends·on·the·presence·or·absence·of·readonly·fields. | 4 | This·is·useful·when·you·want·to·create·an·API·whose·behavior·depends·on·the·presence·or·absence·of·readonly·fields. |
| 5 | @example | 5 | @example |
| 6 | ``` | 6 | ``` |
| 7 | import·type·{HasReadonlyKeys,·ReadonlyKeysOf}·from·'type-fest'; | 7 | import·type·{HasReadonlyKeys,·ReadonlyKeysOf}·from·'type-fest'; |
| Offset 1, 11 lines modified | Offset 1, 11 lines modified | ||
| 1 | import·type·{RequiredKeysOf}·from·'./required-keys-of.d.ts'; | 1 | import·type·{RequiredKeysOf}·from·'./required-keys-of.d.ts'; |
| 2 | /** | 2 | /** |
| 3 | 3 | Returns·a·boolean·for·whether·the·given·type·has·any·required·fields. | |
| 4 | This·is·useful·when·you·want·to·create·an·API·whose·behavior·depends·on·the·presence·or·absence·of·required·fields. | 4 | This·is·useful·when·you·want·to·create·an·API·whose·behavior·depends·on·the·presence·or·absence·of·required·fields. |
| 5 | @example | 5 | @example |
| 6 | ``` | 6 | ``` |
| 7 | import·type·{HasRequiredKeys}·from·'type-fest'; | 7 | import·type·{HasRequiredKeys}·from·'type-fest'; |
| Offset 1, 11 lines modified | Offset 1, 11 lines modified | ||
| 1 | import·type·{WritableKeysOf}·from·'./writable-keys-of.d.ts'; | 1 | import·type·{WritableKeysOf}·from·'./writable-keys-of.d.ts'; |
| 2 | /** | 2 | /** |
| 3 | 3 | Returns·a·boolean·for·whether·the·given·type·has·any·writable·fields. | |
| 4 | This·is·useful·when·you·want·to·create·an·API·whose·behavior·depends·on·the·presence·or·absence·of·writable·fields. | 4 | This·is·useful·when·you·want·to·create·an·API·whose·behavior·depends·on·the·presence·or·absence·of·writable·fields. |
| 5 | @example | 5 | @example |
| 6 | ``` | 6 | ``` |
| 7 | import·type·{HasWritableKeys,·WritableKeysOf}·from·'type-fest'; | 7 | import·type·{HasWritableKeys,·WritableKeysOf}·from·'type-fest'; |
| Offset 1, 14 lines modified | Offset 1, 12 lines modified | ||
| 1 | import·type·{IntRange}·from·'./int-range.d.ts'; | 1 | import·type·{IntRange}·from·'./int-range.d.ts'; |
| 2 | import·type·{Sum}·from·'./sum.d.ts'; | 2 | import·type·{Sum}·from·'./sum.d.ts'; |
| 3 | /** | 3 | /** |
| 4 | Generate·a·union·of·numbers·between·a·specified·start·and·end·(both·inclusive),·with·an·optional·step. | ||
| 4 | Generate·a·union·of·numbers. | ||
| 5 | The·numbers·are·created·from·the·given·`Start`·(inclusive)·parameter·to·the·given·`End`·(inclusive)·parameter. | ||
| 6 | You·skip·over·numbers·using·the·`Step`·parameter·(defaults·to·`1`).·For·example,·`IntClosedRange<0,·10,·2>`·will·create·a·union·of·`0·|·2·|·4·|·6·|·8·|·10`. | 5 | You·skip·over·numbers·using·the·`Step`·parameter·(defaults·to·`1`).·For·example,·`IntClosedRange<0,·10,·2>`·will·create·a·union·of·`0·|·2·|·4·|·6·|·8·|·10`. |
| 7 | Note:·`Start`·or·`End`·must·be·non-negative·and·smaller·than·`999`. | 6 | Note:·`Start`·or·`End`·must·be·non-negative·and·smaller·than·`999`. |
| 8 | Use-cases: | 7 | Use-cases: |
| 9 | 1.·This·can·be·used·to·define·a·set·of·valid·input/output·values.·for·example: | 8 | 1.·This·can·be·used·to·define·a·set·of·valid·input/output·values.·for·example: |
| Offset 1, 14 lines modified | Offset 1, 12 lines modified | ||
| 1 | import·type·{TupleOf}·from·'./tuple-of.d.ts'; | 1 | import·type·{TupleOf}·from·'./tuple-of.d.ts'; |
| 2 | import·type·{Subtract}·from·'./subtract.d.ts'; | 2 | import·type·{Subtract}·from·'./subtract.d.ts'; |
| 3 | /** | 3 | /** |
| 4 | Generate·a·union·of·numbers·between·a·specified·start·(inclusive)·and·end·(exclusive),·with·an·optional·step. | ||
| 4 | Generate·a·union·of·numbers. | ||
| 5 | The·numbers·are·created·from·the·given·`Start`·(inclusive)·parameter·to·the·given·`End`·(exclusive)·parameter. | ||
| 6 | You·skip·over·numbers·using·the·`Step`·parameter·(defaults·to·`1`).·For·example,·`IntRange<0,·10,·2>`·will·create·a·union·of·`0·|·2·|·4·|·6·|·8`. | 5 | You·skip·over·numbers·using·the·`Step`·parameter·(defaults·to·`1`).·For·example,·`IntRange<0,·10,·2>`·will·create·a·union·of·`0·|·2·|·4·|·6·|·8`. |
| 7 | Note:·`Start`·or·`End`·must·be·non-negative·and·smaller·than·`1000`. | 6 | Note:·`Start`·or·`End`·must·be·non-negative·and·smaller·than·`1000`. |
| 8 | Use-cases: | 7 | Use-cases: |
| 9 | 1.·This·can·be·used·to·define·a·set·of·valid·input/output·values.·for·example: | 8 | 1.·This·can·be·used·to·define·a·set·of·valid·input/output·values.·for·example: |
| Offset 52, 17 lines modified | Offset 50, 17 lines modified | ||
| 52 | » End·extends·number, | 50 | » End·extends·number, |
| 53 | » Step·extends·number, | 51 | » Step·extends·number, |
| 54 | » //·The·gap·between·each·number,·gap·=·step·-·1 | 52 | » //·The·gap·between·each·number,·gap·=·step·-·1 |
| 55 | » Gap·extends·number·=·Subtract<Step,·1>, | 53 | » Gap·extends·number·=·Subtract<Step,·1>, |
| 56 | » //·The·final·`List`·is·`[...StartLengthTuple,·...[number,·...GapLengthTuple],·...[number,·...GapLengthTuple],·...·...]`,·so·can·initialize·the·`List`·with·`[...StartLengthTuple]` | 54 | » //·The·final·`List`·is·`[...StartLengthTuple,·...[number,·...GapLengthTuple],·...[number,·...GapLengthTuple],·...·...]`,·so·can·initialize·the·`List`·with·`[...StartLengthTuple]` |
| 57 | » List·extends·unknown[]·=·TupleOf<Start,·never>, | 55 | » List·extends·unknown[]·=·TupleOf<Start,·never>, |
| 58 | » EndLengthTuple·extends·unknown[]·=·TupleOf<End>, | 56 | » EndLengthTuple·extends·unknown[]·=·TupleOf<End>, |
| 59 | >·=·Gap·extends·0 | 57 | >·=·Gap·extends·0 |
| 60 | » //·Handle·the·case·that·without·`Step` | 58 | » //·Handle·the·case·that·without·`Step` |
| 61 | » List['length']·extends·End·//·The·result·of·"List[length]·===·End" | 59 | » ?·List['length']·extends·End·//·The·result·of·"List[length]·===·End" |
| 62 | » » ?·Exclude<List[number],·never>·//·All·unused·elements·are·`never`,·so·exclude·them | 60 | » » ?·Exclude<List[number],·never>·//·All·unused·elements·are·`never`,·so·exclude·them |
| 63 | » » :·PrivateIntRange<Start,·End,·Step,·Gap,·[...List,·List['length']·]> | 61 | » » :·PrivateIntRange<Start,·End,·Step,·Gap,·[...List,·List['length']·]> |
| 64 | » //·Handle·the·case·that·with·`Step` | 62 | » //·Handle·the·case·that·with·`Step` |
| 65 | » :·List·extends·[...(infer·U),·...EndLengthTuple]·//·The·result·of·"List[length]·>=·End",·because·the·`...TupleOf<Gap,·never>`·maybe·make·`List`·too·long. | 63 | » :·List·extends·[...(infer·U),·...EndLengthTuple]·//·The·result·of·"List[length]·>=·End",·because·the·`...TupleOf<Gap,·never>`·maybe·make·`List`·too·long. |
| 66 | » » ?·Exclude<List[number],·never> | 64 | » » ?·Exclude<List[number],·never> |
| 67 | » » :·PrivateIntRange<Start,·End,·Step,·Gap,·[...List,·List['length'],·...TupleOf<Gap,·never>]>; | 65 | » » :·PrivateIntRange<Start,·End,·Step,·Gap,·[...List,·List['length'],·...TupleOf<Gap,·never>]>; |
| Offset 25, 16 lines modified | Offset 25, 16 lines modified | ||
| 25 | type·A·=·[string,·number,·boolean,·...string[]]; | 25 | type·A·=·[string,·number,·boolean,·...string[]]; |
| 26 | type·B·=·StaticPartOfArray<A>; | 26 | type·B·=·StaticPartOfArray<A>; |
| 27 | //=>·[string,·number,·boolean] | 27 | //=>·[string,·number,·boolean] |
| 28 | ``` | 28 | ``` |
| 29 | */ | 29 | */ |
| 30 | export·type·StaticPartOfArray<T·extends·UnknownArray,·Result·extends·UnknownArray·=·[]>·= | 30 | export·type·StaticPartOfArray<T·extends·UnknownArray,·Result·extends·UnknownArray·=·[]>·= |
| 31 | » T·extends·unknown | 31 | » T·extends·unknown |
| 32 | » » ?·number·extends·T['length'] | 32 | » » ?·number·extends·T['length'] |
| 33 | » » » T·extends·readonly·[infer·U,·...infer·V] | 33 | » » » ?·T·extends·readonly·[infer·U,·...infer·V] |
| 34 | » » » » ?·StaticPartOfArray<V,·[...Result,·U]> | 34 | » » » » ?·StaticPartOfArray<V,·[...Result,·U]> |
| 35 | » » » » :·Result | 35 | » » » » :·Result |
| 36 | » » » :·T | 36 | » » » :·T |
| 37 | » » :·never;·//·Should·never·happen | 37 | » » :·never;·//·Should·never·happen |
| 38 | /** | 38 | /** |
| 39 | Returns·the·variable,·non-fixed-length·portion·of·the·given·array,·excluding·static-length·parts. | 39 | Returns·the·variable,·non-fixed-length·portion·of·the·given·array,·excluding·static-length·parts. |
| Offset 65, 19 lines modified | Offset 65, 19 lines modified | ||
| 65 | //=>·readonly·string[] | 65 | //=>·readonly·string[] |
| 66 | type·NormalResult·=·SetArrayAccess<ReadonlyStringArray,·false>; | 66 | type·NormalResult·=·SetArrayAccess<ReadonlyStringArray,·false>; |
| 67 | //=>·string[] | 67 | //=>·string[] |
| 68 | ``` | 68 | ``` |
| 69 | */ | 69 | */ |
| 70 | export·type·SetArrayAccess<T·extends·UnknownArray,·IsReadonly·extends·boolean>·= | 70 | export·type·SetArrayAccess<T·extends·UnknownArray,·IsReadonly·extends·boolean>·= |
| 71 | T·extends·readonly·[...infer·U] | 71 | » T·extends·readonly·[...infer·U] |
| 72 | » IsReadonly·extends·true | 72 | » » ?·IsReadonly·extends·true |
| 73 | » » ?·readonly·[...U] | 73 | » » » ?·readonly·[...U] |
| 74 | » » :·[...U] | 74 | » » » :·[...U] |
| 75 | » :·T; | 75 | » » :·T; |
| 76 | /** | 76 | /** |
| 77 | Returns·whether·the·given·array·`T`·is·readonly. | 77 | Returns·whether·the·given·array·`T`·is·readonly. |
| 78 | */ | 78 | */ |
| 79 | export·type·IsArrayReadonly<T·extends·UnknownArray>·=·If<IsNever<T>,·false,·T·extends·unknown[]·?·false·:·true>; | 79 | export·type·IsArrayReadonly<T·extends·UnknownArray>·=·If<IsNever<T>,·false,·T·extends·unknown[]·?·false·:·true>; |
| 80 | /** | 80 | /** |
| Offset 83, 18 lines modified | Offset 83, 18 lines modified | ||
| 83 | type·Key4·=·ExactKey<Object,·1>; | 83 | type·Key4·=·ExactKey<Object,·1>; |
| 84 | //=>·'1' | 84 | //=>·'1' |
| 85 | ``` | 85 | ``` |
| 86 | @category·Object | 86 | @category·Object |
| 87 | */ | 87 | */ |
| 88 | export·type·ExactKey<T·extends·object,·Key·extends·PropertyKey>·= | 88 | export·type·ExactKey<T·extends·object,·Key·extends·PropertyKey>·= |
| 89 | Key·extends·keyof·T | 89 | » Key·extends·keyof·T |
| 90 | » ?·Key | 90 | » » ?·Key |
| 91 | » :·ToString<Key>·extends·keyof·T | 91 | » » :·ToString<Key>·extends·keyof·T |
| 92 | » » ?·ToString<Key> | 92 | » » » ?·ToString<Key> |
| 93 | » » :·Key·extends·`${infer·NumberKey·extends·number}` | 93 | » » » :·Key·extends·`${infer·NumberKey·extends·number}` |
| 94 | » » » ?·NumberKey·extends·keyof·T | 94 | » » » » ?·NumberKey·extends·keyof·T |
| 95 | » » » » ?·NumberKey | 95 | » » » » » ?·NumberKey |
| 96 | » » » » :·never | 96 | » » » » » :·never |
| 97 | » » » :·never; | 97 | » » » » :·never; |
| 98 | export·{}; | 98 | export·{}; |
| Offset 1, 31 lines modified | Offset 1, 13 lines modified | ||
| 1 | import·type·{IsNever}·from·'../is-never.d.ts'; | 1 | import·type·{IsNever}·from·'../is-never.d.ts'; |
| 2 | import·type·{Finite,·NegativeInfinity,·PositiveInfinity}·from·'../numeric.d.ts'; | 2 | import·type·{Finite,·NegativeInfinity,·PositiveInfinity}·from·'../numeric.d.ts'; |
| 3 | import·type·{UnknownArray}·from·'../unknown-array.d.ts'; | 3 | import·type·{UnknownArray}·from·'../unknown-array.d.ts'; |
| 4 | import·type·{StringToNumber}·from·'./string.d.ts'; | ||
| 5 | import·type·{IfNotAnyOrNever,·IsAnyOrNever}·from·'./type.d.ts'; | 4 | import·type·{IfNotAnyOrNever,·IsAnyOrNever}·from·'./type.d.ts'; |
| 6 | /** | 5 | /** |
| 7 | Returns·the·absolute·value·of·a·given·value. | ||
| 8 | @example | ||
| 9 | ``` | ||
| 10 | type·A·=·NumberAbsolute<-1>; | ||
| 11 | //=>·1 | ||
| 12 | type·B·=·NumberAbsolute<1>; | ||
| 13 | //=>·1 | ||
| 14 | type·C·=·NumberAbsolute<NegativeInfinity>; | ||
| 15 | //=>·PositiveInfinity | ||
| 16 | ``` | ||
| 17 | */ | ||
| 18 | export·type·NumberAbsolute<N·extends·number>·=·`${N}`·extends·`-${infer·StringPositiveN}`·?·StringToNumber<StringPositiveN>·:·N; | ||
| 19 | /** | ||
| 20 | Check·whether·the·given·type·is·a·number·or·a·number·string. | 6 | Check·whether·the·given·type·is·a·number·or·a·number·string. |
| 21 | Supports·floating-point·as·a·string. | 7 | Supports·floating-point·as·a·string. |
| 22 | @example | 8 | @example |
| 23 | ``` | 9 | ``` |
| 24 | type·A·=·IsNumberLike<'1'>; | 10 | type·A·=·IsNumberLike<'1'>; |
| Offset 138, 14 lines modified | Offset 120, 22 lines modified | ||
| 138 | type·D·=·ReverseSign<PositiveInfinity>; | 120 | type·D·=·ReverseSign<PositiveInfinity>; |
| 139 | //=>·NegativeInfinity | 121 | //=>·NegativeInfinity |
| 140 | ``` | 122 | ``` |
| 141 | */ | 123 | */ |
| 142 | export·type·ReverseSign<N·extends·number>·= | 124 | export·type·ReverseSign<N·extends·number>·= |
| 143 | » //·Handle·edge·cases | 125 | » //·Handle·edge·cases |
| 144 | » N·extends·0 | 126 | » N·extends·0 |
| 127 | » » ?·0 | ||
| 128 | » » :·N·extends·PositiveInfinity | ||
| 129 | » » » ?·NegativeInfinity | ||
| 130 | » » » :·N·extends·NegativeInfinity | ||
| 131 | » » » » ?·PositiveInfinity | ||
| 145 | » //·Handle·negative·numbers | 132 | » » » » //·Handle·negative·numbers |
| 146 | » `${N}`·extends·`-${infer·P·extends·number}` | 133 | » » » » :·`${N}`·extends·`-${infer·P·extends·number}` |
| 134 | » » » » » ?·P | ||
| 147 | » » //·Handle·positive·numbers | 135 | » » » » » //·Handle·positive·numbers |
| 148 | » » :·`-${N}`·extends·`${infer·R·extends·number}` | 136 | » » » » » :·`-${N}`·extends·`${infer·R·extends·number}` |
| 137 | » » » » » » ?·R | ||
| 138 | » » » » » » :·never; | ||
| 149 | export·{}; | 139 | export·{}; |
| Offset 42, 16 lines modified | Offset 42, 16 lines modified | ||
| 42 | //=>·5 | 42 | //=>·5 |
| 43 | type·B·=·TupleMax<[1,·2,·5,·3,·99,·-1]>; | 43 | type·B·=·TupleMax<[1,·2,·5,·3,·99,·-1]>; |
| 44 | //=>·99 | 44 | //=>·99 |
| 45 | ``` | 45 | ``` |
| 46 | */ | 46 | */ |
| 47 | export·type·TupleMax<A·extends·number[],·Result·extends·number·=·NegativeInfinity>·=·number·extends·A[number] | 47 | export·type·TupleMax<A·extends·number[],·Result·extends·number·=·NegativeInfinity>·=·number·extends·A[number] |
| 48 | » ?·never | 48 | » ?·never |
| 49 | » A·extends·[infer·F·extends·number,·...infer·R·extends·number[]] | 49 | » :·A·extends·[infer·F·extends·number,·...infer·R·extends·number[]] |
| 50 | » » ?·GreaterThan<F,·Result>·extends·true | 50 | » » ?·GreaterThan<F,·Result>·extends·true |
| 51 | » » » ?·TupleMax<R,·F> | 51 | » » » ?·TupleMax<R,·F> |
| 52 | » » » :·TupleMax<R,·Result> | 52 | » » » :·TupleMax<R,·Result> |
| 53 | » » :·Result; | 53 | » » :·Result; |
| 54 | /** | 54 | /** |
| 55 | Returns·the·minimum·value·from·a·tuple·of·integers. | 55 | Returns·the·minimum·value·from·a·tuple·of·integers. |
| Offset 43, 18 lines modified | Offset 43, 18 lines modified | ||
| 43 | //=>·false | 43 | //=>·false |
| 44 | ``` | 44 | ``` |
| 45 | @category·Type·Guard | 45 | @category·Type·Guard |
| 46 | @category·Numeric | 46 | @category·Numeric |
| 47 | */ | 47 | */ |
| 48 | export·type·IsInteger<T>·= | 48 | export·type·IsInteger<T>·= |
| 49 | T·extends·bigint | 49 | » T·extends·bigint |
| 50 | » ?·true | 50 | » » ?·true |
| 51 | » :·T·extends·number | 51 | » » :·T·extends·number |
| 52 | » » ?·number·extends·T | 52 | » » » ?·number·extends·T |
| 53 | » » » ?·false | ||
| 54 | » » » :·T·extends·PositiveInfinity·|·NegativeInfinity | ||
| 55 | » » » » ?·false | 53 | » » » » ?·false |
| 54 | » » » » :·T·extends·PositiveInfinity·|·NegativeInfinity | ||
| 55 | » » » » » ?·false | ||
| 56 | » » » » :·Not<IsFloat<T>> | 56 | » » » » » :·Not<IsFloat<T>> |
| 57 | » » :·false; | 57 | » » » :·false; |
| 58 | export·{}; | 58 | export·{}; |
| Offset 117, 19 lines modified | Offset 117, 19 lines modified | ||
| 117 | export·type·IsStringLiteral<S>·=·IfNotAnyOrNever<S, | 117 | export·type·IsStringLiteral<S>·=·IfNotAnyOrNever<S, |
| 118 | » _IsStringLiteral<CollapseLiterals<S·extends·TagContainer<any>·?·UnwrapTagged<S>·:·S>>, | 118 | » _IsStringLiteral<CollapseLiterals<S·extends·TagContainer<any>·?·UnwrapTagged<S>·:·S>>, |
| 119 | » false,·false>; | 119 | » false,·false>; |
| 120 | export·type·_IsStringLiteral<S>·= | 120 | export·type·_IsStringLiteral<S>·= |
| 121 | //·If·`T`·is·an·infinite·string·type·(e.g.,·`on${string}`),·`Record<T,·never>`·produces·an·index·signature, | 121 | //·If·`T`·is·an·infinite·string·type·(e.g.,·`on${string}`),·`Record<T,·never>`·produces·an·index·signature, |
| 122 | //·and·since·`{}`·extends·index·signatures,·the·result·becomes·`false`. | 122 | //·and·since·`{}`·extends·index·signatures,·the·result·becomes·`false`. |
| 123 | S·extends·string | 123 | » S·extends·string |
| 124 | » ?·{}·extends·Record<S,·never> | 124 | » » ?·{}·extends·Record<S,·never> |
| 125 | » » ?·false | 125 | » » » ?·false |
| 126 | » » :·true | 126 | » » » :·true |
| 127 | » :·false; | 127 | » » :·false; |
| 128 | /** | 128 | /** |
| 129 | Returns·a·boolean·for·whether·the·given·type·is·a·`number`·or·`bigint`·[literal·type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types). | 129 | Returns·a·boolean·for·whether·the·given·type·is·a·`number`·or·`bigint`·[literal·type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types). |
| 130 | Useful·for: | 130 | Useful·for: |
| 131 | » -·providing·strongly-typed·functions·when·given·literal·arguments | 131 | » -·providing·strongly-typed·functions·when·given·literal·arguments |
| 132 | » -·type·utilities,·such·as·when·constructing·parsers·and·ASTs | 132 | » -·type·utilities,·such·as·when·constructing·parsers·and·ASTs |
| Offset 17, 24 lines modified | Offset 17, 24 lines modified | ||
| 17 | */ | 17 | */ |
| 18 | export·type·IsUnion<T>·=·InternalIsUnion<T>; | 18 | export·type·IsUnion<T>·=·InternalIsUnion<T>; |
| 19 | /** | 19 | /** |
| 20 | The·actual·implementation·of·`IsUnion`. | 20 | The·actual·implementation·of·`IsUnion`. |
| 21 | */ | 21 | */ |
| 22 | type·InternalIsUnion<T,·U·=·T>·= | 22 | type·InternalIsUnion<T,·U·=·T>·= |
| 23 | ( | 23 | » ( |
| 24 | » IsNever<T>·extends·true | 24 | » » IsNever<T>·extends·true |
| 25 | » » ?·false | 25 | » » » ?·false |
| 26 | » » :·T·extends·any | 26 | » » » :·T·extends·any |
| 27 | » » » ?·IsEqual<U,·T>·extends·true | 27 | » » » » ?·IsEqual<U,·T>·extends·true |
| 28 | » » » » ?·false | 28 | » » » » » ?·false |
| 29 | » » » » :·true | 29 | » » » » » :·true |
| 30 | » » » :·never | 30 | » » » » :·never |
| 31 | )·extends·infer·Result | 31 | » )·extends·infer·Result |
| 32 | » //·In·some·cases·`Result`·will·return·`false·|·true`·which·is·`boolean`, | 32 | » //·In·some·cases·`Result`·will·return·`false·|·true`·which·is·`boolean`, |
| 33 | » //·that·means·`T`·has·at·least·two·types·and·it's·a·union·type, | 33 | » //·that·means·`T`·has·at·least·two·types·and·it's·a·union·type, |
| 34 | » //·so·we·will·return·`true`·instead·of·`boolean`. | 34 | » //·so·we·will·return·`true`·instead·of·`boolean`. |
| 35 | » ?·boolean·extends·Result·?·true | 35 | » » ?·boolean·extends·Result·?·true |
| 36 | » » :·Result | 36 | » » » :·Result |
| 37 | » :·never;·//·Should·never·happen | 37 | » » :·never;·//·Should·never·happen |
| 38 | export·{}; | 38 | export·{}; |
| Offset 53, 14 lines modified | Offset 53, 14 lines modified | ||
| 53 | type·Fruit·=·IterableElement<typeof·fruits>; | 53 | type·Fruit·=·IterableElement<typeof·fruits>; |
| 54 | //=>·'🍎'·|·'🍌'·|·'🍉' | 54 | //=>·'🍎'·|·'🍌'·|·'🍉' |
| 55 | ``` | 55 | ``` |
| 56 | @category·Iterable | 56 | @category·Iterable |
| 57 | */ | 57 | */ |
| 58 | export·type·IterableElement<TargetIterable>·= | 58 | export·type·IterableElement<TargetIterable>·= |
| 59 | » TargetIterable·extends·Iterable<infer·ElementType> | 59 | » TargetIterable·extends·Iterable<infer·ElementType> |
| 60 | » » ElementType | 60 | » » ?·ElementType |
| 61 | » » TargetIterable·extends·AsyncIterable<infer·ElementType> | 61 | » » :·TargetIterable·extends·AsyncIterable<infer·ElementType> |
| 62 | » » » ElementType | 62 | » » » ?·ElementType |
| 63 | » » » never; | 63 | » » » :·never; |
| 64 | export·{}; | 64 | export·{}; |
| Offset 94, 21 lines modified | Offset 94, 21 lines modified | ||
| 94 | */ | 94 | */ |
| 95 | export·type·Jsonify<T>·=·IsAny<T>·extends·true | 95 | export·type·Jsonify<T>·=·IsAny<T>·extends·true |
| 96 | » ?·any | 96 | » ?·any |
| 97 | » :·T·extends·PositiveInfinity·|·NegativeInfinity | 97 | » :·T·extends·PositiveInfinity·|·NegativeInfinity |
| 98 | » » ?·null | 98 | » » ?·null |
| 99 | » » :·T·extends·JsonPrimitive | 99 | » » :·T·extends·JsonPrimitive |
| 100 | » » » ?·T | 100 | » » » ?·T |
| 101 | » » » | 101 | » » » //·Any·object·with·toJSON·is·special·case |
| 102 | » » » T·extends·{toJSON():·infer·J} | 102 | » » » :·T·extends·{toJSON():·infer·J} |
| 103 | » » » » ?·(()·=>·J)·extends·()·=>·JsonValue·//·Is·J·assignable·to·JsonValue? | 103 | » » » » ?·(()·=>·J)·extends·()·=>·JsonValue·//·Is·J·assignable·to·JsonValue? |
| 104 | » » » » » ?·J·//·Then·T·is·Jsonable·and·its·Jsonable·value·is·J | 104 | » » » » » ?·J·//·Then·T·is·Jsonable·and·its·Jsonable·value·is·J |
| 105 | » » » » » :·Jsonify<J>·//·Maybe·if·we·look·a·level·deeper·we'll·find·a·JsonValue | 105 | » » » » » :·Jsonify<J>·//·Maybe·if·we·look·a·level·deeper·we'll·find·a·JsonValue |
| 106 | » » » » | 106 | » » » » //·Instanced·primitives·are·objects |
| 107 | » » » » T·extends·Number | 107 | » » » » :·T·extends·Number |
| 108 | » » » » » ?·number | 108 | » » » » » ?·number |
| 109 | » » » » » :·T·extends·String | 109 | » » » » » :·T·extends·String |
| 110 | » » » » » » ?·string | 110 | » » » » » » ?·string |
| 111 | » » » » » » :·T·extends·Boolean | 111 | » » » » » » :·T·extends·Boolean |
| 112 | » » » » » » » ?·boolean | 112 | » » » » » » » ?·boolean |
| 113 | » » » » » » » :·T·extends·Map<any,·any>·|·Set<any> | 113 | » » » » » » » :·T·extends·Map<any,·any>·|·Set<any> |
| 114 | » » » » » » » » ?·EmptyObject | 114 | » » » » » » » » ?·EmptyObject |
| Offset 11, 14 lines modified | Offset 11, 15 lines modified | ||
| 11 | ``` | 11 | ``` |
| 12 | import·type·{KebabCase}·from·'type-fest'; | 12 | import·type·{KebabCase}·from·'type-fest'; |
| 13 | //·Simple | 13 | //·Simple |
| 14 | const·someVariable:·KebabCase<'fooBar'>·=·'foo-bar'; | 14 | const·someVariable:·KebabCase<'fooBar'>·=·'foo-bar'; |
| 15 | const·someVariableNoSplitOnNumbers:·KebabCase<'p2pNetwork',·{splitOnNumbers:·false}>·=·'p2p-network'; | 15 | const·someVariableNoSplitOnNumbers:·KebabCase<'p2pNetwork',·{splitOnNumbers:·false}>·=·'p2p-network'; |
| 16 | const·someVariableWithPunctuation:·KebabCase<'div.card::after',·{splitOnPunctuation:·true}>·=·'div-card-after'; | ||
| 16 | //·Advanced | 17 | //·Advanced |
| 17 | type·KebabCasedProperties<T>·=·{ | 18 | type·KebabCasedProperties<T>·=·{ |
| 18 | » [K·in·keyof·T·as·KebabCase<K>]:·T[K] | 19 | » [K·in·keyof·T·as·KebabCase<K>]:·T[K] |
| 19 | }; | 20 | }; |
| Offset 47, 14 lines modified | Offset 47, 21 lines modified | ||
| 47 | » » 'line-2':·[ | 47 | » » 'line-2':·[ |
| 48 | » » » { | 48 | » » » { |
| 49 | » » » » 'line-3':·'string', | 49 | » » » » 'line-3':·'string', |
| 50 | » » » }, | 50 | » » » }, |
| 51 | » » ], | 51 | » » ], |
| 52 | » }, | 52 | » }, |
| 53 | }; | 53 | }; |
| 54 | const·splitOnPunctuation:·KebabCasedPropertiesDeep<{'user@info':·{'user::id':·number;·'user::name':·string}},·{splitOnPunctuation:·true}>·=·{ | ||
| 55 | » 'user-info':·{ | ||
| 56 | » » 'user-id':·1, | ||
| 57 | » » 'user-name':·'Tom', | ||
| 58 | » }, | ||
| 59 | }; | ||
| 54 | ``` | 60 | ``` |
| 55 | @category·Change·case | 61 | @category·Change·case |
| 56 | @category·Template·literal | 62 | @category·Template·literal |
| 57 | @category·Object | 63 | @category·Object |
| 58 | */ | 64 | */ |
| 59 | export·type·KebabCasedPropertiesDeep< | 65 | export·type·KebabCasedPropertiesDeep< |
| Offset 1, 14 lines modified | Offset 1, 14 lines modified | ||
| 1 | import·type·{_DefaultDelimiterCaseOptions}·from·'./delimiter-case.d.ts'; | 1 | import·type·{_DefaultDelimiterCaseOptions}·from·'./delimiter-case.d.ts'; |
| 2 | import·type·{DelimiterCasedProperties}·from·'./delimiter-cased-properties.d.ts'; | 2 | import·type·{DelimiterCasedProperties}·from·'./delimiter-cased-properties.d.ts'; |
| 3 | import·type·{ApplyDefaultOptions}·from·'./internal/index.d.ts'; | 3 | import·type·{ApplyDefaultOptions}·from·'./internal/index.d.ts'; |
| 4 | import·type·{WordsOptions}·from·'./words.d.ts'; | 4 | import·type·{WordsOptions}·from·'./words.d.ts'; |
| 5 | /** | 5 | /** |
| 6 | Convert·object·properties·to·kebab·ca | 6 | Convert·top-level·object·properties·to·kebab·case. |
| 7 | This·can·be·useful·when,·for·example,·converting·some·API·types·from·a·different·style. | 7 | This·can·be·useful·when,·for·example,·converting·some·API·types·from·a·different·style. |
| 8 | @see·{@link·KebabCase} | 8 | @see·{@link·KebabCase} |
| 9 | @see·{@link·KebabCasedPropertiesDeep} | 9 | @see·{@link·KebabCasedPropertiesDeep} |
| 10 | @example | 10 | @example |
| Offset 24, 14 lines modified | Offset 24, 18 lines modified | ||
| 24 | » 'user-id':·1, | 24 | » 'user-id':·1, |
| 25 | » 'user-name':·'Tom', | 25 | » 'user-name':·'Tom', |
| 26 | }; | 26 | }; |
| 27 | const·splitOnNumbers:·KebabCasedProperties<{line1:·string},·{splitOnNumbers:·true}>·=·{ | 27 | const·splitOnNumbers:·KebabCasedProperties<{line1:·string},·{splitOnNumbers:·true}>·=·{ |
| 28 | » 'line-1':·'string', | 28 | » 'line-1':·'string', |
| 29 | }; | 29 | }; |
| 30 | const·splitOnPunctuation:·KebabCasedProperties<{'foo::bar':·string},·{splitOnPunctuation:·true}>·=·{ | ||
| 31 | » 'foo-bar':·'string', | ||
| 32 | }; | ||
| 30 | ``` | 33 | ``` |
| 31 | @category·Change·case | 34 | @category·Change·case |
| 32 | @category·Template·literal | 35 | @category·Template·literal |
| 33 | @category·Object | 36 | @category·Object |
| 34 | */ | 37 | */ |
| 35 | export·type·KebabCasedProperties< | 38 | export·type·KebabCasedProperties< |
| Offset 34, 11 lines modified | Offset 34, 11 lines modified | ||
| 34 | type·AllKeys·=·KeysOfUnion<Union>; | 34 | type·AllKeys·=·KeysOfUnion<Union>; |
| 35 | //=>·'common'·|·'a'·|·'b'·|·'c' | 35 | //=>·'common'·|·'a'·|·'b'·|·'c' |
| 36 | ``` | 36 | ``` |
| 37 | @category·Object | 37 | @category·Object |
| 38 | */ | 38 | */ |
| 39 | export·type·KeysOfUnion<ObjectType>·= | 39 | export·type·KeysOfUnion<ObjectType>·= |
| 40 | 40 | » //·Hack·to·fix·https://github.com/sindresorhus/type-fest/issues/1008 | |
| 41 | 41 | » keyof·UnionToIntersection<ObjectType·extends·unknown·?·Record<keyof·ObjectType,·never>·:·never>; | |
| 42 | export·{}; | 42 | export·{}; |
| Offset 1, 11 lines modified | Offset 1, 11 lines modified | ||
| 1 | import·type·{GreaterThan}·from·'./greater-than.d.ts'; | 1 | import·type·{GreaterThan}·from·'./greater-than.d.ts'; |
| 2 | /** | 2 | /** |
| 3 | 3 | Returns·a·boolean·for·whether·a·given·number·is·less·than·or·equal·to·another·number. | |
| 4 | @example | 4 | @example |
| 5 | ``` | 5 | ``` |
| 6 | import·type·{LessThanOrEqual}·from·'type-fest'; | 6 | import·type·{LessThanOrEqual}·from·'type-fest'; |
| 7 | type·A·=·LessThanOrEqual<1,·-5>; | 7 | type·A·=·LessThanOrEqual<1,·-5>; |
| 8 | //=>·false | 8 | //=>·false |
| Offset 1, 9 lines modified | Offset 1, 9 lines modified | ||
| 1 | /** | 1 | /** |
| 2 | Given·a·[literal·type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types)·return·the· | 2 | Given·a·[literal·type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types)·return·the·[primitive·type](https://developer.mozilla.org/en-US/docs/Glossary/Primitive)·it·belongs·to,·or·`never`·if·it's·not·a·primitive. |
| 3 | Use-case:·Working·with·generic·types·that·may·be·literal·types. | 3 | Use-case:·Working·with·generic·types·that·may·be·literal·types. |
| 4 | @example | 4 | @example |
| 5 | ``` | 5 | ``` |
| 6 | import·type·{LiteralToPrimitive}·from·'type-fest'; | 6 | import·type·{LiteralToPrimitive}·from·'type-fest'; |
| Offset 1, 13 lines modified | Offset 1, 13 lines modified | ||
| 1 | import·type·{Primitive}·from·'./primitive.d.ts'; | 1 | import·type·{Primitive}·from·'./primitive.d.ts'; |
| 2 | export·type·_LiteralStringUnion<T>·=·LiteralUnion<T,·string>; | 2 | export·type·_LiteralStringUnion<T>·=·LiteralUnion<T,·string>; |
| 3 | /** | 3 | /** |
| 4 | 4 | Create·a·union·type·by·combining·primitive·types·and·literal·types·without·sacrificing·auto-completion·in·IDEs·for·the·literal·type·part·of·the·union. | |
| 5 | Currently,·when·a·union·type·of·a·primitive·type·is·combined·with·literal·types,·TypeScript·loses·all·information·about·the·combined·literals.·Thus,·when·such·type·is·used·in·an·IDE·with·autocompletion,·no·suggestions·are·made·for·the·declared·literals. | 5 | Currently,·when·a·union·type·of·a·primitive·type·is·combined·with·literal·types,·TypeScript·loses·all·information·about·the·combined·literals.·Thus,·when·such·type·is·used·in·an·IDE·with·autocompletion,·no·suggestions·are·made·for·the·declared·literals. |
| 6 | This·type·is·a·workaround·for·[Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729).·It·will·be·removed·as·soon·as·it's·not·needed·anymore. | 6 | This·type·is·a·workaround·for·[Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729).·It·will·be·removed·as·soon·as·it's·not·needed·anymore. |
| 7 | @example | 7 | @example |
| 8 | ``` | 8 | ``` |
| Offset 34, 12 lines modified | Offset 34, 12 lines modified | ||
| 34 | exclusiveOptions·=·{exclusive1:·true,·exclusive2:·'hi'}; | 34 | exclusiveOptions·=·{exclusive1:·true,·exclusive2:·'hi'}; |
| 35 | //·Error | 35 | //·Error |
| 36 | ``` | 36 | ``` |
| 37 | @category·Object | 37 | @category·Object |
| 38 | */ | 38 | */ |
| 39 | export·type·MergeExclusive<FirstType,·SecondType>·= | 39 | export·type·MergeExclusive<FirstType,·SecondType>·= |
| 40 | » (FirstType·|·SecondType)·extends·object | 40 | » (FirstType·|·SecondType)·extends·object |
| 41 | » » (Without<FirstType,·SecondType>·&·SecondType)·|·(Without<SecondType,·FirstType>·&·FirstType) | 41 | » » ?·(Without<FirstType,·SecondType>·&·SecondType)·|·(Without<SecondType,·FirstType>·&·FirstType) |
| 42 | » » FirstType·|·SecondType; | 42 | » » :·FirstType·|·SecondType; |
| 43 | export·{}; | 43 | export·{}; |
| Offset 1, 14 lines modified | Offset 1, 14 lines modified | ||
| 1 | import·type·{Subtract}·from·'./subtract.d.ts'; | 1 | import·type·{Subtract}·from·'./subtract.d.ts'; |
| 2 | import·type·{IsEqual}·from·'./is-equal.d.ts'; | 2 | import·type·{IsEqual}·from·'./is-equal.d.ts'; |
| 3 | type·Recursive<T>·=·Array<Recursive<T>>; | 3 | type·Recursive<T>·=·Array<Recursive<T>>; |
| 4 | /** | 4 | /** |
| 5 | Create | 5 | Create·a·type·that·represents·a·multidimensional·array·of·the·given·type·and·dimension. |
| 6 | Use-cases: | 6 | Use-cases: |
| 7 | -·Return·a·n-dimensional·array·from·functions. | 7 | -·Return·a·n-dimensional·array·from·functions. |
| 8 | -·Declare·a·n-dimensional·array·by·defining·its·dimensions·rather·than·declaring·`[]`·repetitively. | 8 | -·Declare·a·n-dimensional·array·by·defining·its·dimensions·rather·than·declaring·`[]`·repetitively. |
| 9 | -·Infer·the·dimensions·of·a·n-dimensional·array·automatically·from·function·arguments. | 9 | -·Infer·the·dimensions·of·a·n-dimensional·array·automatically·from·function·arguments. |
| 10 | -·Avoid·the·need·to·know·in·advance·the·dimensions·of·a·n-dimensional·array·allowing·them·to·be·dynamic. | 10 | -·Avoid·the·need·to·know·in·advance·the·dimensions·of·a·n-dimensional·array·allowing·them·to·be·dynamic. |
| Offset 1, 14 lines modified | Offset 1, 14 lines modified | ||
| 1 | import·type·{Subtract}·from·'./subtract.d.ts'; | 1 | import·type·{Subtract}·from·'./subtract.d.ts'; |
| 2 | import·type·{IsEqual}·from·'./is-equal.d.ts'; | 2 | import·type·{IsEqual}·from·'./is-equal.d.ts'; |
| 3 | type·Recursive<T>·=·ReadonlyArray<Recursive<T>>; | 3 | type·Recursive<T>·=·ReadonlyArray<Recursive<T>>; |
| 4 | /** | 4 | /** |
| 5 | Create | 5 | Create·a·type·that·represents·a·multidimensional·readonly·array·of·the·given·type·and·dimension. |
| 6 | Use-cases: | 6 | Use-cases: |
| 7 | -·Return·a·n-dimensional·array·from·functions. | 7 | -·Return·a·n-dimensional·array·from·functions. |
| 8 | -·Declare·a·n-dimensional·array·by·defining·its·dimensions·rather·than·declaring·`[]`·repetitively. | 8 | -·Declare·a·n-dimensional·array·by·defining·its·dimensions·rather·than·declaring·`[]`·repetitively. |
| 9 | -·Infer·the·dimensions·of·a·n-dimensional·array·automatically·from·function·arguments. | 9 | -·Infer·the·dimensions·of·a·n-dimensional·array·automatically·from·function·arguments. |
| 10 | -·Avoid·the·need·to·know·in·advance·the·dimensions·of·a·n-dimensional·array·allowing·them·to·be·dynamic. | 10 | -·Avoid·the·need·to·know·in·advance·the·dimensions·of·a·n-dimensional·array·allowing·them·to·be·dynamic. |
| Offset 117, 17 lines modified | Offset 117, 17 lines modified | ||
| 117 | ``` | 117 | ``` |
| 118 | @see·{@link·Integer} | 118 | @see·{@link·Integer} |
| 119 | @category·Numeric | 119 | @category·Numeric |
| 120 | */ | 120 | */ |
| 121 | export·type·Float<T>·= | 121 | export·type·Float<T>·= |
| 122 | T·extends·unknown·//·To·distributive·type | 122 | » T·extends·unknown·//·To·distributive·type |
| 123 | » ?·IsFloat<T>·extends·true·?·T·:·never | 123 | » » ?·IsFloat<T>·extends·true·?·T·:·never |
| 124 | » :·never;·//·Never·happens | 124 | » » :·never;·//·Never·happens |
| 125 | /** | 125 | /** |
| 126 | A·negative·(`-∞·<·x·<·0`)·`number`·that·is·not·an·integer. | 126 | A·negative·(`-∞·<·x·<·0`)·`number`·that·is·not·an·integer. |
| 127 | Equivalent·to·`Negative<Float<T>>`. | 127 | Equivalent·to·`Negative<Float<T>>`. |
| 128 | Use-case:·Validating·and·documenting·parameters. | 128 | Use-case:·Validating·and·documenting·parameters. |
| Offset 13, 15 lines modified | Offset 13, 15 lines modified | ||
| 13 | It·supports·recursing·into·arrays. | 13 | It·supports·recursing·into·arrays. |
| 14 | It·supports·removing·specific·items·from·an·array,·replacing·each·removed·item·with·unknown·at·the·specified·index. | 14 | It·supports·removing·specific·items·from·an·array,·replacing·each·removed·item·with·unknown·at·the·specified·index. |
| 15 | Use-case:·Remove·unneeded·parts·of·complex·objects. | 15 | Use-case:·Remove·unneeded·parts·of·complex·objects. |
| 16 | Use·[`Omit`](https://www.typescriptlang.org/docs/handbook/utility-types.html#omittype-keys)·if·you·only·need·one·level·deep. | 16 | Use·[`Omit<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#omittype-keys)·if·you·only·need·one·level·deep. |
| 17 | @example | 17 | @example |
| 18 | ``` | 18 | ``` |
| 19 | import·type·{OmitDeep}·from·'type-fest'; | 19 | import·type·{OmitDeep}·from·'type-fest'; |
| 20 | type·Info·=·{ | 20 | type·Info·=·{ |
| 21 | » userInfo:·{ | 21 | » userInfo:·{ |
| Offset 89, 42 lines modified | Offset 89, 42 lines modified | ||
| 89 | » » ?·OmitDeepHelper<OmitDeepWithOnePath<T,·Path·&·(string·|·number)>,·RestPaths> | 89 | » » ?·OmitDeepHelper<OmitDeepWithOnePath<T,·Path·&·(string·|·number)>,·RestPaths> |
| 90 | » » :·T; | 90 | » » :·T; |
| 91 | /** | 91 | /** |
| 92 | Omit·one·path·from·the·given·object/array. | 92 | Omit·one·path·from·the·given·object/array. |
| 93 | */ | 93 | */ |
| 94 | type·OmitDeepWithOnePath<T,·Path·extends·string·|·number>·= | 94 | type·OmitDeepWithOnePath<T,·Path·extends·string·|·number>·= |
| 95 | T·extends·NonRecursiveType | 95 | » T·extends·NonRecursiveType |
| 96 | » ?·T | 96 | » » ?·T |
| 97 | » :·T·extends·UnknownArray·?·SetArrayAccess<OmitDeepArrayWithOnePath<T,·Path>,·IsArrayReadonly<T>> | 97 | » » :·T·extends·UnknownArray·?·SetArrayAccess<OmitDeepArrayWithOnePath<T,·Path>,·IsArrayReadonly<T>> |
| 98 | » » :·T·extends·object·?·OmitDeepObjectWithOnePath<T,·Path> | 98 | » » » :·T·extends·object·?·OmitDeepObjectWithOnePath<T,·Path> |
| 99 | » » » :·T; | 99 | » » » » :·T; |
| 100 | /** | 100 | /** |
| 101 | Omit·one·path·from·the·given·object. | 101 | Omit·one·path·from·the·given·object. |
| 102 | */ | 102 | */ |
| 103 | type·OmitDeepObjectWithOnePath<ObjectT·extends·object,·P·extends·string·|·number>·= | 103 | type·OmitDeepObjectWithOnePath<ObjectT·extends·object,·P·extends·string·|·number>·= |
| 104 | P·extends·`${infer·RecordKeyInPath}.${infer·SubPath}` | 104 | » P·extends·`${infer·RecordKeyInPath}.${infer·SubPath}` |
| 105 | » ?·{ | 105 | » » ?·{ |
| 106 | » » [Key·in·keyof·ObjectT]: | 106 | » » » [Key·in·keyof·ObjectT]: |
| 107 | » » IsEqual<RecordKeyInPath,·ToString<Key>>·extends·true | 107 | » » » IsEqual<RecordKeyInPath,·ToString<Key>>·extends·true |
| 108 | » » » ?·ExactKey<ObjectT,·Key>·extends·infer·RealKey | 108 | » » » » ?·ExactKey<ObjectT,·Key>·extends·infer·RealKey |
| 109 | » » » » ?·RealKey·extends·keyof·ObjectT | 109 | » » » » » ?·RealKey·extends·keyof·ObjectT |
| 110 | » » » » » ?·OmitDeepWithOnePath<ObjectT[RealKey],·SubPath> | 110 | » » » » » » ?·OmitDeepWithOnePath<ObjectT[RealKey],·SubPath> |
| 111 | » » » » » » :·ObjectT[Key] | ||
| 111 | » » » » » :·ObjectT[Key] | 112 | » » » » » :·ObjectT[Key] |
| 112 | » » » » :·ObjectT[Key] | 113 | » » » » :·ObjectT[Key] |
| 113 | » » » :·ObjectT[Key] | ||
| 114 | » } | 114 | » » } |
| 115 | » :·ExactKey<ObjectT,·P>·extends·infer·Key | 115 | » » :·ExactKey<ObjectT,·P>·extends·infer·Key |
| 116 | » » ?·IsNever<Key>·extends·true | 116 | » » » ?·IsNever<Key>·extends·true |
| 117 | » » » ?·ObjectT | 117 | » » » » ?·ObjectT |
| 118 | » » » :·Key·extends·PropertyKey | 118 | » » » » :·Key·extends·PropertyKey |
| 119 | » » » » ?·Omit<ObjectT,·Key> | 119 | » » » » » ?·Omit<ObjectT,·Key> |
| 120 | » » » » :·ObjectT | 120 | » » » » » :·ObjectT |
| 121 | » » :·ObjectT; | 121 | » » » :·ObjectT; |
| 122 | /** | 122 | /** |
| 123 | Omit·one·path·from·from·the·given·array. | 123 | Omit·one·path·from·from·the·given·array. |
| 124 | It·replaces·the·item·to·`unknown`·at·the·given·index. | 124 | It·replaces·the·item·to·`unknown`·at·the·given·index. |
| 125 | @example | 125 | @example |
| Offset 1, 11 lines modified | Offset 1, 11 lines modified | ||
| 1 | import·type·{OrAll}·from·'./or-all.d.ts'; | 1 | import·type·{OrAll}·from·'./or-all.d.ts'; |
| 2 | /** | 2 | /** |
| 3 | Returns·a·boolean·for·whether·either·of·two·given·types·is·true. | 3 | Returns·a·boolean·for·whether·either·of·two·given·types·is·`true`. |
| 4 | Use-case:·Constructing·complex·conditional·types·where·at·least·one·condition·must·be·satisfied. | 4 | Use-case:·Constructing·complex·conditional·types·where·at·least·one·condition·must·be·satisfied. |
| 5 | @example | 5 | @example |
| 6 | ``` | 6 | ``` |
| 7 | import·type·{Or}·from·'type-fest'; | 7 | import·type·{Or}·from·'type-fest'; |
| Offset 695, 16 lines modified | Offset 695, 16 lines modified | ||
| 695 | /** | 695 | /** |
| 696 | Type·for·[npm's·`package.json`·file](https://docs.npmjs.com/creating-a-package-json-file).·Also·includes·types·for·fields·used·by·other·popular·projects,·like·TypeScript·and·Yarn. | 696 | Type·for·[npm's·`package.json`·file](https://docs.npmjs.com/creating-a-package-json-file).·Also·includes·types·for·fields·used·by·other·popular·projects,·like·TypeScript·and·Yarn. |
| 697 | @category·File | 697 | @category·File |
| 698 | */ | 698 | */ |
| 699 | export·type·PackageJson·= | 699 | export·type·PackageJson·= |
| 700 | » JsonObject | 700 | » JsonObject |
| 701 | » PackageJson.NodeJsStandard | 701 | » &·PackageJson.NodeJsStandard |
| 702 | » PackageJson.PackageJsonStandard | 702 | » &·PackageJson.PackageJsonStandard |
| 703 | » PackageJson.NonStandardEntryPoints | 703 | » &·PackageJson.NonStandardEntryPoints |
| 704 | » PackageJson.TypeScriptConfiguration | 704 | » &·PackageJson.TypeScriptConfiguration |
| 705 | » PackageJson.YarnConfiguration | 705 | » &·PackageJson.YarnConfiguration |
| 706 | » PackageJson.JSPMConfiguration; | 706 | » &·PackageJson.JSPMConfiguration; |
| 707 | export·{}; | 707 | export·{}; |
| Offset 40, 20 lines modified | Offset 40, 22 lines modified | ||
| 40 | type·DefaultPartialDeepOptions·=·{ | 40 | type·DefaultPartialDeepOptions·=·{ |
| 41 | » recurseIntoArrays:·false; | 41 | » recurseIntoArrays:·false; |
| 42 | » allowUndefinedInNonTupleArrays:·false; | 42 | » allowUndefinedInNonTupleArrays:·false; |
| 43 | }; | 43 | }; |
| 44 | /** | 44 | /** |
| 45 | Create·a· | 45 | Create·a·deeply·optional·version·of·another·type. |
| 46 | Use-cases: | 46 | Use-cases: |
| 47 | -·Merging·a·default·settings/config·object·with·another·object,·the·second·object·would·be·a·deep·partial·of·the·default·object. | 47 | -·Merging·a·default·settings/config·object·with·another·object,·the·second·object·would·be·a·deep·partial·of·the·default·object. |
| 48 | -·Mocking·and·testing·complex·entities,·where·populating·an·entire·object·with·its·keys·would·be·redundant·in·terms·of·the·mock·or·test. | 48 | -·Mocking·and·testing·complex·entities,·where·populating·an·entire·object·with·its·keys·would·be·redundant·in·terms·of·the·mock·or·test. |
| 49 | Use·[`Partial<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#partialtype)·if·you·only·need·one·level·deep. | ||
| 49 | @example | 50 | @example |
| 50 | ``` | 51 | ``` |
| 51 | import·type·{PartialDeep}·from·'type-fest'; | 52 | import·type·{PartialDeep}·from·'type-fest'; |
| 52 | let·settings·=·{ | 53 | let·settings·=·{ |
| 53 | » textEditor:·{ | 54 | » textEditor:·{ |
| 54 | » » fontSize:·14, | 55 | » » fontSize:·14, |
| Offset 8, 14 lines modified | Offset 8, 15 lines modified | ||
| 8 | ``` | 8 | ``` |
| 9 | import·type·{PascalCase}·from·'type-fest'; | 9 | import·type·{PascalCase}·from·'type-fest'; |
| 10 | //·Simple | 10 | //·Simple |
| 11 | const·someVariable:·PascalCase<'foo-bar'>·=·'FooBar'; | 11 | const·someVariable:·PascalCase<'foo-bar'>·=·'FooBar'; |
| 12 | const·preserveConsecutiveUppercase:·PascalCase<'foo-BAR-baz',·{preserveConsecutiveUppercase:·true}>·=·'FooBARBaz'; | 12 | const·preserveConsecutiveUppercase:·PascalCase<'foo-BAR-baz',·{preserveConsecutiveUppercase:·true}>·=·'FooBARBaz'; |
| 13 | const·splitOnPunctuation:·PascalCase<'foo-bar>>baz',·{splitOnPunctuation:·true}>·=·'FooBarBaz'; | ||
| 13 | //·Advanced | 14 | //·Advanced |
| 14 | type·PascalCasedProperties<T>·=·{ | 15 | type·PascalCasedProperties<T>·=·{ |
| 15 | » [K·in·keyof·T·as·PascalCase<K>]:·T[K] | 16 | » [K·in·keyof·T·as·PascalCase<K>]:·T[K] |
| 16 | }; | 17 | }; |
| Offset 44, 14 lines modified | Offset 44, 21 lines modified | ||
| 44 | const·preserveConsecutiveUppercase:·PascalCasedPropertiesDeep<{fooBAR:·{fooBARBiz:·[{fooBARBaz:·string}]}},·{preserveConsecutiveUppercase:·true}>·=·{ | 44 | const·preserveConsecutiveUppercase:·PascalCasedPropertiesDeep<{fooBAR:·{fooBARBiz:·[{fooBARBaz:·string}]}},·{preserveConsecutiveUppercase:·true}>·=·{ |
| 45 | » FooBAR:·{ | 45 | » FooBAR:·{ |
| 46 | » » FooBARBiz:·[{ | 46 | » » FooBARBiz:·[{ |
| 47 | » » » FooBARBaz:·'string', | 47 | » » » FooBARBaz:·'string', |
| 48 | » » }], | 48 | » » }], |
| 49 | » }, | 49 | » }, |
| 50 | }; | 50 | }; |
| 51 | const·splitOnPunctuation:·PascalCasedPropertiesDeep<{'user@info':·{'user::id':·number;·'user::name':·string}},·{splitOnPunctuation:·true}>·=·{ | ||
| 52 | » UserInfo:·{ | ||
| 53 | » » UserId:·1, | ||
| 54 | » » UserName:·'Tom', | ||
| 55 | » }, | ||
| 56 | }; | ||
| 51 | ``` | 57 | ``` |
| 52 | @category·Change·case | 58 | @category·Change·case |
| 53 | @category·Template·literal | 59 | @category·Template·literal |
| 54 | @category·Object | 60 | @category·Object |
| 55 | */ | 61 | */ |
| 56 | export·type·PascalCasedPropertiesDeep<Value,·Options·extends·CamelCaseOptions·=·{}>·= | 62 | export·type·PascalCasedPropertiesDeep<Value,·Options·extends·CamelCaseOptions·=·{}>·= |
| Offset 1, 13 lines modified | Offset 1, 13 lines modified | ||
| 1 | import·type·{CamelCaseOptions,·_DefaultCamelCaseOptions}·from·'./camel-case.d.ts'; | 1 | import·type·{CamelCaseOptions,·_DefaultCamelCaseOptions}·from·'./camel-case.d.ts'; |
| 2 | import·type·{ApplyDefaultOptions}·from·'./internal/index.d.ts'; | 2 | import·type·{ApplyDefaultOptions}·from·'./internal/index.d.ts'; |
| 3 | import·type·{PascalCase}·from·'./pascal-case.d.ts'; | 3 | import·type·{PascalCase}·from·'./pascal-case.d.ts'; |
| 4 | /** | 4 | /** |
| 5 | Convert·object·properties·to·pascal·ca | 5 | Convert·top-level·object·properties·to·pascal·case. |
| 6 | This·can·be·useful·when,·for·example,·converting·some·API·types·from·a·different·style. | 6 | This·can·be·useful·when,·for·example,·converting·some·API·types·from·a·different·style. |
| 7 | @see·{@link·PascalCase} | 7 | @see·{@link·PascalCase} |
| 8 | @see·{@link·PascalCasedPropertiesDeep} | 8 | @see·{@link·PascalCasedPropertiesDeep} |
| 9 | @example | 9 | @example |
| Offset 23, 14 lines modified | Offset 23, 18 lines modified | ||
| 23 | » UserId:·1, | 23 | » UserId:·1, |
| 24 | » UserName:·'Tom', | 24 | » UserName:·'Tom', |
| 25 | }; | 25 | }; |
| 26 | const·preserveConsecutiveUppercase:·PascalCasedProperties<{fooBAR:·string},·{preserveConsecutiveUppercase:·true}>·=·{ | 26 | const·preserveConsecutiveUppercase:·PascalCasedProperties<{fooBAR:·string},·{preserveConsecutiveUppercase:·true}>·=·{ |
| 27 | » FooBAR:·'string', | 27 | » FooBAR:·'string', |
| 28 | }; | 28 | }; |
| 29 | const·splitOnPunctuation:·PascalCasedProperties<{'foo::bar':·string},·{splitOnPunctuation:·true}>·=·{ | ||
| 30 | » FooBar:·'string', | ||
| 31 | }; | ||
| 29 | ``` | 32 | ``` |
| 30 | @category·Change·case | 33 | @category·Change·case |
| 31 | @category·Template·literal | 34 | @category·Template·literal |
| 32 | @category·Object | 35 | @category·Object |
| 33 | */ | 36 | */ |
| 34 | export·type·PascalCasedProperties<Value,·Options·extends·CamelCaseOptions·=·{}>·=·Value·extends·Function | 37 | export·type·PascalCasedProperties<Value,·Options·extends·CamelCaseOptions·=·{}>·=·Value·extends·Function |
| Offset 10, 14 lines modified | Offset 10, 16 lines modified | ||
| 10 | /** | 10 | /** |
| 11 | Pick·properties·from·a·deeply-nested·object. | 11 | Pick·properties·from·a·deeply-nested·object. |
| 12 | It·supports·recursing·into·arrays. | 12 | It·supports·recursing·into·arrays. |
| 13 | Use-case:·Distill·complex·objects·down·to·the·components·you·need·to·target. | 13 | Use-case:·Distill·complex·objects·down·to·the·components·you·need·to·target. |
| 14 | Use·[`Pick<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#picktype-keys)·if·you·only·need·one·level·deep. | ||
| 14 | @example | 15 | @example |
| 15 | ``` | 16 | ``` |
| 16 | import·type·{PickDeep,·PartialDeep}·from·'type-fest'; | 17 | import·type·{PickDeep,·PartialDeep}·from·'type-fest'; |
| 17 | type·Configuration·=·{ | 18 | type·Configuration·=·{ |
| 18 | » userConfig:·{ | 19 | » userConfig:·{ |
| 19 | » » name:·string; | 20 | » » name:·string; |
| Offset 1, 16 lines modified | Offset 1, 18 lines modified | ||
| 1 | import·type·{BuiltIns,·HasMultipleCallSignatures}·from·'./internal/index.d.ts'; | 1 | import·type·{BuiltIns,·HasMultipleCallSignatures}·from·'./internal/index.d.ts'; |
| 2 | /** | 2 | /** |
| 3 | C | 3 | Create·a·deeply·immutable·version·of·another·type. |
| 4 | This·is·useful·when·a·deeply·nested·structure·needs·to·be·exposed·as·completely·immutable,·for·example,·an·imported·JSON·module·or·when·receiving·an·API·response·that·is·passed·around. | 4 | This·is·useful·when·a·deeply·nested·structure·needs·to·be·exposed·as·completely·immutable,·for·example,·an·imported·JSON·module·or·when·receiving·an·API·response·that·is·passed·around. |
| 5 | Please·upvote·[this·issue](https://github.com/microsoft/TypeScript/issues/13923)·if·you·want·to·have·this·type·as·a·built-in·in·TypeScript. | 5 | Please·upvote·[this·issue](https://github.com/microsoft/TypeScript/issues/13923)·if·you·want·to·have·this·type·as·a·built-in·in·TypeScript. |
| 6 | Use·[`Readonly<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#readonlytype)·if·you·only·need·one·level·deep. | ||
| 6 | @example | 7 | @example |
| 7 | ``` | 8 | ``` |
| 8 | import·type·{ReadonlyDeep}·from·'type-fest'; | 9 | import·type·{ReadonlyDeep}·from·'type-fest'; |
| 9 | declare·const·foo:·{ | 10 | declare·const·foo:·{ |
| 10 | » a:·string; | 11 | » a:·string; |
| 11 | » b:·{c:·number}; | 12 | » b:·{c:·number}; |
| Offset 79, 16 lines modified | Offset 81, 16 lines modified | ||
| 79 | » » » » :·HasMultipleCallSignatures<T>·extends·true | 81 | » » » » :·HasMultipleCallSignatures<T>·extends·true |
| 80 | » » » » » ?·T | 82 | » » » » » ?·T |
| 81 | » » » » » :·((...arguments_:·Parameters<T>)·=>·ReturnType<T>)·&·_ReadonlyObjectDeep<T> | 83 | » » » » » :·((...arguments_:·Parameters<T>)·=>·ReturnType<T>)·&·_ReadonlyObjectDeep<T> |
| 82 | » » » :·T·extends·Readonly<ReadonlyMap<infer·KeyType,·infer·ValueType>> | 84 | » » » :·T·extends·Readonly<ReadonlyMap<infer·KeyType,·infer·ValueType>> |
| 83 | » » » » ?·ReadonlyMapDeep<KeyType,·ValueType> | 85 | » » » » ?·ReadonlyMapDeep<KeyType,·ValueType> |
| 84 | » » » » :·T·extends·Readonly<ReadonlySet<infer·ItemType>> | 86 | » » » » :·T·extends·Readonly<ReadonlySet<infer·ItemType>> |
| 85 | » » » » » ?·ReadonlySetDeep<ItemType> | 87 | » » » » » ?·ReadonlySetDeep<ItemType> |
| 86 | » » » » » | 88 | » » » » » //·Identify·tuples·to·avoid·converting·them·to·arrays·inadvertently;·special·case·`readonly·[...never[]]`,·as·it·emerges·undesirably·from·recursive·invocations·of·ReadonlyDeep·below. |
| 87 | » » » » » T·extends·readonly·[]·|·readonly·[...never[]] | 89 | » » » » » :·T·extends·readonly·[]·|·readonly·[...never[]] |
| 88 | » » » » » » ?·readonly·[] | 90 | » » » » » » ?·readonly·[] |
| 89 | » » » » » » :·T·extends·readonly·[infer·U,·...infer·V] | 91 | » » » » » » :·T·extends·readonly·[infer·U,·...infer·V] |
| 90 | » » » » » » » ?·readonly·[ReadonlyDeep<U>,·...ReadonlyDeep<V>] | 92 | » » » » » » » ?·readonly·[ReadonlyDeep<U>,·...ReadonlyDeep<V>] |
| 91 | » » » » » » » :·T·extends·readonly·[...infer·U,·infer·V] | 93 | » » » » » » » :·T·extends·readonly·[...infer·U,·infer·V] |
| 92 | » » » » » » » » ?·readonly·[...ReadonlyDeep<U>,·ReadonlyDeep<V>] | 94 | » » » » » » » » ?·readonly·[...ReadonlyDeep<U>,·ReadonlyDeep<V>] |
| 93 | » » » » » » » » :·T·extends·ReadonlyArray<infer·ItemType> | 95 | » » » » » » » » :·T·extends·ReadonlyArray<infer·ItemType> |
| 94 | » » » » » » » » » ?·ReadonlyArray<ReadonlyDeep<ItemType>> | 96 | » » » » » » » » » ?·ReadonlyArray<ReadonlyDeep<ItemType>> |
| Offset 106, 27 lines modified | Offset 106, 27 lines modified | ||
| 106 | @see·{@link·RemovePrefixOptions} | 106 | @see·{@link·RemovePrefixOptions} |
| 107 | @category·String | 107 | @category·String |
| 108 | @category·Template·literal | 108 | @category·Template·literal |
| 109 | */ | 109 | */ |
| 110 | export·type·RemovePrefix<S·extends·string,·Prefix·extends·string,·Options·extends·RemovePrefixOptions·=·{}>·= | 110 | export·type·RemovePrefix<S·extends·string,·Prefix·extends·string,·Options·extends·RemovePrefixOptions·=·{}>·= |
| 111 | IfNotAnyOrNever< | ||
| 112 | » S, | ||
| 113 | » IfNotAnyOrNever< | 111 | » IfNotAnyOrNever< |
| 112 | » » S, | ||
| 113 | » » IfNotAnyOrNever< | ||
| 114 | » » Prefix, | 114 | » » » Prefix, |
| 115 | » » _RemovePrefix<S,·Prefix,·ApplyDefaultOptions<RemovePrefixOptions,·DefaultRemovePrefixOptions,·Options>>, | 115 | » » » _RemovePrefix<S,·Prefix,·ApplyDefaultOptions<RemovePrefixOptions,·DefaultRemovePrefixOptions,·Options>>, |
| 116 | » » string, | 116 | » » » string, |
| 117 | » » S | 117 | » » » S |
| 118 | » > | 118 | » » > |
| 119 | >; | 119 | » >; |
| 120 | type·_RemovePrefix<S·extends·string,·Prefix·extends·string,·Options·extends·Required<RemovePrefixOptions>>·= | 120 | type·_RemovePrefix<S·extends·string,·Prefix·extends·string,·Options·extends·Required<RemovePrefixOptions>>·= |
| 121 | Prefix·extends·string·//·For·distributing·`Prefix` | 121 | » Prefix·extends·string·//·For·distributing·`Prefix` |
| 122 | » ?·S·extends·`${Prefix}${infer·Rest}` | 122 | » » ?·S·extends·`${Prefix}${infer·Rest}` |
| 123 | » » ?·Or<IsStringLiteral<Prefix>,·Not<Options['strict']>>·extends·true | 123 | » » » ?·Or<IsStringLiteral<Prefix>,·Not<Options['strict']>>·extends·true |
| 124 | » » » ?·Rest | 124 | » » » » ?·Rest |
| 125 | » » » :·string·//·Fallback·to·`string`·when·`Prefix`·is·non-literal·and·`strict`·is·disabled | 125 | » » » » :·string·//·Fallback·to·`string`·when·`Prefix`·is·non-literal·and·`strict`·is·disabled |
| 126 | » » :·S·//·Return·back·`S`·when·`Prefix`·is·not·present·at·the·start·of·`S` | 126 | » » » :·S·//·Return·back·`S`·when·`Prefix`·is·not·present·at·the·start·of·`S` |
| 127 | » :·never; | 127 | » » :·never; |
| 128 | export·{}; | 128 | export·{}; |
| Offset 23, 25 lines modified | Offset 23, 25 lines modified | ||
| 23 | declare·function·replace< | 23 | declare·function·replace< |
| 24 | » Input·extends·string, | 24 | » Input·extends·string, |
| 25 | » Search·extends·string, | 25 | » Search·extends·string, |
| 26 | » Replacement·extends·string, | 26 | » Replacement·extends·string, |
| 27 | >( | 27 | >( |
| 28 | » input:·Input, | 28 | » input:·Input, |
| 29 | » search:·Search, | 29 | » search:·Search, |
| 30 | » replacement:·Replacement | 30 | » replacement:·Replacement, |
| 31 | ):·Replace<Input,·Search,·Replacement>; | 31 | ):·Replace<Input,·Search,·Replacement>; |
| 32 | declare·function·replaceAll< | 32 | declare·function·replaceAll< |
| 33 | » Input·extends·string, | 33 | » Input·extends·string, |
| 34 | » Search·extends·string, | 34 | » Search·extends·string, |
| 35 | » Replacement·extends·string, | 35 | » Replacement·extends·string, |
| 36 | >( | 36 | >( |
| 37 | » input:·Input, | 37 | » input:·Input, |
| 38 | » search:·Search, | 38 | » search:·Search, |
| 39 | » replacement:·Replacement | 39 | » replacement:·Replacement, |
| 40 | ):·Replace<Input,·Search,·Replacement,·{all:·true}>; | 40 | ):·Replace<Input,·Search,·Replacement,·{all:·true}>; |
| 41 | //·The·return·type·is·the·exact·string·literal,·not·just·`string`. | 41 | //·The·return·type·is·the·exact·string·literal,·not·just·`string`. |
| 42 | replace('hello·?',·'?',·'🦄'); | 42 | replace('hello·?',·'?',·'🦄'); |
| 43 | //=>·'hello·🦄' | 43 | //=>·'hello·🦄' |
| Offset 5, 15 lines modified | Offset 5, 15 lines modified | ||
| 5 | /** | 5 | /** |
| 6 | Requires·all·of·the·keys·in·the·given·object. | 6 | Requires·all·of·the·keys·in·the·given·object. |
| 7 | */ | 7 | */ |
| 8 | type·RequireAll<ObjectType,·KeysType·extends·keyof·ObjectType>·=·Required<Pick<ObjectType,·KeysType>>; | 8 | type·RequireAll<ObjectType,·KeysType·extends·keyof·ObjectType>·=·Required<Pick<ObjectType,·KeysType>>; |
| 9 | /** | 9 | /** |
| 10 | Create·a·type·that·requires·all·of·the·given·keys·or·none·of·the·given·keys | 10 | Create·a·type·that·requires·all·of·the·given·keys·or·none·of·the·given·keys,·while·keeping·the·remaining·keys·as·is. |
| 11 | Use-cases: | 11 | Use-cases: |
| 12 | -·Creating·interfaces·for·components·with·mutually-inclusive·keys. | 12 | -·Creating·interfaces·for·components·with·mutually-inclusive·keys. |
| 13 | The·caveat·with·`RequireAllOrNone`·is·that·TypeScript·doesn't·always·know·at·compile·time·every·key·that·will·exist·at·runtime.·Therefore·`RequireAllOrNone`·can't·do·anything·to·prevent·extra·keys·it·doesn't·know·about. | 13 | The·caveat·with·`RequireAllOrNone`·is·that·TypeScript·doesn't·always·know·at·compile·time·every·key·that·will·exist·at·runtime.·Therefore·`RequireAllOrNone`·can't·do·anything·to·prevent·extra·keys·it·doesn't·know·about. |
| 14 | @example | 14 | @example |
| Offset 1, 15 lines modified | Offset 1, 15 lines modified | ||
| 1 | import·type·{Except}·from·'./except.d.ts'; | 1 | import·type·{Except}·from·'./except.d.ts'; |
| 2 | import·type·{If}·from·'./if.d.ts'; | 2 | import·type·{If}·from·'./if.d.ts'; |
| 3 | import·type·{IfNotAnyOrNever}·from·'./internal/index.d.ts'; | 3 | import·type·{IfNotAnyOrNever}·from·'./internal/index.d.ts'; |
| 4 | import·type·{IsAny}·from·'./is-any.d.ts'; | 4 | import·type·{IsAny}·from·'./is-any.d.ts'; |
| 5 | import·type·{IsNever}·from·'./is-never.d.ts'; | 5 | import·type·{IsNever}·from·'./is-never.d.ts'; |
| 6 | /** | 6 | /** |
| 7 | Create·a·type·that·requires·at·least·one·of·the·given·keys | 7 | Create·a·type·that·requires·at·least·one·of·the·given·keys,·while·keeping·the·remaining·keys·as·is. |
| 8 | @example | 8 | @example |
| 9 | ``` | 9 | ``` |
| 10 | import·type·{RequireAtLeastOne}·from·'type-fest'; | 10 | import·type·{RequireAtLeastOne}·from·'type-fest'; |
| 11 | type·Responder·=·{ | 11 | type·Responder·=·{ |
| 12 | » text?:·()·=>·string; | 12 | » text?:·()·=>·string; |
| Offset 36, 15 lines modified | Offset 36, 13 lines modified | ||
| 36 | » » >>; | 36 | » » >>; |
| 37 | type·_RequireAtLeastOne< | 37 | type·_RequireAtLeastOne< |
| 38 | » ObjectType, | 38 | » ObjectType, |
| 39 | » KeysType·extends·keyof·ObjectType, | 39 | » KeysType·extends·keyof·ObjectType, |
| 40 | >·=·{ | 40 | >·=·{ |
| 41 | » //·For·each·`Key`·in·`KeysType`·make·a·mapped·type: | 41 | » //·For·each·`Key`·in·`KeysType`·make·a·mapped·type: |
| 42 | » [Key·in·KeysType]-?:·Required<Pick<ObjectType,·Key>>· | 42 | » [Key·in·KeysType]-?:·Required<Pick<ObjectType,·Key>>·//·1.·Make·`Key`'s·type·required |
| 43 | » » &·Partial<Pick<ObjectType,·Exclude<KeysType,·Key>>>;·//·2.·Make·all·other·keys·in·`KeysType`·optional | ||
| 43 | » //·2.·Make·all·other·keys·in·`KeysType`·optional | ||
| 44 | » » Partial<Pick<ObjectType,·Exclude<KeysType,·Key>>>; | ||
| 45 | }[KeysType] | 44 | }[KeysType] |
| 45 | &·Except<ObjectType,·KeysType>;·//·3.·Add·the·remaining·keys·not·in·`KeysType` | ||
| 46 | //·3.·Add·the·remaining·keys·not·in·`KeysType` | ||
| 47 | Except<ObjectType,·KeysType>; | ||
| 48 | export·{}; | 46 | export·{}; |
| Offset 1, 14 lines modified | Offset 1, 14 lines modified | ||
| 1 | import·type·{If}·from·'./if.d.ts'; | 1 | import·type·{If}·from·'./if.d.ts'; |
| 2 | import·type·{IfNotAnyOrNever}·from·'./internal/index.d.ts'; | 2 | import·type·{IfNotAnyOrNever}·from·'./internal/index.d.ts'; |
| 3 | import·type·{IsAny}·from·'./is-any.d.ts'; | 3 | import·type·{IsAny}·from·'./is-any.d.ts'; |
| 4 | import·type·{IsNever}·from·'./is-never.d.ts'; | 4 | import·type·{IsNever}·from·'./is-never.d.ts'; |
| 5 | /** | 5 | /** |
| 6 | Create·a·type·that·requires·exactly·one·of·the·given·keys·and·disallows·more | 6 | Create·a·type·that·requires·exactly·one·of·the·given·keys·and·disallows·more,·while·keeping·the·remaining·keys·as·is. |
| 7 | Use-cases: | 7 | Use-cases: |
| 8 | -·Creating·interfaces·for·components·that·only·need·one·of·the·keys·to·display·properly. | 8 | -·Creating·interfaces·for·components·that·only·need·one·of·the·keys·to·display·properly. |
| 9 | -·Declaring·generic·keys·in·a·single·place·for·a·single·use-case·that·gets·narrowed·down·via·`RequireExactlyOne`. | 9 | -·Declaring·generic·keys·in·a·single·place·for·a·single·use-case·that·gets·narrowed·down·via·`RequireExactlyOne`. |
| 10 | The·caveat·with·`RequireExactlyOne`·is·that·TypeScript·doesn't·always·know·at·compile·time·every·key·that·will·exist·at·runtime.·Therefore·`RequireExactlyOne`·can't·do·anything·to·prevent·extra·keys·it·doesn't·know·about. | 10 | The·caveat·with·`RequireExactlyOne`·is·that·TypeScript·doesn't·always·know·at·compile·time·every·key·that·will·exist·at·runtime.·Therefore·`RequireExactlyOne`·can't·do·anything·to·prevent·extra·keys·it·doesn't·know·about. |
| Offset 37, 12 lines modified | Offset 37, 12 lines modified | ||
| 37 | » » If<IsNever<KeysType>, | 37 | » » If<IsNever<KeysType>, |
| 38 | » » » never, | 38 | » » » never, |
| 39 | » » » _RequireExactlyOne<ObjectType,·If<IsAny<KeysType>,·keyof·ObjectType,·KeysType>> | 39 | » » » _RequireExactlyOne<ObjectType,·If<IsAny<KeysType>,·keyof·ObjectType,·KeysType>> |
| 40 | » » >>; | 40 | » » >>; |
| 41 | type·_RequireExactlyOne<ObjectType,·KeysType·extends·keyof·ObjectType>·= | 41 | type·_RequireExactlyOne<ObjectType,·KeysType·extends·keyof·ObjectType>·= |
| 42 | » {[Key·in·KeysType]:·( | 42 | » {[Key·in·KeysType]:·( |
| 43 | » » Required<Pick<ObjectType,·Key>> | 43 | » » Required<Pick<ObjectType,·Key>> |
| 44 | » » Partial<Record<Exclude<KeysType,·Key>,·never>> | 44 | » » &·Partial<Record<Exclude<KeysType,·Key>,·never>> |
| 45 | » )}[KeysType]·&·Omit<ObjectType,·KeysType>; | 45 | » )}[KeysType]·&·Omit<ObjectType,·KeysType>; |
| 46 | export·{}; | 46 | export·{}; |
| Offset 1, 15 lines modified | Offset 1, 15 lines modified | ||
| 1 | import·type·{RequireExactlyOne}·from·'./require-exactly-one.d.ts'; | 1 | import·type·{RequireExactlyOne}·from·'./require-exactly-one.d.ts'; |
| 2 | import·type·{IfNotAnyOrNever,·RequireNone}·from·'./internal/index.d.ts'; | 2 | import·type·{IfNotAnyOrNever,·RequireNone}·from·'./internal/index.d.ts'; |
| 3 | import·type·{If}·from·'./if.d.ts'; | 3 | import·type·{If}·from·'./if.d.ts'; |
| 4 | import·type·{IsAny}·from·'./is-any.d.ts'; | 4 | import·type·{IsAny}·from·'./is-any.d.ts'; |
| 5 | import·type·{IsNever}·from·'./is-never.d.ts'; | 5 | import·type·{IsNever}·from·'./is-never.d.ts'; |
| 6 | /** | 6 | /** |
| 7 | Create·a·type·that·requires·exactly·one·of·the·given·keys· | 7 | Create·a·type·that·requires·exactly·one·of·the·given·keys·or·none·of·the·given·keys,·while·keeping·the·remaining·keys·as·is. |
| 8 | @example | 8 | @example |
| 9 | ``` | 9 | ``` |
| 10 | import·type·{RequireOneOrNone}·from·'type-fest'; | 10 | import·type·{RequireOneOrNone}·from·'type-fest'; |
| 11 | type·Responder·=·RequireOneOrNone<{ | 11 | type·Responder·=·RequireOneOrNone<{ |
| 12 | » text:·()·=>·string; | 12 | » text:·()·=>·string; |
| Offset 1, 18 lines modified | Offset 1, 20 lines modified | ||
| 1 | import·type·{BuiltIns,·HasMultipleCallSignatures}·from·'./internal/index.d.ts'; | 1 | import·type·{BuiltIns,·HasMultipleCallSignatures}·from·'./internal/index.d.ts'; |
| 2 | import·type·{IsNever}·from·'./is-never.d.ts'; | 2 | import·type·{IsNever}·from·'./is-never.d.ts'; |
| 3 | import·type·{Simplify}·from·'./simplify.d.ts'; | 3 | import·type·{Simplify}·from·'./simplify.d.ts'; |
| 4 | /** | 4 | /** |
| 5 | Create·a· | 5 | Create·a·deeply·required·version·of·another·type. |
| 6 | Use-cases: | 6 | Use-cases: |
| 7 | -·Creating·optional·configuration·interfaces·where·the·underlying·implementation·still·requires·all·options·to·be·fully·specified. | 7 | -·Creating·optional·configuration·interfaces·where·the·underlying·implementation·still·requires·all·options·to·be·fully·specified. |
| 8 | -·Modeling·the·resulting·type·after·a·deep·merge·with·a·set·of·defaults. | 8 | -·Modeling·the·resulting·type·after·a·deep·merge·with·a·set·of·defaults. |
| 9 | Use·[`Required<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#requiredtype)·if·you·only·need·one·level·deep. | ||
| 9 | @example | 10 | @example |
| 10 | ``` | 11 | ``` |
| 11 | import·type·{RequiredDeep}·from·'type-fest'; | 12 | import·type·{RequiredDeep}·from·'type-fest'; |
| 12 | type·Settings·=·{ | 13 | type·Settings·=·{ |
| 13 | » textEditor?:·{ | 14 | » textEditor?:·{ |
| 14 | » » fontSize?:·number; | 15 | » » fontSize?:·number; |
| Offset 10, 14 lines modified | Offset 10, 15 lines modified | ||
| 10 | @example | 10 | @example |
| 11 | ``` | 11 | ``` |
| 12 | import·type·{ScreamingSnakeCase}·from·'type-fest'; | 12 | import·type·{ScreamingSnakeCase}·from·'type-fest'; |
| 13 | const·someVariable:·ScreamingSnakeCase<'fooBar'>·=·'FOO_BAR'; | 13 | const·someVariable:·ScreamingSnakeCase<'fooBar'>·=·'FOO_BAR'; |
| 14 | const·someVariableNoSplitOnNumbers:·ScreamingSnakeCase<'p2pNetwork',·{splitOnNumbers:·false}>·=·'P2P_NETWORK'; | 14 | const·someVariableNoSplitOnNumbers:·ScreamingSnakeCase<'p2pNetwork',·{splitOnNumbers:·false}>·=·'P2P_NETWORK'; |
| 15 | const·someVariableWithPunctuation:·ScreamingSnakeCase<'div.card::after',·{splitOnPunctuation:·true}>·=·'DIV_CARD_AFTER'; | ||
| 15 | ``` | 16 | ``` |
| 16 | @category·Change·case | 17 | @category·Change·case |
| 17 | @category·Template·literal | 18 | @category·Template·literal |
| 18 | ·*/ | 19 | ·*/ |
| 19 | export·type·ScreamingSnakeCase< | 20 | export·type·ScreamingSnakeCase< |
| Offset 1, 18 lines modified | Offset 1, 20 lines modified | ||
| 1 | import·type·{NonRecursiveType,·StringToNumber}·from·'./internal/index.d.ts'; | 1 | import·type·{NonRecursiveType,·StringToNumber}·from·'./internal/index.d.ts'; |
| 2 | import·type·{IsAny}·from·'./is-any.d.ts'; | ||
| 3 | import·type·{NonNullableDeep}·from·'./non-nullable-deep.d.ts'; | ||
| 2 | import·type·{Paths}·from·'./paths.d.ts'; | 4 | import·type·{Paths}·from·'./paths.d.ts'; |
| 3 | import·type·{SetNonNullable}·from·'./set-non-nullable.d.ts'; | 5 | import·type·{SetNonNullable}·from·'./set-non-nullable.d.ts'; |
| 4 | import·type·{Simplify}·from·'./simplify.d.ts'; | 6 | import·type·{Simplify}·from·'./simplify.d.ts'; |
| 5 | import·type·{UnionToTuple}·from·'./union-to-tuple.d.ts'; | 7 | import·type·{UnionToTuple}·from·'./union-to-tuple.d.ts'; |
| 6 | import·type·{UnknownArray}·from·'./unknown-array.d.ts'; | 8 | import·type·{UnknownArray}·from·'./unknown-array.d.ts'; |
| 7 | /** | 9 | /** |
| 8 | Create·a·type·that·makes·the·specified·keys·non-nullable·(removes·`null`·and·`undefined`),·supports·deeply·nested·key·paths,·and·leaves·all·other·keys·unchanged. | 10 | Create·a·type·that·makes·the·specified·keys·non-nullable·(removes·`null`·and·`undefined`),·supports·deeply·nested·key·paths,·and·leaves·all·other·keys·unchanged. |
| 9 | NOTE:·Optional·modifiers·(`?`)·are·not·removed·from·properties.·For·example,·`SetNonNullableDeep<{foo?:·string·|·null·|·undefined},·'foo'>`·will·result·in·`{foo?:·string}`. | 11 | NOTE:·Optional·modifiers·(`?`)·are·not·removed·from·properties.·For·example,·`SetNonNullableDeep<{foo?:·string·|·null·|·undefined},·'foo'>`·will·result·in·`{foo?:·string}`.·To·remove·both·optional·modifiers·and·nullables,·use·{@link·SetRequiredDeep}·in·conjunction·with·this·type. |
| 10 | @example | 12 | @example |
| 11 | ``` | 13 | ``` |
| 12 | import·type·{SetNonNullableDeep}·from·'type-fest'; | 14 | import·type·{SetNonNullableDeep}·from·'type-fest'; |
| 13 | type·User·=·{ | 15 | type·User·=·{ |
| 14 | » name:·string; | 16 | » name:·string; |
| Offset 51, 16 lines modified | Offset 53, 17 lines modified | ||
| 51 | //·Optional·modifier·(`?`)·is·not·removed. | 53 | //·Optional·modifier·(`?`)·is·not·removed. |
| 52 | type·ArrayExample2·=·SetNonNullableDeep<{a:·[(number·|·null)?,·(number·|·null)?]},·'a.1'>; | 54 | type·ArrayExample2·=·SetNonNullableDeep<{a:·[(number·|·null)?,·(number·|·null)?]},·'a.1'>; |
| 53 | //=>·{a:·[(number·|·null)?,·number?]} | 55 | //=>·{a:·[(number·|·null)?,·number?]} |
| 54 | ``` | 56 | ``` |
| 55 | @category·Object | 57 | @category·Object |
| 56 | */ | 58 | */ |
| 57 | export·type·SetNonNullableDeep<BaseType,·KeyPaths·extends·Paths<BaseType>>·= | 59 | export·type·SetNonNullableDeep<BaseType,·KeyPaths·extends·Paths<BaseType>>·=·IsAny<KeyPaths>·extends·true |
| 60 | » ?·NonNullableDeep<BaseType> | ||
| 58 | » SetNonNullableDeepHelper<BaseType,·UnionToTuple<KeyPaths>>; | 61 | » :·SetNonNullableDeepHelper<BaseType,·UnionToTuple<KeyPaths>>; |
| 59 | /** | 62 | /** |
| 60 | Internal·helper·for·{@link·SetNonNullableDeep}. | 63 | Internal·helper·for·{@link·SetNonNullableDeep}. |
| 61 | Recursively·transforms·the·`BaseType`·by·applying·{@link·SetNonNullableDeepSinglePath}·for·each·path·in·`KeyPathsTuple`. | 64 | Recursively·transforms·the·`BaseType`·by·applying·{@link·SetNonNullableDeepSinglePath}·for·each·path·in·`KeyPathsTuple`. |
| 62 | */ | 65 | */ |
| 63 | type·SetNonNullableDeepHelper<BaseType,·KeyPathsTuple·extends·UnknownArray>·= | 66 | type·SetNonNullableDeepHelper<BaseType,·KeyPathsTuple·extends·UnknownArray>·= |
| Offset 1, 9 lines modified | Offset 1, 9 lines modified | ||
| 1 | /** | 1 | /** |
| 2 | Create·a·type·that·makes·the·given·keys·non-nullable,·whe | 2 | Create·a·type·that·makes·the·given·keys·non-nullable,·while·keeping·the·remaining·keys·as·is. |
| 3 | If·no·keys·are·given,·all·keys·will·be·made·non-nullable. | 3 | If·no·keys·are·given,·all·keys·will·be·made·non-nullable. |
| 4 | Use-case:·You·want·to·define·a·single·model·where·the·only·thing·that·changes·is·whether·or·not·some·or·all·of·the·keys·are·non-nullable. | 4 | Use-case:·You·want·to·define·a·single·model·where·the·only·thing·that·changes·is·whether·or·not·some·or·all·of·the·keys·are·non-nullable. |
| 5 | @example | 5 | @example |
| 6 | ``` | 6 | ``` |
| Offset 1, 13 lines modified | Offset 1, 13 lines modified | ||
| 1 | import·type·{Except}·from·'./except.d.ts'; | 1 | import·type·{Except}·from·'./except.d.ts'; |
| 2 | import·type·{HomomorphicPick}·from·'./internal/index.d.ts'; | 2 | import·type·{HomomorphicPick}·from·'./internal/index.d.ts'; |
| 3 | import·type·{Simplify}·from·'./simplify.d.ts'; | 3 | import·type·{Simplify}·from·'./simplify.d.ts'; |
| 4 | /** | 4 | /** |
| 5 | Create·a·type·that·makes·the·given·keys·optional | 5 | Create·a·type·that·makes·the·given·keys·optional,·while·keeping·the·remaining·keys·as·is. |
| 6 | Use-case:·You·want·to·define·a·single·model·where·the·only·thing·that·changes·is·whether·or·not·some·of·the·keys·are·optional. | 6 | Use-case:·You·want·to·define·a·single·model·where·the·only·thing·that·changes·is·whether·or·not·some·of·the·keys·are·optional. |
| 7 | @example | 7 | @example |
| 8 | ``` | 8 | ``` |
| 9 | import·type·{SetOptional}·from·'type-fest'; | 9 | import·type·{SetOptional}·from·'type-fest'; |
| Offset 28, 15 lines modified | Offset 28, 15 lines modified | ||
| 28 | » » ?·(...arguments_:·Parameters<BaseType>)·=>·ReturnType<BaseType> | 28 | » » ?·(...arguments_:·Parameters<BaseType>)·=>·ReturnType<BaseType> |
| 29 | » » :·unknown) | 29 | » » :·unknown) |
| 30 | » &·_SetOptional<BaseType,·Keys>; | 30 | » &·_SetOptional<BaseType,·Keys>; |
| 31 | type·_SetOptional<BaseType,·Keys·extends·keyof·BaseType>·= | 31 | type·_SetOptional<BaseType,·Keys·extends·keyof·BaseType>·= |
| 32 | » BaseType·extends·unknown·//·To·distribute·`BaseType`·when·it's·a·union·type. | 32 | » BaseType·extends·unknown·//·To·distribute·`BaseType`·when·it's·a·union·type. |
| 33 | » » ?·Simplify< | 33 | » » ?·Simplify< |
| 34 | » » //·Pick·just·the·keys·that·are·readonly·from·the·base·type. | 34 | » » » //·Pick·just·the·keys·that·are·readonly·from·the·base·type. |
| 35 | » » » Except<BaseType,·Keys> | 35 | » » » Except<BaseType,·Keys> |
| 36 | » » //·Pick·the·keys·that·should·be·mutable·from·the·base·type·and·make·them·mutable. | 36 | » » » //·Pick·the·keys·that·should·be·mutable·from·the·base·type·and·make·them·mutable. |
| 37 | » » » Partial<HomomorphicPick<BaseType,·Keys>> | 37 | » » » &·Partial<HomomorphicPick<BaseType,·Keys>> |
| 38 | » » > | 38 | » » > |
| 39 | » » :·never; | 39 | » » :·never; |
| 40 | export·{}; | 40 | export·{}; |
| Offset 1, 13 lines modified | Offset 1, 13 lines modified | ||
| 1 | import·type·{Except}·from·'./except.d.ts'; | 1 | import·type·{Except}·from·'./except.d.ts'; |
| 2 | import·type·{HomomorphicPick}·from·'./internal/index.d.ts'; | 2 | import·type·{HomomorphicPick}·from·'./internal/index.d.ts'; |
| 3 | import·type·{Simplify}·from·'./simplify.d.ts'; | 3 | import·type·{Simplify}·from·'./simplify.d.ts'; |
| 4 | /** | 4 | /** |
| 5 | Create·a·type·that·makes·the·given·keys·readonly | 5 | Create·a·type·that·makes·the·given·keys·readonly,·while·keeping·the·remaining·keys·as·is. |
| 6 | Use-case:·You·want·to·define·a·single·model·where·the·only·thing·that·changes·is·whether·or·not·some·of·the·keys·are·readonly. | 6 | Use-case:·You·want·to·define·a·single·model·where·the·only·thing·that·changes·is·whether·or·not·some·of·the·keys·are·readonly. |
| 7 | @example | 7 | @example |
| 8 | ``` | 8 | ``` |
| 9 | import·type·{SetReadonly}·from·'type-fest'; | 9 | import·type·{SetReadonly}·from·'type-fest'; |
| Offset 28, 13 lines modified | Offset 28, 13 lines modified | ||
| 28 | » » ?·(...arguments_:·Parameters<BaseType>)·=>·ReturnType<BaseType> | 28 | » » ?·(...arguments_:·Parameters<BaseType>)·=>·ReturnType<BaseType> |
| 29 | » » :·unknown) | 29 | » » :·unknown) |
| 30 | » &·_SetReadonly<BaseType,·Keys>; | 30 | » &·_SetReadonly<BaseType,·Keys>; |
| 31 | export·type·_SetReadonly<BaseType,·Keys·extends·keyof·BaseType>·= | 31 | export·type·_SetReadonly<BaseType,·Keys·extends·keyof·BaseType>·= |
| 32 | » BaseType·extends·unknown·//·To·distribute·`BaseType`·when·it's·a·union·type. | 32 | » BaseType·extends·unknown·//·To·distribute·`BaseType`·when·it's·a·union·type. |
| 33 | » » ?·Simplify< | 33 | » » ?·Simplify< |
| 34 | » » » Except<BaseType,·Keys> | 34 | » » » Except<BaseType,·Keys> |
| 35 | » » » Readonly<HomomorphicPick<BaseType,·Keys>> | 35 | » » » &·Readonly<HomomorphicPick<BaseType,·Keys>> |
| 36 | » » > | 36 | » » > |
| 37 | » » :·never; | 37 | » » :·never; |
| 38 | export·{}; | 38 | export·{}; |
| Offset 4, 15 lines modified | Offset 4, 15 lines modified | ||
| 4 | import·type·{SetRequired}·from·'./set-required.d.ts'; | 4 | import·type·{SetRequired}·from·'./set-required.d.ts'; |
| 5 | import·type·{SimplifyDeep}·from·'./simplify-deep.d.ts'; | 5 | import·type·{SimplifyDeep}·from·'./simplify-deep.d.ts'; |
| 6 | import·type·{UnionToTuple}·from·'./union-to-tuple.d.ts'; | 6 | import·type·{UnionToTuple}·from·'./union-to-tuple.d.ts'; |
| 7 | import·type·{RequiredDeep}·from·'./required-deep.d.ts'; | 7 | import·type·{RequiredDeep}·from·'./required-deep.d.ts'; |
| 8 | import·type·{UnknownArray}·from·'./unknown-array.d.ts'; | 8 | import·type·{UnknownArray}·from·'./unknown-array.d.ts'; |
| 9 | /** | 9 | /** |
| 10 | Create·a·type·that·makes·the·given·keys·required | 10 | Create·a·type·that·makes·the·given·keys·required,·with·support·for·deeply·nested·key·paths,·while·keeping·the·remaining·keys·as·is. |
| 11 | Use-case:·Selectively·make·nested·properties·required·in·complex·types·like·models. | 11 | Use-case:·Selectively·make·nested·properties·required·in·complex·types·like·models. |
| 12 | @example | 12 | @example |
| 13 | ``` | 13 | ``` |
| 14 | import·type·{SetRequiredDeep}·from·'type-fest'; | 14 | import·type·{SetRequiredDeep}·from·'type-fest'; |
| Offset 2, 15 lines modified | Offset 2, 15 lines modified | ||
| 2 | import·type·{If}·from·'./if.d.ts'; | 2 | import·type·{If}·from·'./if.d.ts'; |
| 3 | import·type·{HomomorphicPick,·IsArrayReadonly}·from·'./internal/index.d.ts'; | 3 | import·type·{HomomorphicPick,·IsArrayReadonly}·from·'./internal/index.d.ts'; |
| 4 | import·type·{OptionalKeysOf}·from·'./optional-keys-of.d.ts'; | 4 | import·type·{OptionalKeysOf}·from·'./optional-keys-of.d.ts'; |
| 5 | import·type·{Simplify}·from·'./simplify.d.ts'; | 5 | import·type·{Simplify}·from·'./simplify.d.ts'; |
| 6 | import·type·{UnknownArray}·from·'./unknown-array.d.ts'; | 6 | import·type·{UnknownArray}·from·'./unknown-array.d.ts'; |
| 7 | /** | 7 | /** |
| 8 | Create·a·type·that·makes·the·given·keys·required | 8 | Create·a·type·that·makes·the·given·keys·required,·while·keeping·the·remaining·keys·as·is. |
| 9 | Use-case:·You·want·to·define·a·single·model·where·the·only·thing·that·changes·is·whether·or·not·some·of·the·keys·are·required. | 9 | Use-case:·You·want·to·define·a·single·model·where·the·only·thing·that·changes·is·whether·or·not·some·of·the·keys·are·required. |
| 10 | @example | 10 | @example |
| 11 | ``` | 11 | ``` |
| 12 | import·type·{SetRequired}·from·'type-fest'; | 12 | import·type·{SetRequired}·from·'type-fest'; |
| Offset 39, 17 lines modified | Offset 39, 17 lines modified | ||
| 39 | type·_SetRequired<BaseType,·Keys·extends·keyof·BaseType>·= | 39 | type·_SetRequired<BaseType,·Keys·extends·keyof·BaseType>·= |
| 40 | » BaseType·extends·UnknownArray | 40 | » BaseType·extends·UnknownArray |
| 41 | » » ?·SetArrayRequired<BaseType,·Keys>·extends·infer·ResultantArray | 41 | » » ?·SetArrayRequired<BaseType,·Keys>·extends·infer·ResultantArray |
| 42 | » » » ?·If<IsArrayReadonly<BaseType>,·Readonly<ResultantArray>,·ResultantArray> | 42 | » » » ?·If<IsArrayReadonly<BaseType>,·Readonly<ResultantArray>,·ResultantArray> |
| 43 | » » » :·never | 43 | » » » :·never |
| 44 | » » :·Simplify< | 44 | » » :·Simplify< |
| 45 | » » //·Pick·just·the·keys·that·are·optional·from·the·base·type. | 45 | » » //·Pick·just·the·keys·that·are·optional·from·the·base·type. |
| 46 | » » » Except<BaseType,·Keys> | 46 | » » » Except<BaseType,·Keys> |
| 47 | » » //·Pick·the·keys·that·should·be·required·from·the·base·type·and·make·them·required. | 47 | » » //·Pick·the·keys·that·should·be·required·from·the·base·type·and·make·them·required. |
| 48 | » » » Required<HomomorphicPick<BaseType,·Keys>> | 48 | » » » &·Required<HomomorphicPick<BaseType,·Keys>> |
| 49 | » » >; | 49 | » » >; |
| 50 | /** | 50 | /** |
| 51 | Remove·the·optional·modifier·from·the·specified·keys·in·an·array. | 51 | Remove·the·optional·modifier·from·the·specified·keys·in·an·array. |
| 52 | */ | 52 | */ |
| 53 | type·SetArrayRequired< | 53 | type·SetArrayRequired< |
| 54 | » TArray·extends·UnknownArray, | 54 | » TArray·extends·UnknownArray, |
| Offset 62, 18 lines modified | Offset 62, 18 lines modified | ||
| 62 | @see·{@link·SharedUnionFieldsDeep} | 62 | @see·{@link·SharedUnionFieldsDeep} |
| 63 | @see·{@link·AllUnionFields} | 63 | @see·{@link·AllUnionFields} |
| 64 | @category·Object | 64 | @category·Object |
| 65 | @category·Union | 65 | @category·Union |
| 66 | */ | 66 | */ |
| 67 | export·type·SharedUnionFields<Union>·= | 67 | export·type·SharedUnionFields<Union>·= |
| 68 | Extract<Union,·NonRecursiveType·|·ReadonlyMap<unknown,·unknown>·|·ReadonlySet<unknown>·|·UnknownArray>·extends·infer·SkippedMembers | 68 | » Extract<Union,·NonRecursiveType·|·ReadonlyMap<unknown,·unknown>·|·ReadonlySet<unknown>·|·UnknownArray>·extends·infer·SkippedMembers |
| 69 | » ?·Exclude<Union,·SkippedMembers>·extends·infer·RelevantMembers | 69 | » » ?·Exclude<Union,·SkippedMembers>·extends·infer·RelevantMembers |
| 70 | » » ? | 70 | » » » ?·//·eslint-disable-line·@stylistic/operator-linebreak |
| 71 | » » |·SkippedMembers | 71 | » » » |·SkippedMembers |
| 72 | » » |·(IsNever<RelevantMembers>·extends·true | 72 | » » » |·(IsNever<RelevantMembers>·extends·true |
| 73 | » » » ?·never | 73 | » » » » ?·never |
| 74 | » » » :·Simplify<Pick<RelevantMembers,·keyof·RelevantMembers>>) | 74 | » » » » :·Simplify<Pick<RelevantMembers,·keyof·RelevantMembers>>) |
| 75 | » » :·never | 75 | » » » :·never |
| 76 | » :·never; | 76 | » » :·never; |
| 77 | export·{}; | 77 | export·{}; |
| Offset 12, 14 lines modified | Offset 12, 15 lines modified | ||
| 12 | import·type·{SnakeCase}·from·'type-fest'; | 12 | import·type·{SnakeCase}·from·'type-fest'; |
| 13 | //·Simple | 13 | //·Simple |
| 14 | const·someVariable:·SnakeCase<'fooBar'>·=·'foo_bar'; | 14 | const·someVariable:·SnakeCase<'fooBar'>·=·'foo_bar'; |
| 15 | const·noSplitOnNumbers:·SnakeCase<'p2pNetwork'>·=·'p2p_network'; | 15 | const·noSplitOnNumbers:·SnakeCase<'p2pNetwork'>·=·'p2p_network'; |
| 16 | const·splitOnNumbers:·SnakeCase<'p2pNetwork',·{splitOnNumbers:·true}>·=·'p_2_p_network'; | 16 | const·splitOnNumbers:·SnakeCase<'p2pNetwork',·{splitOnNumbers:·true}>·=·'p_2_p_network'; |
| 17 | const·splitOnPunctuation:·SnakeCase<'div.card::after',·{splitOnPunctuation:·true}>·=·'div_card_after'; | ||
| 17 | //·Advanced | 18 | //·Advanced |
| 18 | type·SnakeCasedProperties<T>·=·{ | 19 | type·SnakeCasedProperties<T>·=·{ |
| 19 | » [K·in·keyof·T·as·SnakeCase<K>]:·T[K] | 20 | » [K·in·keyof·T·as·SnakeCase<K>]:·T[K] |
| 20 | }; | 21 | }; |
| Offset 47, 14 lines modified | Offset 47, 21 lines modified | ||
| 47 | » » line_2:·[ | 47 | » » line_2:·[ |
| 48 | » » » { | 48 | » » » { |
| 49 | » » » » line_3:·'string', | 49 | » » » » line_3:·'string', |
| 50 | » » » }, | 50 | » » » }, |
| 51 | » » ], | 51 | » » ], |
| 52 | » }, | 52 | » }, |
| 53 | }; | 53 | }; |
| 54 | const·splitOnPunctuation:·SnakeCasedPropertiesDeep<{'user@info':·{'user::id':·number;·'user::name':·string}},·{splitOnPunctuation:·true}>·=·{ | ||
| 55 | » 'user_info':·{ | ||
| 56 | » » 'user_id':·1, | ||
| 57 | » » 'user_name':·'Tom', | ||
| 58 | » }, | ||
| 59 | }; | ||
| 54 | ``` | 60 | ``` |
| 55 | @category·Change·case | 61 | @category·Change·case |
| 56 | @category·Template·literal | 62 | @category·Template·literal |
| 57 | @category·Object | 63 | @category·Object |
| 58 | */ | 64 | */ |
| 59 | export·type·SnakeCasedPropertiesDeep< | 65 | export·type·SnakeCasedPropertiesDeep< |
| Offset 1, 14 lines modified | Offset 1, 14 lines modified | ||
| 1 | import·type·{_DefaultDelimiterCaseOptions}·from·'./delimiter-case.d.ts'; | 1 | import·type·{_DefaultDelimiterCaseOptions}·from·'./delimiter-case.d.ts'; |
| 2 | import·type·{DelimiterCasedProperties}·from·'./delimiter-cased-properties.d.ts'; | 2 | import·type·{DelimiterCasedProperties}·from·'./delimiter-cased-properties.d.ts'; |
| 3 | import·type·{ApplyDefaultOptions}·from·'./internal/index.d.ts'; | 3 | import·type·{ApplyDefaultOptions}·from·'./internal/index.d.ts'; |
| 4 | import·type·{WordsOptions}·from·'./words.d.ts'; | 4 | import·type·{WordsOptions}·from·'./words.d.ts'; |
| 5 | /** | 5 | /** |
| 6 | Convert·object·properties·to·snake·ca | 6 | Convert·top-level·object·properties·to·snake·case. |
| 7 | This·can·be·useful·when,·for·example,·converting·some·API·types·from·a·different·style. | 7 | This·can·be·useful·when,·for·example,·converting·some·API·types·from·a·different·style. |
| 8 | @see·{@link·SnakeCase} | 8 | @see·{@link·SnakeCase} |
| 9 | @see·{@link·SnakeCasedPropertiesDeep} | 9 | @see·{@link·SnakeCasedPropertiesDeep} |
| 10 | @example | 10 | @example |
| Offset 24, 14 lines modified | Offset 24, 18 lines modified | ||
| 24 | » user_id:·1, | 24 | » user_id:·1, |
| 25 | » user_name:·'Tom', | 25 | » user_name:·'Tom', |
| 26 | }; | 26 | }; |
| 27 | const·splitOnNumbers:·SnakeCasedProperties<{line1:·string},·{splitOnNumbers:·true}>·=·{ | 27 | const·splitOnNumbers:·SnakeCasedProperties<{line1:·string},·{splitOnNumbers:·true}>·=·{ |
| 28 | » 'line_1':·'string', | 28 | » 'line_1':·'string', |
| 29 | }; | 29 | }; |
| 30 | const·splitOnPunctuation:·SnakeCasedProperties<{'foo::bar':·string},·{splitOnPunctuation:·true}>·=·{ | ||
| 31 | » 'foo_bar':·'string', | ||
| 32 | }; | ||
| 30 | ``` | 33 | ``` |
| 31 | @category·Change·case | 34 | @category·Change·case |
| 32 | @category·Template·literal | 35 | @category·Template·literal |
| 33 | @category·Object | 36 | @category·Object |
| 34 | */ | 37 | */ |
| 35 | export·type·SnakeCasedProperties< | 38 | export·type·SnakeCasedProperties< |
| Offset 1, 11 lines modified | Offset 1, 12 lines modified | ||
| 1 | import·type·{ | 1 | import·type·{ReverseSign}·from·'./internal/index.d.ts'; |
| 2 | import·type·{PositiveInfinity,·NegativeInfinity,·IsNegative}·from·'./numeric.d.ts'; | 2 | import·type·{PositiveInfinity,·NegativeInfinity,·IsNegative}·from·'./numeric.d.ts'; |
| 3 | import·type·{LessThan}·from·'./less-than.d.ts'; | 3 | import·type·{LessThan}·from·'./less-than.d.ts'; |
| 4 | import·type·{TupleOf}·from·'./tuple-of.d.ts'; | 4 | import·type·{TupleOf}·from·'./tuple-of.d.ts'; |
| 5 | import·type·{Absolute}·from·'./absolute.d.ts'; | ||
| 5 | /** | 6 | /** |
| 6 | Returns·the·difference·between·two·numbers. | 7 | Returns·the·difference·between·two·numbers. |
| 7 | Note: | 8 | Note: |
| 8 | -·A·or·B·can·only·support·`-999`·~·`999`. | 9 | -·A·or·B·can·only·support·`-999`·~·`999`. |
| Offset 55, 17 lines modified | Offset 56, 17 lines modified | ||
| 55 | Subtracts·two·numbers·A·and·B,·such·that·they·are·not·equal·and·neither·of·them·are·0,·+/-·infinity·or·the·`number`·type | 56 | Subtracts·two·numbers·A·and·B,·such·that·they·are·not·equal·and·neither·of·them·are·0,·+/-·infinity·or·the·`number`·type |
| 56 | */ | 57 | */ |
| 57 | type·SubtractPostChecks<A·extends·number,·B·extends·number,·AreNegative·=·[IsNegative<A>,·IsNegative<B>]>·= | 58 | type·SubtractPostChecks<A·extends·number,·B·extends·number,·AreNegative·=·[IsNegative<A>,·IsNegative<B>]>·= |
| 58 | » AreNegative·extends·[false,·false] | 59 | » AreNegative·extends·[false,·false] |
| 59 | » » ?·SubtractPositives<A,·B> | 60 | » » ?·SubtractPositives<A,·B> |
| 60 | » » :·AreNegative·extends·[true,·true] | 61 | » » :·AreNegative·extends·[true,·true] |
| 61 | » » » //·When·both·numbers·are·negative·we·subtract·the·absolute·values·and·then·reverse·the·sign | 62 | » » » //·When·both·numbers·are·negative·we·subtract·the·absolute·values·and·then·reverse·the·sign |
| 62 | » » » ?·ReverseSign<SubtractPositives< | 63 | » » » ?·ReverseSign<SubtractPositives<Absolute<A>,·Absolute<B>>> |
| 63 | » » » //·When·the·signs·are·different·we·can·add·the·absolute·values·and·then·reverse·the·sign·if·A·<·B | 64 | » » » //·When·the·signs·are·different·we·can·add·the·absolute·values·and·then·reverse·the·sign·if·A·<·B |
| 64 | » » » :·[...TupleOf< | 65 | » » » :·[...TupleOf<Absolute<A>>,·...TupleOf<Absolute<B>>]·extends·infer·R·extends·unknown[] |
| 65 | » » » » ?·LessThan<A,·B>·extends·true·?·ReverseSign<R['length']>·:·R['length'] | 66 | » » » » ?·LessThan<A,·B>·extends·true·?·ReverseSign<R['length']>·:·R['length'] |
| 66 | » » » » :·never; | 67 | » » » » :·never; |
| 67 | /** | 68 | /** |
| 68 | Subtracts·two·positive·numbers. | 69 | Subtracts·two·positive·numbers. |
| 69 | */ | 70 | */ |
| 70 | type·SubtractPositives<A·extends·number,·B·extends·number>·= | 71 | type·SubtractPositives<A·extends·number,·B·extends·number>·= |
| Offset 1, 11 lines modified | Offset 1, 12 lines modified | ||
| 1 | import·type·{TupleOf}·from·'./tuple-of.d.ts'; | 1 | import·type·{TupleOf}·from·'./tuple-of.d.ts'; |
| 2 | import·type·{ | 2 | import·type·{TupleMax,·ReverseSign}·from·'./internal/index.d.ts'; |
| 3 | import·type·{PositiveInfinity,·NegativeInfinity,·IsNegative}·from·'./numeric.d.ts'; | 3 | import·type·{PositiveInfinity,·NegativeInfinity,·IsNegative}·from·'./numeric.d.ts'; |
| 4 | import·type·{Subtract}·from·'./subtract.d.ts'; | 4 | import·type·{Subtract}·from·'./subtract.d.ts'; |
| 5 | import·type·{Absolute}·from·'./absolute.d.ts'; | ||
| 5 | /** | 6 | /** |
| 6 | Returns·the·sum·of·two·numbers. | 7 | Returns·the·sum·of·two·numbers. |
| 7 | Note: | 8 | Note: |
| 8 | -·A·or·B·can·only·support·`-999`·~·`999`. | 9 | -·A·or·B·can·only·support·`-999`·~·`999`. |
| Offset 53, 19 lines modified | Offset 54, 19 lines modified | ||
| 53 | */ | 54 | */ |
| 54 | type·SumPostChecks<A·extends·number,·B·extends·number,·AreNegative·=·[IsNegative<A>,·IsNegative<B>]>·= | 55 | type·SumPostChecks<A·extends·number,·B·extends·number,·AreNegative·=·[IsNegative<A>,·IsNegative<B>]>·= |
| 55 | » AreNegative·extends·[false,·false] | 56 | » AreNegative·extends·[false,·false] |
| 56 | » » //·When·both·numbers·are·positive·we·can·add·them·together | 57 | » » //·When·both·numbers·are·positive·we·can·add·them·together |
| 57 | » » ?·SumPositives<A,·B> | 58 | » » ?·SumPositives<A,·B> |
| 58 | » » :·AreNegative·extends·[true,·true] | 59 | » » :·AreNegative·extends·[true,·true] |
| 59 | » » » //·When·both·numbers·are·negative·we·add·the·absolute·values·and·then·reverse·the·sign | 60 | » » » //·When·both·numbers·are·negative·we·add·the·absolute·values·and·then·reverse·the·sign |
| 60 | » » » ?·ReverseSign<SumPositives< | 61 | » » » ?·ReverseSign<SumPositives<Absolute<A>,·Absolute<B>>> |
| 61 | » » » //·When·the·signs·are·different·we·can·subtract·the·absolute·values,·remove·the·sign | 62 | » » » //·When·the·signs·are·different·we·can·subtract·the·absolute·values,·remove·the·sign |
| 62 | » » » //·and·then·reverse·the·sign·if·the·larger·absolute·value·is·negative | 63 | » » » //·and·then·reverse·the·sign·if·the·larger·absolute·value·is·negative |
| 63 | » » » :· | 64 | » » » :·Absolute<Subtract<Absolute<A>,·Absolute<B>>>·extends·infer·Result·extends·number |
| 64 | » » » » ?·TupleMax<[ | 65 | » » » » ?·TupleMax<[Absolute<A>,·Absolute<B>]>·extends·infer·Max_·extends·number |
| 65 | » » » » » ?·Max_·extends·A·|·B | 66 | » » » » » ?·Max_·extends·A·|·B |
| 66 | » » » » » » //·The·larger·absolute·value·is·positive,·so·the·result·is·positive | 67 | » » » » » » //·The·larger·absolute·value·is·positive,·so·the·result·is·positive |
| 67 | » » » » » » ?·Result | 68 | » » » » » » ?·Result |
| 68 | » » » » » » //·The·larger·absolute·value·is·negative,·so·the·result·is·negative | 69 | » » » » » » //·The·larger·absolute·value·is·negative,·so·the·result·is·negative |
| 69 | » » » » » » :·ReverseSign<Result> | 70 | » » » » » » :·ReverseSign<Result> |
| 70 | » » » » » :·never | 71 | » » » » » :·never |
| 71 | » » » » :·never; | 72 | » » » » :·never; |
| Offset 4, 20 lines modified | Offset 4, 18 lines modified | ||
| 4 | export·type·TagContainer<Token>·=·{ | 4 | export·type·TagContainer<Token>·=·{ |
| 5 | » readonly·[tag]:·Token; | 5 | » readonly·[tag]:·Token; |
| 6 | }; | 6 | }; |
| 7 | type·Tag<Token·extends·PropertyKey,·TagMetadata>·=·TagContainer<{[K·in·Token]:·TagMetadata}>; | 7 | type·Tag<Token·extends·PropertyKey,·TagMetadata>·=·TagContainer<{[K·in·Token]:·TagMetadata}>; |
| 8 | /** | 8 | /** |
| 9 | 9 | Create·a·[tagged·type](https://medium.com/@KevinBGreene/surviving-the-typescript-ecosystem-branding-and-type-tagging-6cf6e516523d)·that·can·support·[multiple·tags](https://github.com/sindresorhus/type-fest/issues/665)·and·[per-tag·metadata](https://medium.[·...·truncated·by·diffoscope;·len:·99,·SHA:·3fd8c7a5ebcae5c18ca9e42cbf2316354997c57f4e24714709786008b221556b·...·] | |
| 10 | A·type·returned·by·`Tagged`·can·be·passed·to·`Tagged`·again,·to·create·a·type·with·multiple·tags. | 10 | A·type·returned·by·`Tagged`·can·be·passed·to·`Tagged`·again,·to·create·a·type·with·multiple·tags. |
| 11 | [Read·more·about·tagged·types.](https://medium.com/@KevinBGreene/surviving-the-typescript-ecosystem-branding-and-type-tagging-6cf6e516523d) | ||
| 12 | A·tag's·name·is·usually·a·string·(and·must·be·a·string,·number,·or·symbol),·but·each·application·of·a·tag·can·also·contain·an·arbitrary·type·as·its·"metadata".·See·{@link·GetTagMetadata}·for·examples·and·explanation. | 11 | A·tag's·name·is·usually·a·string·(and·must·be·a·string,·number,·or·symbol),·but·each·application·of·a·tag·can·also·contain·an·arbitrary·type·as·its·"metadata".·See·{@link·GetTagMetadata}·for·examples·and·explanation. |
| 13 | A·type·`A`·returned·by·`Tagged`·is·assignable·to·another·type·`B`·returned·by·`Tagged`·if·and·only·if: | 12 | A·type·`A`·returned·by·`Tagged`·is·assignable·to·another·type·`B`·returned·by·`Tagged`·if·and·only·if: |
| 14 | ··-·the·underlying·(untagged)·type·of·`A`·is·assignable·to·the·underlying·type·of·`B`; | 13 | ··-·the·underlying·(untagged)·type·of·`A`·is·assignable·to·the·underlying·type·of·`B`; |
| 15 | » -·`A`·contains·at·least·all·the·tags·`B`·has; | 14 | » -·`A`·contains·at·least·all·the·tags·`B`·has; |
| 16 | » -·and·the·metadata·type·for·each·of·`A`'s·tags·is·assignable·to·the·metadata·type·of·`B`'s·corresponding·tag. | 15 | » -·and·the·metadata·type·for·each·of·`A`'s·tags·is·assignable·to·the·metadata·type·of·`B`'s·corresponding·tag. |
| Offset 96, 15 lines modified | Offset 94, 15 lines modified | ||
| 96 | ``` | 94 | ``` |
| 97 | @category·Type | 95 | @category·Type |
| 98 | */ | 96 | */ |
| 99 | export·type·GetTagMetadata<Type·extends·Tag<TagName,·unknown>,·TagName·extends·PropertyKey>·=·Type[typeof·tag][TagName]; | 97 | export·type·GetTagMetadata<Type·extends·Tag<TagName,·unknown>,·TagName·extends·PropertyKey>·=·Type[typeof·tag][TagName]; |
| 100 | /** | 98 | /** |
| 101 | 99 | Get·the·untagged·portion·of·a·tagged·type·created·with·`Tagged`. | |
| 102 | Why·is·this·necessary? | 100 | Why·is·this·necessary? |
| 103 | 1.·Use·a·`Tagged`·type·as·object·keys | 101 | 1.·Use·a·`Tagged`·type·as·object·keys |
| 104 | 2.·Prevent·TS4058·error:·"Return·type·of·exported·function·has·or·is·using·name·X·from·external·module·Y·but·cannot·be·named" | 102 | 2.·Prevent·TS4058·error:·"Return·type·of·exported·function·has·or·is·using·name·X·from·external·module·Y·but·cannot·be·named" |
| 105 | @example | 103 | @example |
| Offset 125, 15 lines modified | Offset 123, 15 lines modified | ||
| 125 | //·@ts-expect-error | 123 | //·@ts-expect-error |
| 126 | type·WontWork·=·UnwrapTagged<string>; | 124 | type·WontWork·=·UnwrapTagged<string>; |
| 127 | ``` | 125 | ``` |
| 128 | @category·Type | 126 | @category·Type |
| 129 | */ | 127 | */ |
| 130 | export·type·UnwrapTagged<TaggedType·extends·Tag<PropertyKey,·any>>·= | 128 | export·type·UnwrapTagged<TaggedType·extends·Tag<PropertyKey,·any>>·= |
| 131 | RemoveAllTags<TaggedType>; | 129 | » RemoveAllTags<TaggedType>; |
| 132 | type·RemoveAllTags<T>·=·T·extends·Tag<PropertyKey,·any> | 130 | type·RemoveAllTags<T>·=·T·extends·Tag<PropertyKey,·any> |
| 133 | » ?·{ | 131 | » ?·{ |
| 134 | » » [ThisTag·in·keyof·T[typeof·tag]]:·T·extends·Tagged<infer·Type,·ThisTag,·T[typeof·tag][ThisTag]> | 132 | » » [ThisTag·in·keyof·T[typeof·tag]]:·T·extends·Tagged<infer·Type,·ThisTag,·T[typeof·tag][ThisTag]> |
| 135 | » » » ?·RemoveAllTags<Type> | 133 | » » » ?·RemoveAllTags<Type> |
| 136 | » » » :·never | 134 | » » » :·never |
| 137 | » }[keyof·T[typeof·tag]] | 135 | » }[keyof·T[typeof·tag]] |
| Offset 57, 14 lines modified | Offset 57, 15 lines modified | ||
| 57 | » » » |·'ES2018' | 57 | » » » |·'ES2018' |
| 58 | » » » |·'ES2019' | 58 | » » » |·'ES2019' |
| 59 | » » » |·'ES2020' | 59 | » » » |·'ES2020' |
| 60 | » » » |·'ES2021' | 60 | » » » |·'ES2021' |
| 61 | » » » |·'ES2022' | 61 | » » » |·'ES2022' |
| 62 | » » » |·'ES2023' | 62 | » » » |·'ES2023' |
| 63 | » » » |·'ES2024' | 63 | » » » |·'ES2024' |
| 64 | » » » |·'ES2025' | ||
| 64 | » » » |·'ESNext' | 65 | » » » |·'ESNext' |
| 65 | » » » //·Lowercase·alternatives | 66 | » » » //·Lowercase·alternatives |
| 66 | » » » |·'es3' | 67 | » » » |·'es3' |
| 67 | » » » |·'es5' | 68 | » » » |·'es5' |
| 68 | » » » |·'es6' | 69 | » » » |·'es6' |
| 69 | » » » |·'es2015' | 70 | » » » |·'es2015' |
| 70 | » » » |·'es2016' | 71 | » » » |·'es2016' |
| Offset 72, 14 lines modified | Offset 73, 15 lines modified | ||
| 72 | » » » |·'es2018' | 73 | » » » |·'es2018' |
| 73 | » » » |·'es2019' | 74 | » » » |·'es2019' |
| 74 | » » » |·'es2020' | 75 | » » » |·'es2020' |
| 75 | » » » |·'es2021' | 76 | » » » |·'es2021' |
| 76 | » » » |·'es2022' | 77 | » » » |·'es2022' |
| 77 | » » » |·'es2023' | 78 | » » » |·'es2023' |
| 78 | » » » |·'es2024' | 79 | » » » |·'es2024' |
| 80 | » » » |·'es2025' | ||
| 79 | » » » |·'esnext'; | 81 | » » » |·'esnext'; |
| 80 | » » type·Lib·= | 82 | » » type·Lib·= |
| 81 | » » » |·'ES5' | 83 | » » » |·'ES5' |
| 82 | » » » |·'ES6' | 84 | » » » |·'ES6' |
| 83 | » » » |·'ES7' | 85 | » » » |·'ES7' |
| 84 | » » » |·'ES2015' | 86 | » » » |·'ES2015' |
| Offset 144, 29 lines modified | Offset 146, 38 lines modified | ||
| 144 | » » » |·'ES2024.ArrayBuffer' | 146 | » » » |·'ES2024.ArrayBuffer' |
| 145 | » » » |·'ES2024.Collection' | 147 | » » » |·'ES2024.Collection' |
| 146 | » » » |·'ES2024.Object' | 148 | » » » |·'ES2024.Object' |
| 147 | » » » |·'ES2024.Promise' | 149 | » » » |·'ES2024.Promise' |
| 148 | » » » |·'ES2024.Regexp' | 150 | » » » |·'ES2024.Regexp' |
| 149 | » » » |·'ES2024.SharedMemory' | 151 | » » » |·'ES2024.SharedMemory' |
| 150 | » » » |·'ES2024.String' | 152 | » » » |·'ES2024.String' |
| 153 | » » » |·'ES2025' | ||
| 154 | » » » |·'ES2025.Collection' | ||
| 155 | » » » |·'ES2025.Float16' | ||
| 156 | » » » |·'ES2025.Intl' | ||
| 157 | » » » |·'ES2025.Iterator' | ||
| 158 | » » » |·'ES2025.Promise' | ||
| 159 | » » » |·'ES2025.RegExp' | ||
| 151 | » » » |·'ESNext' | 160 | » » » |·'ESNext' |
| 152 | » » » |·'ESNext.Array' | 161 | » » » |·'ESNext.Array' |
| 153 | » » » |·'ESNext.AsyncIterable' | 162 | » » » |·'ESNext.AsyncIterable' |
| 154 | » » » |·'ESNext.BigInt' | 163 | » » » |·'ESNext.BigInt' |
| 155 | » » » |·'ESNext.Collection' | 164 | » » » |·'ESNext.Collection' |
| 156 | » » » |·'ESNext.Decorators' | 165 | » » » |·'ESNext.Decorators' |
| 157 | » » » |·'ESNext.Disposable' | 166 | » » » |·'ESNext.Disposable' |
| 158 | » » » |·'ESNext.Error' | 167 | » » » |·'ESNext.Error' |
| 168 | » » » |·'ESNext.Float16' | ||
| 159 | » » » |·'ESNext.Intl' | 169 | » » » |·'ESNext.Intl' |
| 160 | » » » |·'ESNext.Iterator' | 170 | » » » |·'ESNext.Iterator' |
| 161 | » » » |·'ESNext.Object' | 171 | » » » |·'ESNext.Object' |
| 162 | » » » |·'ESNext.Promise' | 172 | » » » |·'ESNext.Promise' |
| 163 | » » » |·'ESNext.Regexp' | 173 | » » » |·'ESNext.Regexp' |
| 164 | » » » |·'ESNext.String' | 174 | » » » |·'ESNext.String' |
| 165 | » » » |·'ESNext.Symbol' | 175 | » » » |·'ESNext.Symbol' |
| 176 | » » » |·'ESNext.Temporal' | ||
| 166 | » » » |·'ESNext.WeakRef' | 177 | » » » |·'ESNext.WeakRef' |
| 167 | » » » |·'DOM' | 178 | » » » |·'DOM' |
| 168 | » » » |·'DOM.AsyncIterable' | 179 | » » » |·'DOM.AsyncIterable' |
| 169 | » » » |·'DOM.Iterable' | 180 | » » » |·'DOM.Iterable' |
| 170 | » » » |·'Decorators' | 181 | » » » |·'Decorators' |
| 171 | » » » |·'Decorators.Legacy' | 182 | » » » |·'Decorators.Legacy' |
| 172 | » » » |·'ScriptHost' | 183 | » » » |·'ScriptHost' |
| Offset 240, 29 lines modified | Offset 251, 38 lines modified | ||
| 240 | » » » |·'es2024.arraybuffer' | 251 | » » » |·'es2024.arraybuffer' |
| 241 | » » » |·'es2024.collection' | 252 | » » » |·'es2024.collection' |
| 242 | » » » |·'es2024.object' | 253 | » » » |·'es2024.object' |
| 243 | » » » |·'es2024.promise' | 254 | » » » |·'es2024.promise' |
| 244 | » » » |·'es2024.regexp' | 255 | » » » |·'es2024.regexp' |
| 245 | » » » |·'es2024.sharedmemory' | 256 | » » » |·'es2024.sharedmemory' |
| 246 | » » » |·'es2024.string' | 257 | » » » |·'es2024.string' |
| 258 | » » » |·'es2025' | ||
| 259 | » » » |·'es2025.collection' | ||
| 260 | » » » |·'es2025.float16' | ||
| 261 | » » » |·'es2025.intl' | ||
| 262 | » » » |·'es2025.iterator' | ||
| 263 | » » » |·'es2025.promise' | ||
| 264 | » » » |·'es2025.regexp' | ||
| 247 | » » » |·'esnext' | 265 | » » » |·'esnext' |
| 248 | » » » |·'esnext.array' | 266 | » » » |·'esnext.array' |
| 249 | » » » |·'esnext.asynciterable' | 267 | » » » |·'esnext.asynciterable' |
| 250 | » » » |·'esnext.bigint' | 268 | » » » |·'esnext.bigint' |
| 251 | » » » |·'esnext.collection' | 269 | » » » |·'esnext.collection' |
| 252 | » » » |·'esnext.decorators' | 270 | » » » |·'esnext.decorators' |
| 253 | » » » |·'esnext.disposable' | 271 | » » » |·'esnext.disposable' |
| 254 | » » » |·'esnext.error' | 272 | » » » |·'esnext.error' |
| 273 | » » » |·'esnext.float16' | ||
| 255 | » » » |·'esnext.intl' | 274 | » » » |·'esnext.intl' |
| 256 | » » » |·'esnext.iterator' | 275 | » » » |·'esnext.iterator' |
| 257 | » » » |·'esnext.object' | 276 | » » » |·'esnext.object' |
| 258 | » » » |·'esnext.promise' | 277 | » » » |·'esnext.promise' |
| 259 | » » » |·'esnext.regexp' | 278 | » » » |·'esnext.regexp' |
| Max diff block lines reached; 4334/6374 bytes (67.99%) of diff not shown. | |||
| Offset 1, 9 lines modified | Offset 1, 9 lines modified | ||
| 1 | /** | 1 | /** |
| 2 | Convert·a·union·type·to·an·intersection·type | 2 | Convert·a·union·type·to·an·intersection·type. |
| 3 | Inspired·by·[this·Stack·Overflow·answer](https://stackoverflow.com/a/50375286/2172153). | 3 | Inspired·by·[this·Stack·Overflow·answer](https://stackoverflow.com/a/50375286/2172153). |
| 4 | @example | 4 | @example |
| 5 | ``` | 5 | ``` |
| 6 | import·type·{UnionToIntersection}·from·'type-fest'; | 6 | import·type·{UnionToIntersection}·from·'type-fest'; |
| Offset 1, 10 lines modified | Offset 1, 11 lines modified | ||
| 1 | import·type·{ExcludeExactly}·from·'./exclude-exactly.d.ts'; | 1 | import·type·{ExcludeExactly}·from·'./exclude-exactly.d.ts'; |
| 2 | import·type·{IsNever}·from·'./is-never.d.ts'; | 2 | import·type·{IsNever}·from·'./is-never.d.ts'; |
| 3 | import·type·{UnionMember}·from·'./union-member.d.ts'; | 3 | import·type·{UnionMember}·from·'./union-member.d.ts'; |
| 4 | import·type·{UnknownArray}·from·'./unknown-array.d.ts'; | ||
| 4 | /** | 5 | /** |
| 5 | Convert·a·union·type·into·an·unordered·tuple·type·of·its·elements. | 6 | Convert·a·union·type·into·an·unordered·tuple·type·of·its·elements. |
| 6 | "Unordered"·means·the·elements·of·the·tuple·are·not·guaranteed·to·be·in·the·same·order·as·in·the·union·type.·The·arrangement·can·appear·random·and·may·change·at·any·time. | 7 | "Unordered"·means·the·elements·of·the·tuple·are·not·guaranteed·to·be·in·the·same·order·as·in·the·union·type.·The·arrangement·can·appear·random·and·may·change·at·any·time. |
| 7 | This·can·be·useful·when·you·have·objects·with·a·finite·set·of·keys·and·want·a·type·defining·only·the·allowed·keys,·but·do·not·want·to·repeat·yourself. | 8 | This·can·be·useful·when·you·have·objects·with·a·finite·set·of·keys·and·want·a·type·defining·only·the·allowed·keys,·but·do·not·want·to·repeat·yourself. |
| Offset 33, 13 lines modified | Offset 34, 16 lines modified | ||
| 33 | const·petList·=·Object.keys(pets)·as·UnionToTuple<Pet>; | 34 | const·petList·=·Object.keys(pets)·as·UnionToTuple<Pet>; |
| 34 | //=>·['dog',·'cat',·'snake'] | 35 | //=>·['dog',·'cat',·'snake'] |
| 35 | ``` | 36 | ``` |
| 36 | @category·Array | 37 | @category·Array |
| 37 | */ | 38 | */ |
| 38 | export·type·UnionToTuple< | 39 | export·type·UnionToTuple<Union>·= |
| 39 | IsNever<T>·extends·false | ||
| 40 | » ?·[...UnionToTuple<ExcludeExactly<T,·L>>,·L] | ||
| 41 | » :· | 40 | » _UnionToTuple<Union>·extends·infer·Result·extends·UnknownArray·?·Result·:·never;·//·Nudges·the·compiler·that·`UnionToTuple`·always·yields·an·array. |
| 41 | type·_UnionToTuple<Union,·Accumulator·extends·UnknownArray·=·[],·Member·=·UnionMember<Union>>·= | ||
| 42 | » IsNever<Union>·extends·true | ||
| 43 | » » ?·Accumulator | ||
| 44 | » » :·_UnionToTuple<ExcludeExactly<Union,·Member>,·[Member,·...Accumulator]>; | ||
| 42 | export·{}; | 45 | export·{}; |
| Offset 1, 9 lines modified | Offset 1, 10 lines modified | ||
| 1 | import·type·{ | 1 | import·type·{ |
| 2 | » ApplyDefaultOptions, | 2 | » ApplyDefaultOptions, |
| 3 | » AsciiPunctuation, | ||
| 3 | » IsNumeric, | 4 | » IsNumeric, |
| 4 | » WordSeparators, | 5 | » WordSeparators, |
| 5 | }·from·'./internal/index.d.ts'; | 6 | }·from·'./internal/index.d.ts'; |
| 6 | import·type·{IsLowercase}·from·'./is-lowercase.d.ts'; | 7 | import·type·{IsLowercase}·from·'./is-lowercase.d.ts'; |
| 7 | import·type·{IsUppercase}·from·'./is-uppercase.d.ts'; | 8 | import·type·{IsUppercase}·from·'./is-uppercase.d.ts'; |
| 8 | type·SkipEmptyWord<Word·extends·string>·=·Word·extends·''·?·[]·:·[Word]; | 9 | type·SkipEmptyWord<Word·extends·string>·=·Word·extends·''·?·[]·:·[Word]; |
| Offset 34, 25 lines modified | Offset 35, 42 lines modified | ||
| 34 | » //=>·['p',·'2',·'p',·'Network'] | 35 | » //=>·['p',·'2',·'p',·'Network'] |
| 35 | » type·Example2·=·Words<'p2pNetwork',·{splitOnNumbers:·false}>; | 36 | » type·Example2·=·Words<'p2pNetwork',·{splitOnNumbers:·false}>; |
| 36 | » //=>·['p2p',·'Network'] | 37 | » //=>·['p2p',·'Network'] |
| 37 | » ``` | 38 | » ``` |
| 38 | » */ | 39 | » */ |
| 39 | » splitOnNumbers?:·boolean; | 40 | » splitOnNumbers?:·boolean; |
| 41 | » /** | ||
| 42 | » Split·on·{@link·AsciiPunctuation·|·punctuation·characters}·(e.g.,·`#`,·`&`,·`*`,·`:`,·`?`,·`@`,·`~`). | ||
| 43 | » @example | ||
| 44 | » ``` | ||
| 45 | » import·type·{Words}·from·'type-fest'; | ||
| 46 | » type·Example1·=·Words<'hello:world',·{splitOnPunctuation:·true}>; | ||
| 47 | » //=>·['hello',·'world'] | ||
| 48 | » type·Example2·=·Words<'hello:world',·{splitOnPunctuation:·false}>; | ||
| 49 | » //=>·['hello',·':world'] | ||
| 50 | » ``` | ||
| 51 | » */ | ||
| 52 | » splitOnPunctuation?:·boolean; | ||
| 40 | }; | 53 | }; |
| 41 | export·type·_DefaultWordsOptions·=·{ | 54 | export·type·_DefaultWordsOptions·=·{ |
| 42 | » splitOnNumbers:·true; | 55 | » splitOnNumbers:·true; |
| 56 | » splitOnPunctuation:·false; | ||
| 43 | }; | 57 | }; |
| 44 | /** | 58 | /** |
| 45 | Split·a·string· | 59 | Split·a·string·similar·to·Lodash's·`_.words()`·function. |
| 46 | -·Split·on·each·word·that·begins·with·a·capital·letter. | 60 | -·Split·on·each·word·that·begins·with·a·capital·letter. |
| 47 | -·Split·on·each·{@link·WordSeparators}. | 61 | -·Split·on·each·{@link·WordSeparators}. |
| 62 | -·Split·on·each·{@link·AsciiPunctuation}·(if·{@link·WordsOptions.splitOnPunctuation}·is·enabled). | ||
| 48 | -·Split·on·numeric·sequence. | 63 | -·Split·on·numeric·sequence. |
| 49 | @example | 64 | @example |
| 50 | ``` | 65 | ``` |
| 51 | import·type·{Words}·from·'type-fest'; | 66 | import·type·{Words}·from·'type-fest'; |
| 52 | type·Words0·=·Words<'helloWorld'>; | 67 | type·Words0·=·Words<'helloWorld'>; |
| Offset 68, 29 lines modified | Offset 86, 37 lines modified | ||
| 68 | //=>·['hello',·'the',·'world'] | 86 | //=>·['hello',·'the',·'world'] |
| 69 | type·Words4·=·Words<'lifeIs42'>; | 87 | type·Words4·=·Words<'lifeIs42'>; |
| 70 | //=>·['life',·'Is',·'42'] | 88 | //=>·['life',·'Is',·'42'] |
| 71 | type·Words5·=·Words<'p2pNetwork',·{splitOnNumbers:·false}>; | 89 | type·Words5·=·Words<'p2pNetwork',·{splitOnNumbers:·false}>; |
| 72 | //=>·['p2p',·'Network'] | 90 | //=>·['p2p',·'Network'] |
| 91 | type·Words6·=·Words<'hello:world',·{splitOnPunctuation:·true}>; | ||
| 92 | //=>·['hello',·'world'] | ||
| 93 | type·Words7·=·Words<'hello:world',·{splitOnPunctuation:·false}>; | ||
| 94 | //=>·['hello',·':world'] | ||
| 95 | type·Words8·=·Words<'hello::world',·{splitOnPunctuation:·true}>; | ||
| 96 | //=>·['hello',·'world'] | ||
| 73 | ``` | 97 | ``` |
| 74 | @category·Change·case | 98 | @category·Change·case |
| 75 | @category·Template·literal | 99 | @category·Template·literal |
| 76 | */ | 100 | */ |
| 101 | export·type·Words<Sentence·extends·string,·Options·extends·WordsOptions·=·{}>·=·WordsImplementation<Sentence,·ApplyDefaultOptions<WordsOptions,·_DefaultWordsOptions,·Options>>; | ||
| 77 | export·type·Words<Sentence·extends·string,·Options·extends·WordsOptions·=·{}>·= | ||
| 78 | » WordsImplementation<Sentence,·ApplyDefaultOptions<WordsOptions,·_DefaultWordsOptions,·Options>>; | ||
| 79 | type·WordsImplementation< | 102 | type·WordsImplementation< |
| 80 | » Sentence·extends·string, | 103 | » Sentence·extends·string, |
| 81 | » Options·extends·Required<WordsOptions>, | 104 | » Options·extends·Required<WordsOptions>, |
| 82 | » LastCharacter·extends·string·=·'', | 105 | » LastCharacter·extends·string·=·'', |
| 83 | » CurrentWord·extends·string·=·'', | 106 | » CurrentWord·extends·string·=·'', |
| 84 | >·=·Sentence·extends·`${infer·FirstCharacter}${infer·RemainingCharacters}` | 107 | >·=·Sentence·extends·`${infer·FirstCharacter}${infer·RemainingCharacters}` |
| 85 | » ?·FirstCharacter·extends·WordSeparators | 108 | » ?·FirstCharacter·extends·WordSeparators·|·(Options['splitOnPunctuation']·extends·true·?·AsciiPunctuation·:·never) |
| 86 | » » //·Skip·word·separator | 109 | » » //·Skip·word·separator |
| 87 | » » ?·[...SkipEmptyWord<CurrentWord>,·...WordsImplementation<RemainingCharacters,·Options>] | 110 | » » ?·[...SkipEmptyWord<CurrentWord>,·...WordsImplementation<RemainingCharacters,·Options>] |
| 88 | » » :·LastCharacter·extends·'' | 111 | » » :·LastCharacter·extends·'' |
| 89 | » » » //·Fist·char·of·word | 112 | » » » //·Fist·char·of·word |
| 90 | » » » ?·WordsImplementation<RemainingCharacters,·Options,·FirstCharacter,·FirstCharacter> | 113 | » » » ?·WordsImplementation<RemainingCharacters,·Options,·FirstCharacter,·FirstCharacter> |
| 91 | » » » //·Case·change:·non-numeric·to·numeric | 114 | » » » //·Case·change:·non-numeric·to·numeric |
| 92 | » » » :·[false,·true]·extends·[IsNumeric<LastCharacter>,·IsNumeric<FirstCharacter>] | 115 | » » » :·[false,·true]·extends·[IsNumeric<LastCharacter>,·IsNumeric<FirstCharacter>] |
| Offset 46, 23 lines modified | Offset 46, 23 lines modified | ||
| 46 | const·writableArray:·Writable<typeof·readonlyArray>·=·readonlyArray·as·Writable<typeof·readonlyArray>; | 46 | const·writableArray:·Writable<typeof·readonlyArray>·=·readonlyArray·as·Writable<typeof·readonlyArray>; |
| 47 | writableArray.push(4);·//·Will·work·as·the·array·itself·is·now·writable. | 47 | writableArray.push(4);·//·Will·work·as·the·array·itself·is·now·writable. |
| 48 | ``` | 48 | ``` |
| 49 | @category·Object | 49 | @category·Object |
| 50 | */ | 50 | */ |
| 51 | export·type·Writable<BaseType,·Keys·extends·keyof·BaseType·=·keyof·BaseType>·= | 51 | export·type·Writable<BaseType,·Keys·extends·keyof·BaseType·=·keyof·BaseType>·= |
| 52 | BaseType·extends·ReadonlyMap<infer·KeyType,·infer·ValueType> | 52 | » BaseType·extends·ReadonlyMap<infer·KeyType,·infer·ValueType> |
| 53 | » ?·Map<KeyType,·ValueType> | 53 | » » ?·Map<KeyType,·ValueType> |
| 54 | » :·BaseType·extends·ReadonlySet<infer·ItemType> | 54 | » » :·BaseType·extends·ReadonlySet<infer·ItemType> |
| 55 | » » ?·Set<ItemType> | 55 | » » » ?·Set<ItemType> |
| 56 | » » :·BaseType·extends·readonly·unknown[] | 56 | » » » :·BaseType·extends·readonly·unknown[] |
| 57 | » » » //·Handle·array | 57 | » » » » //·Handle·array |
| 58 | » » » ?·WritableArray<BaseType> | 58 | » » » » ?·WritableArray<BaseType> |
| 59 | » » » //·Handle·object | 59 | » » » » //·Handle·object |
| 60 | » » » :·Simplify< | 60 | » » » » :·Simplify< |
| 61 | » » » //·Pick·just·the·keys·that·are·not·writable·from·the·base·type. | 61 | » » » » » //·Pick·just·the·keys·that·are·not·writable·from·the·base·type. |
| 62 | » » » » Except<BaseType,·Keys> | 62 | » » » » » Except<BaseType,·Keys> |
| 63 | » » » //·Pick·the·keys·that·should·be·writable·from·the·base·type·and·make·them·writable·by·removing·the·`readonly`·modifier·from·the·key. | 63 | » » » » » //·Pick·the·keys·that·should·be·writable·from·the·base·type·and·make·them·writable·by·removing·the·`readonly`·modifier·from·the·key. |
| 64 | » » » » {-readonly·[KeyType·in·keyof·Pick<BaseType,·Keys>]:·Pick<BaseType,·Keys>[KeyType]} | 64 | » » » » » &·{-readonly·[KeyType·in·keyof·Pick<BaseType,·Keys>]:·Pick<BaseType,·Keys>[KeyType]} |
| 65 | » » » >; | 65 | » » » » >; |
| 66 | export·{}; | 66 | export·{}; |
| Offset 1, 13 lines modified | Offset 1, 13 lines modified | ||
| 1 | import·type·{Not}·from·'./internal/type.d.ts'; | 1 | import·type·{Not}·from·'./internal/type.d.ts'; |
| 2 | import·type·{And}·from·'./and.d.ts'; | 2 | import·type·{And}·from·'./and.d.ts'; |
| 3 | import·type·{Or}·from·'./or.d.ts'; | 3 | import·type·{Or}·from·'./or.d.ts'; |
| 4 | /** | 4 | /** |
| 5 | Returns·a·boolean·for·whether·only·one·of·two·given·types·is·true. | 5 | Returns·a·boolean·for·whether·only·one·of·two·given·types·is·`true`. |
| 6 | Use-case:·Constructing·complex·conditional·types·where·one·single·condition·must·be·satisfied. | 6 | Use-case:·Constructing·complex·conditional·types·where·one·single·condition·must·be·satisfied. |
| 7 | @example | 7 | @example |
| 8 | ``` | 8 | ``` |
| 9 | import·type·{Xor}·from·'type-fest'; | 9 | import·type·{Xor}·from·'type-fest'; |
| Offset 1, 12 lines modified | Offset 1, 12 lines modified | ||
| 1 | -rw-r--r--···0········0········0······509·2026-04-12·10:15:14.000000·info/about.json | 1 | -rw-r--r--···0········0········0······509·2026-04-12·10:15:14.000000·info/about.json |
| 2 | -rw-r--r--···0········0········0······118·2026-04-12·10:15:14.000000·info/hash_input.json | 2 | -rw-r--r--···0········0········0······118·2026-04-12·10:15:14.000000·info/hash_input.json |
| 3 | -rw-r--r--···0········0········0······224·2026-04-12·10:15:14.000000·info/index.json | 3 | -rw-r--r--···0········0········0······224·2026-04-12·10:15:14.000000·info/index.json |
| 4 | -rw-r--r--···0········0········0·····1085·2026-04-12·10:15:14.000000·info/licenses/LICENSE | 4 | -rw-r--r--···0········0········0·····1085·2026-04-12·10:15:14.000000·info/licenses/LICENSE |
| 5 | -rw-r--r--···0········0········0···23 | 5 | -rw-r--r--···0········0········0···232554·2026-04-12·10:15:14.000000·info/licenses/third-party-licenses.txt |
| 6 | -rw-r--r--···0········0········0···98 | 6 | -rw-r--r--···0········0········0···986947·2026-04-12·10:15:14.000000·info/paths.json |
| 7 | -rwxr-xr-x···0········0········0······745·2026-04-12·10:15:14.000000·info/recipe/build.sh | 7 | -rwxr-xr-x···0········0········0······745·2026-04-12·10:15:14.000000·info/recipe/build.sh |
| 8 | -rw-r--r--···0········0········0·····1520·2026-04-12·10:15:14.000000·info/recipe/recipe-scripts-license.txt | 8 | -rw-r--r--···0········0········0·····1520·2026-04-12·10:15:14.000000·info/recipe/recipe-scripts-license.txt |
| 9 | -rw-r--r--···0········0········0······727·2026-04-12·10:15:14.000000·info/recipe/recipe.yaml | 9 | -rw-r--r--···0········0········0······727·2026-04-12·10:15:14.000000·info/recipe/recipe.yaml |
| 10 | -rw-r--r--···0········0········0····10938·2026-04-12·10:15:14.000000·info/recipe/rendered_recipe.yaml | 10 | -rw-r--r--···0········0········0····10938·2026-04-12·10:15:14.000000·info/recipe/rendered_recipe.yaml |
| 11 | -rw-r--r--···0········0········0······100·2026-04-12·10:15:14.000000·info/recipe/variant_config.yaml | 11 | -rw-r--r--···0········0········0······100·2026-04-12·10:15:14.000000·info/recipe/variant_config.yaml |
| 12 | -rw-r--r--···0········0········0·······42·2026-04-12·10:15:14.000000·info/tests/tests.yaml | 12 | -rw-r--r--···0········0········0·······42·2026-04-12·10:15:14.000000·info/tests/tests.yaml |
| Offset 111, 15 lines modified | Offset 111, 15 lines modified | ||
| 111 | AUTHORS·OR·COPYRIGHT·HOLDERS·BE·LIABLE·FOR·ANY·CLAIM,·DAMAGES·OR·OTHER | 111 | AUTHORS·OR·COPYRIGHT·HOLDERS·BE·LIABLE·FOR·ANY·CLAIM,·DAMAGES·OR·OTHER |
| 112 | LIABILITY,·WHETHER·IN·AN·ACTION·OF·CONTRACT,·TORT·OR·OTHERWISE,·ARISING·FROM, | 112 | LIABILITY,·WHETHER·IN·AN·ACTION·OF·CONTRACT,·TORT·OR·OTHERWISE,·ARISING·FROM, |
| 113 | OUT·OF·OR·IN·CONNECTION·WITH·THE·SOFTWARE·OR·THE·USE·OR·OTHER·DEALINGS·IN·THE | 113 | OUT·OF·OR·IN·CONNECTION·WITH·THE·SOFTWARE·OR·THE·USE·OR·OTHER·DEALINGS·IN·THE |
| 114 | SOFTWARE. | 114 | SOFTWARE. |
| 115 | --- | 115 | --- |
| 116 | The·following·software·may·be·included·in·this·product:·@cucumber/cucumber·(12.8. | 116 | The·following·software·may·be·included·in·this·product:·@cucumber/cucumber·(12.8.1) |
| 117 | This·software·contains·the·following·license·and·notice·below: | 117 | This·software·contains·the·following·license·and·notice·below: |
| 118 | MIT·License | 118 | MIT·License |
| 119 | Copyright·(c)·Julien·Biezemans·and·contributors | 119 | Copyright·(c)·Julien·Biezemans·and·contributors |
| 120 | Permission·is·hereby·granted,·free·of·charge,·to·any·person·obtaining·a·copy | 120 | Permission·is·hereby·granted,·free·of·charge,·to·any·person·obtaining·a·copy |
| Offset 297, 14 lines modified | Offset 297, 41 lines modified | ||
| 297 | AUTHORS·OR·COPYRIGHT·HOLDERS·BE·LIABLE·FOR·ANY·CLAIM,·DAMAGES·OR·OTHER | 297 | AUTHORS·OR·COPYRIGHT·HOLDERS·BE·LIABLE·FOR·ANY·CLAIM,·DAMAGES·OR·OTHER |
| 298 | LIABILITY,·WHETHER·IN·AN·ACTION·OF·CONTRACT,·TORT·OR·OTHERWISE,·ARISING·FROM, | 298 | LIABILITY,·WHETHER·IN·AN·ACTION·OF·CONTRACT,·TORT·OR·OTHERWISE,·ARISING·FROM, |
| 299 | OUT·OF·OR·IN·CONNECTION·WITH·THE·SOFTWARE·OR·THE·USE·OR·OTHER·DEALINGS·IN·THE | 299 | OUT·OF·OR·IN·CONNECTION·WITH·THE·SOFTWARE·OR·THE·USE·OR·OTHER·DEALINGS·IN·THE |
| 300 | SOFTWARE. | 300 | SOFTWARE. |
| 301 | --- | 301 | --- |
| 302 | The·following·software·may·be·included·in·this·product:·@cucumber/junit-xml-formatter·(0.13.3) | ||
| 303 | This·software·contains·the·following·license·and·notice·below: | ||
| 304 | MIT·License | ||
| 305 | Copyright·(c)·Cucumber | ||
| 306 | Permission·is·hereby·granted,·free·of·charge,·to·any·person·obtaining·a·copy | ||
| 307 | of·this·software·and·associated·documentation·files·(the·"Software"),·to·deal | ||
| 308 | in·the·Software·without·restriction,·including·without·limitation·the·rights | ||
| 309 | to·use,·copy,·modify,·merge,·publish,·distribute,·sublicense,·and/or·sell | ||
| 310 | copies·of·the·Software,·and·to·permit·persons·to·whom·the·Software·is | ||
| 311 | furnished·to·do·so,·subject·to·the·following·conditions: | ||
| 312 | The·above·copyright·notice·and·this·permission·notice·shall·be·included·in·all | ||
| 313 | copies·or·substantial·portions·of·the·Software. | ||
| 314 | THE·SOFTWARE·IS·PROVIDED·"AS·IS",·WITHOUT·WARRANTY·OF·ANY·KIND,·EXPRESS·OR | ||
| 315 | IMPLIED,·INCLUDING·BUT·NOT·LIMITED·TO·THE·WARRANTIES·OF·MERCHANTABILITY, | ||
| 316 | FITNESS·FOR·A·PARTICULAR·PURPOSE·AND·NONINFRINGEMENT.·IN·NO·EVENT·SHALL·THE | ||
| 317 | AUTHORS·OR·COPYRIGHT·HOLDERS·BE·LIABLE·FOR·ANY·CLAIM,·DAMAGES·OR·OTHER | ||
| 318 | LIABILITY,·WHETHER·IN·AN·ACTION·OF·CONTRACT,·TORT·OR·OTHERWISE,·ARISING·FROM, | ||
| 319 | OUT·OF·OR·IN·CONNECTION·WITH·THE·SOFTWARE·OR·THE·USE·OR·OTHER·DEALINGS·IN·THE | ||
| 320 | SOFTWARE. | ||
| 321 | --- | ||
| 302 | The·following·software·may·be·included·in·this·product:·@cucumber/message-streams·(4.1.1) | 322 | The·following·software·may·be·included·in·this·product:·@cucumber/message-streams·(4.1.1) |
| 303 | This·software·contains·the·following·license·and·notice·below: | 323 | This·software·contains·the·following·license·and·notice·below: |
| 304 | MIT·License | 324 | MIT·License |
| 305 | Copyright·(c)·Cucumber | 325 | Copyright·(c)·Cucumber |
| Offset 2368, 15 lines modified | Offset 2395, 15 lines modified | ||
| 2368 | ***As·far·as·the·law·allows,·this·software·comes·as·is, | 2395 | ***As·far·as·the·law·allows,·this·software·comes·as·is, |
| 2369 | without·any·warranty·or·condition,·and·no·contributor | 2396 | without·any·warranty·or·condition,·and·no·contributor |
| 2370 | will·be·liable·to·anyone·for·any·damages·related·to·this | 2397 | will·be·liable·to·anyone·for·any·damages·related·to·this |
| 2371 | software·or·this·license,·under·any·kind·of·legal·claim.*** | 2398 | software·or·this·license,·under·any·kind·of·legal·claim.*** |
| 2372 | --- | 2399 | --- |
| 2373 | The·following·software·may·be·included·in·this·product:·lru-cache·(11.3. | 2400 | The·following·software·may·be·included·in·this·product:·lru-cache·(11.3.5) |
| 2374 | This·software·contains·the·following·license·and·notice·below: | 2401 | This·software·contains·the·following·license·and·notice·below: |
| 2375 | #·Blue·Oak·Model·License | 2402 | #·Blue·Oak·Model·License |
| 2376 | Version·1.0.0 | 2403 | Version·1.0.0 |
| 2377 | ##·Purpose | 2404 | ##·Purpose |
| Offset 4223, 15 lines modified | Offset 4250, 15 lines modified | ||
| 4223 | ····Work. | 4250 | ····Work. |
| 4224 | ·d.·Affirmer·understands·and·acknowledges·that·Creative·Commons·is·not·a | 4251 | ·d.·Affirmer·understands·and·acknowledges·that·Creative·Commons·is·not·a |
| 4225 | ····party·to·this·document·and·has·no·duty·or·obligation·with·respect·to | 4252 | ····party·to·this·document·and·has·no·duty·or·obligation·with·respect·to |
| 4226 | ····this·CC0·or·use·of·the·Work. | 4253 | ····this·CC0·or·use·of·the·Work. |
| 4227 | --- | 4254 | --- |
| 4228 | The·following·software·may·be·included·in·this·product:·type-fest·(5. | 4255 | The·following·software·may·be·included·in·this·product:·type-fest·(5.6.0) |
| 4229 | This·software·contains·the·following·license·and·notice·below: | 4256 | This·software·contains·the·following·license·and·notice·below: |
| 4230 | Creative·Commons·Legal·Code | 4257 | Creative·Commons·Legal·Code |
| 4231 | CC0·1.0·Universal | 4258 | CC0·1.0·Universal |
| 4232 | ····CREATIVE·COMMONS·CORPORATION·IS·NOT·A·LAW·FIRM·AND·DOES·NOT·PROVIDE | 4259 | ····CREATIVE·COMMONS·CORPORATION·IS·NOT·A·LAW·FIRM·AND·DOES·NOT·PROVIDE |
| Offset 12681, 35 lines modified | Offset 12681, 95 lines modified | ||
| 12681 | ········{ | 12681 | ········{ |
| 12682 | ············"_path":·"lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/commonjs/package.json", | 12682 | ············"_path":·"lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/commonjs/package.json", |
| 12683 | ············"path_type":·"hardlink", | 12683 | ············"path_type":·"hardlink", |
| 12684 | ············"sha256":·"8005a3491db7d92f36ac66369861589f9c47123d3a7c71e643fc2c06168cd45a", | 12684 | ············"sha256":·"8005a3491db7d92f36ac66369861589f9c47123d3a7c71e643fc2c06168cd45a", |
| 12685 | ············"size_in_bytes":·25 | 12685 | ············"size_in_bytes":·25 |
| 12686 | ········}, | 12686 | ········}, |
| 12687 | ········{ | 12687 | ········{ |
| 12688 | ············"_path":·"lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/browser/diagnostics-channel-browser.d.mts.map", | ||
| 12689 | ············"path_type":·"hardlink", | ||
| 12690 | ············"sha256":·"4840317a2d865e1d2fdd530b272fa43898ec64c716b871ccc5360148b768e5c5", | ||
| 12691 | ············"size_in_bytes":·361 | ||
| 12692 | ········}, | ||
| 12693 | ········{ | ||
| 12694 | ············"_path":·"lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/browser/diagnostics-channel-browser.mjs.map", | ||
| 12695 | ············"path_type":·"hardlink", | ||
| 12696 | ············"sha256":·"518aca56c97a713d7cc87fbe7a638cf1ef0198538c8913140f3597c606ed0fbd", | ||
| 12697 | ············"size_in_bytes":·725 | ||
| 12698 | ········}, | ||
| 12699 | ········{ | ||
| 12700 | ············"_path":·"lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/browser/diagnostics-channel.d.ts", | ||
| 12701 | ············"path_type":·"hardlink", | ||
| 12702 | ············"sha256":·"722d5111f018dfb653af17b4833408e271ee8369cc0db9eb013a6db3a49cc2ae", | ||
| 12703 | ············"size_in_bytes":·280 | ||
| 12704 | ········}, | ||
| 12705 | ········{ | ||
| 12706 | ············"_path":·"lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/browser/diagnostics-channel.js", | ||
| 12707 | ············"path_type":·"hardlink", | ||
| 12708 | ············"sha256":·"b6b6c7dd962957333196ead67faa84290e750af7985241b93958a8c5138cb10c", | ||
| 12709 | ············"size_in_bytes":·157 | ||
| 12710 | ········}, | ||
| 12711 | ········{ | ||
| 12712 | ············"_path":·"lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/browser/index.d.ts", | ||
| 12713 | ············"path_type":·"hardlink", | ||
| 12714 | ············"sha256":·"6b2e01831a058eceef8a1329cbad832522008215fc62e8a20a5ac514e8b700b1", | ||
| 12715 | ············"size_in_bytes":·58538 | ||
| 12716 | ········}, | ||
| 12717 | ········{ | ||
| 12718 | ············"_path":·"lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/browser/index.d.ts.map", | ||
| 12719 | ············"path_type":·"hardlink", | ||
| 12720 | ············"sha256":·"f95c515a129f20144b112e1e1d9c88a4c5addd8769e99df0fa0be68d6638e0c0", | ||
| 12721 | ············"size_in_bytes":·15012 | ||
| 12722 | ········}, | ||
| 12723 | ········{ | ||
| 12724 | ············"_path":·"lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/browser/index.js", | ||
| 12725 | ············"path_type":·"hardlink", | ||
| 12726 | ············"sha256":·"037e6349683267579765a030ecab906b148f4a32c6ff034e7a9fd8e6ffacd818", | ||
| 12727 | ············"size_in_bytes":·60571 | ||
| 12728 | ········}, | ||
| 12729 | ········{ | ||
| 12730 | ············"_path":·"lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/browser/index.js.map", | ||
| 12731 | ············"path_type":·"hardlink", | ||
| 12732 | ············"sha256":·"e73f65e4ba6b013b328a6f81e30771e6bc56637b44ba438618599ae36f157b39", | ||
| 12733 | ············"size_in_bytes":·153310 | ||
| 12734 | ········}, | ||
| 12735 | ········{ | ||
| 12736 | ············"_path":·"lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/browser/index.min.js", | ||
| 12737 | ············"path_type":·"hardlink", | ||
| 12738 | ············"sha256":·"ebbcf0684768baf79208517345dcd67f8a72561c3c1da6554dcc3bc7298c8265", | ||
| 12739 | ············"size_in_bytes":·18378 | ||
| 12740 | ········}, | ||
| 12741 | ········{ | ||
| 12742 | ············"_path":·"lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/browser/index.min.js.map", | ||
| 12743 | ············"path_type":·"hardlink", | ||
| 12744 | ············"sha256":·"2bcf53dfcd99c51e261fb2416b7602a55d7434d508e403ddb1115707846cf9bd", | ||
| 12745 | ············"size_in_bytes":·131773 | ||
| 12746 | ········}, | ||
| 12747 | ········{ | ||
| 12688 | ············"_path":·"lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/diagnostics-channel-esm.d.mts.map", | 12748 | ············"_path":·"lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/diagnostics-channel-esm.d.mts.map", |
| 12689 | ············"path_type":·"hardlink", | 12749 | ············"path_type":·"hardlink", |
| 12690 | ············"sha256":·" | 12750 | ············"sha256":·"9d2fb56a5f8bff18fa4f9381d8cfbfa3ad4494396f80820ffca7ae4090abf6f4", |
| 12691 | ············"size_in_bytes":·350 | 12751 | ············"size_in_bytes":·350 |
| 12692 | ········}, | 12752 | ········}, |
| 12693 | ········{ | 12753 | ········{ |
| 12694 | ············"_path":·"lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/diagnostics-channel-esm.mjs.map", | 12754 | ············"_path":·"lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/diagnostics-channel-esm.mjs.map", |
| 12695 | ············"path_type":·"hardlink", | 12755 | ············"path_type":·"hardlink", |
| 12696 | ············"sha256":·" | 12756 | ············"sha256":·"5f6777eb616d1e1584e16867324060f60cdd19391ff835eb83213b7c8febb9d4", |
| 12697 | ············"size_in_bytes":·16 | 12757 | ············"size_in_bytes":·1686 |
| 12698 | ········}, | 12758 | ········}, |
| 12699 | ········{ | 12759 | ········{ |
| 12700 | ············"_path":·"lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/diagnostics-channel.d.ts", | 12760 | ············"_path":·"lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/diagnostics-channel.d.ts", |
| 12701 | ············"path_type":·"hardlink", | 12761 | ············"path_type":·"hardlink", |
| 12702 | ············"sha256":·"6bd92fe424709528d102aff8436e358459b2860a215eb248e46ccbff9dc556ca", | 12762 | ············"sha256":·"6bd92fe424709528d102aff8436e358459b2860a215eb248e46ccbff9dc556ca", |
| 12703 | ············"size_in_bytes":·272 | 12763 | ············"size_in_bytes":·272 |
| 12704 | ········}, | 12764 | ········}, |
| 12705 | ········{ | 12765 | ········{ |
| 12706 | ············"_path":·"lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/diagnostics-channel.js", | 12766 | ············"_path":·"lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/diagnostics-channel.js", |
| 12707 | ············"path_type":·"hardlink", | 12767 | ············"path_type":·"hardlink", |
| 12708 | ············"sha256":·" | 12768 | ············"sha256":·"8317b8d0ea3c740c1613828a058d7fca8f1cf8efd2e92a88b7e5310f74c58133", |
| 12709 | ············"size_in_bytes":·780 | 12769 | ············"size_in_bytes":·780 |
| 12710 | ········}, | 12770 | ········}, |
| 12711 | ········{ | 12771 | ········{ |
| 12712 | ············"_path":·"lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/index.d.ts", | 12772 | ············"_path":·"lib/node_modules/@cucumber/cucumber/node_modules/lru-cache/dist/esm/index.d.ts", |
| 12713 | ············"path_type":·"hardlink", | 12773 | ············"path_type":·"hardlink", |
| 12714 | ············"sha256":·"6b2e01831a058eceef8a1329cbad832522008215fc62e8a20a5ac514e8b700b1", | 12774 | ············"sha256":·"6b2e01831a058eceef8a1329cbad832522008215fc62e8a20a5ac514e8b700b1", |
| 12715 | ············"size_in_bytes":·58538 | 12775 | ············"size_in_bytes":·58538 |
| Offset 12737, 16 lines modified | Offset 12797, 16 lines modified | ||
| 12737 | ············"path_type":·"hardlink", | 12797 | ············"path_type":·"hardlink", |
| 12738 | ············"sha256":·"ade8ce532a650d8186a718239cfb811b1c79c5813967313a4c8a950f1a95baa6", | 12798 | ············"sha256":·"ade8ce532a650d8186a718239cfb811b1c79c5813967313a4c8a950f1a95baa6", |
| 12739 | ············"size_in_bytes":·18503 | 12799 | ············"size_in_bytes":·18503 |
| Max diff block lines reached; 112579/118007 bytes (95.40%) of diff not shown. | |||