Type-level binary arithmetics in TS.
- Utilities:
- 4-bit parsers:
- Bin.
- Dec.
- Hex.
- 4-bit formatters:
- Bin.
- 4-bit parsers:
- Dec.
// WTFPL or MIT | |
// | |
// Extracts all the exported symbols from files. | |
// For example, if you have a prelude and want to feed all its symbols | |
// to the `webpack.ProvidePlugin` or your fav Babel auto-import plugin. | |
// | |
// Written to be used with webpack (depends on its resolver), | |
// but it’s pretty easy to get rid of this dependency. | |
// | |
// Only supports ES modules. Doesn’t support Flow. |
// WTFPL or MIT | |
// | |
// Like `fs-extra`, but everything is sync. | |
// May be used with `webpack`/`enhanced-resolve` | |
// to allow the `resolveSync` method: | |
// | |
// const compiler = webpack(...); | |
// | |
// compiler.inputFileSystem = require('./fses'); | |
// |
html[dark] { | |
background-color: #000 !important; | |
} | |
* { | |
--yt-spec-general-background-a: #000 !important; | |
--yt-spec-general-background-b: #000; | |
--yt-spec-brand-background-primary: #000 !important; | |
--yt-spec-brand-background-solid: #000; | |
--ytd-searchbox-legacy-button-color: #090909; |
.episodeBtns, | |
.price-tag, | |
.shares, | |
.header-main_item.-desktop.-credits, | |
.header-main_user_button, | |
.episodeNPEp-subtitle, | |
.comments-button, | |
.episode_buttons, | |
.border-list_item:last-child, | |
.jw-icon-rewind, |
Type-level binary arithmetics in TS.
* Unlike the original, this function removes trailind slashes, and keeps leading ./
segments.
band
— the band number,ulfl
— the lowest uplink frequency of band,ulfh
— the highest uplink frequency of band,ulnl
— the lowest uplink EARFCN of band,ulnh
— the highest uplink EARFCN of band,ulno
— the offset required to calculate uplink EARFCNs,dlfl
— the lowest downlink frequency of band,dlfh
— the highest downlink frequency of band,type Falsy = '' | 0n | 0 | false | null | undefined | void; | |
type If<c, t, f> = c extends Falsy ? f : t; | |
type Cast<a, b> = a extends b ? a : b; | |
type Size<t> = t extends readonly any[] ? t['length'] : never; | |
type Head<t> = t extends readonly [any, ...any[]] ? t[0] : never; | |
type Last<t> = t extends readonly any[] ? t[Size<Tail<t>>] : never; | |
type Init<t, x = readonly []> = { 0: Init<Tail<t>, Append<x, Head<t>>>; 1: x }[If<Size<Tail<t>>, 0, 1>]; | |
type Append<t, e> = Concat<t, readonly [e]>; | |
type Reverse<t, x = readonly []> = { 0: Reverse<Tail<t>, Prepend<Head<t>, x>>; 1: x }[If<Size<t>, 0, 1>]; |
// Works exactly as `await`/`then` in JavaScript, but for types! | |
// Of course, it can’t handle deep nesting (≥45±n levels) due to | |
// TypeScript limitations. But 45 is enough. | |
// License: MIT. | |
type Await<a> = { | |
0: Await<a extends PromiseLike<infer b> ? b : never>, | |
1: a, | |
}[a extends PromiseLike<any> ? 0 : 1]; |