Skip to content

Commit

Permalink
chore: update node-utils (#1446)
Browse files Browse the repository at this point in the history
  • Loading branch information
noshiro-pf authored Mar 2, 2025
1 parent 44fddde commit dcdc351
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion scripts/src/node-utils/index.mts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from './child-process-async.mjs';
export * from './exec-async.mjs';
export * from './path-utils.mjs';
2 changes: 1 addition & 1 deletion scripts/src/node-utils/path-utils.mts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as path from 'node:path';
import * as url from 'node:url';
import 'zx/globals';

export const toThisDir = (importMetaUrl: string): string =>
path.dirname(url.fileURLToPath(importMetaUrl));
11 changes: 11 additions & 0 deletions scripts/src/ts-utils/cast-brand.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export const toSafeUint = (n: number): SafeUint =>
// eslint-disable-next-line total-functions/no-unsafe-type-assertion
n as SafeUint;

export const toPositiveSafeInt = (n: number): PositiveSafeInt =>
// eslint-disable-next-line total-functions/no-unsafe-type-assertion
n as PositiveSafeInt;

export const toUint32 = (v: number): Uint32 =>
// eslint-disable-next-line total-functions/no-unsafe-type-assertion
v as Uint32;
1 change: 1 addition & 0 deletions scripts/src/ts-utils/index.mts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './cast-brand.mjs';
export * from './compose-mono-type-fns.mjs';
export * from './compose.mjs';
export * from './expect-type.mjs';
Expand Down
2 changes: 1 addition & 1 deletion scripts/src/ts-utils/replace-with-no-match-check.mts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { toSafeUint } from './utils.mjs';
import { toSafeUint } from './cast-brand.mjs';

/**
* Replace all instances of a substring in a string, using a regular expression
Expand Down
12 changes: 0 additions & 12 deletions scripts/src/ts-utils/utils.mts
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,6 @@ export function zeros(len: number): readonly 0[] {
return Array.from({ length: len }, () => 0);
}

export const toSafeUint = (n: number): SafeUint =>
// eslint-disable-next-line total-functions/no-unsafe-type-assertion
n as SafeUint;

export const toPositiveSafeInt = (n: number): PositiveSafeInt =>
// eslint-disable-next-line total-functions/no-unsafe-type-assertion
n as PositiveSafeInt;

export const toUint32 = (v: number): Uint32 =>
// eslint-disable-next-line total-functions/no-unsafe-type-assertion
v as Uint32;

export const castMutable = <T,>(mutable: T): Mutable<T> =>
mutable as Mutable<T>;

Expand Down

0 comments on commit dcdc351

Please sign in to comment.