repo stringlengths 7 64 | file_url stringlengths 81 338 | file_path stringlengths 5 257 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:25:31 2026-01-05 01:50:38 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
kikko-land/kikko | https://github.com/kikko-land/kikko/blob/de56022c7bb15f3bd10a3de528b30e999afd9801/packages/kikko/src/backend.ts | packages/kikko/src/backend.ts | import { IPrimitiveValue } from "@kikko-land/boono-sql";
import { getTime } from "./measurePerformance";
import { ReactiveVar } from "./reactiveVar";
import {
acquireWithTrJobOrWait,
ITransactionsJobsState,
releaseTrJobIfPossible,
} from "./transactionJobs";
import { IExecQueriesResult, IQuery, ITransactionOpts ... | typescript | MIT | de56022c7bb15f3bd10a3de528b30e999afd9801 | 2026-01-05T05:01:22.972790Z | false |
kikko-land/kikko | https://github.com/kikko-land/kikko/blob/de56022c7bb15f3bd10a3de528b30e999afd9801/packages/kikko/src/afterTransaction.ts | packages/kikko/src/afterTransaction.ts | import { IDb, ITransaction } from "./types";
export const runAfterTransaction = (
db: IDb,
func: (
event: "committed" | "rollbacked",
db: IDb,
transaction: ITransaction
) => void
) => {
if (!db.__state.localState.transactionState.current) {
throw new Error("Not in transaction.");
}
const tr... | typescript | MIT | de56022c7bb15f3bd10a3de528b30e999afd9801 | 2026-01-05T05:01:22.972790Z | false |
kikko-land/kikko | https://github.com/kikko-land/kikko/blob/de56022c7bb15f3bd10a3de528b30e999afd9801/packages/native-expo-backend/src/nativeExpoBackend.ts | packages/native-expo-backend/src/nativeExpoBackend.ts | import {
buildAsyncQueryRunner,
getTime,
IDbBackend,
initJobsState,
IPrimitiveValue,
IQuery,
IRunRes,
ITransactionOpts,
} from "@kikko-land/kikko";
import { openDatabase, ResultSet, ResultSetError } from "expo-sqlite";
export const nativeExpoBackend =
(): IDbBackend =>
({ dbName }) => {
const j... | typescript | MIT | de56022c7bb15f3bd10a3de528b30e999afd9801 | 2026-01-05T05:01:22.972790Z | false |
kikko-land/kikko | https://github.com/kikko-land/kikko/blob/de56022c7bb15f3bd10a3de528b30e999afd9801/packages/native-expo-backend/src/index.ts | packages/native-expo-backend/src/index.ts | export * from "./nativeExpoBackend";
| typescript | MIT | de56022c7bb15f3bd10a3de528b30e999afd9801 | 2026-01-05T05:01:22.972790Z | false |
kikko-land/kikko | https://github.com/kikko-land/kikko/blob/de56022c7bb15f3bd10a3de528b30e999afd9801/packages/common-scripts/src/publish.ts | packages/common-scripts/src/publish.ts | import { spawn } from "child_process";
import path from "path";
import { readFile, writeFile, readdir } from "fs/promises";
import { resolve } from "path";
import { cwd } from "process";
import { PackageJson } from "type-fest";
import { unlink, rename } from "fs/promises";
import { existsSync } from "fs";
const runCom... | typescript | MIT | de56022c7bb15f3bd10a3de528b30e999afd9801 | 2026-01-05T05:01:22.972790Z | false |
kikko-land/kikko | https://github.com/kikko-land/kikko/blob/de56022c7bb15f3bd10a3de528b30e999afd9801/packages/migrations-plugin/src/migrationPlugin.ts | packages/migrations-plugin/src/migrationPlugin.ts | import { generateInsert, sql } from "@kikko-land/boono-sql";
import { IDb, IDbClientPlugin } from "@kikko-land/kikko";
import { IAtomicMigration, IMigration } from "./types";
const migrationsTable = "migrations";
const handleMigrations = async <T extends IMigration | IAtomicMigration>(
db: IDb,
migrations: T[],
... | typescript | MIT | de56022c7bb15f3bd10a3de528b30e999afd9801 | 2026-01-05T05:01:22.972790Z | false |
kikko-land/kikko | https://github.com/kikko-land/kikko/blob/de56022c7bb15f3bd10a3de528b30e999afd9801/packages/migrations-plugin/src/types.ts | packages/migrations-plugin/src/types.ts | import { IAtomicTransactionScope, IDb } from "@kikko-land/kikko";
export type IMigration = {
up: (state: IDb) => Promise<void>;
id: number;
name: string;
};
export type IAtomicMigration = {
up: (tr: IAtomicTransactionScope, db: IDb) => Promise<void> | void;
id: number;
name: string;
};
| typescript | MIT | de56022c7bb15f3bd10a3de528b30e999afd9801 | 2026-01-05T05:01:22.972790Z | false |
kikko-land/kikko | https://github.com/kikko-land/kikko/blob/de56022c7bb15f3bd10a3de528b30e999afd9801/packages/migrations-plugin/src/index.ts | packages/migrations-plugin/src/index.ts | export * from "./migrationPlugin";
export * from "./types";
| typescript | MIT | de56022c7bb15f3bd10a3de528b30e999afd9801 | 2026-01-05T05:01:22.972790Z | false |
kikko-land/kikko | https://github.com/kikko-land/kikko/blob/de56022c7bb15f3bd10a3de528b30e999afd9801/packages/d1-backend/src/d1Backend.ts | packages/d1-backend/src/d1Backend.ts | import {
buildAsyncQueryRunner,
getTime,
IDbBackend,
initJobsState,
IPrimitiveValue,
IQuery,
IQueryResult,
ITransactionOpts,
} from "@kikko-land/kikko";
export const d1Backend =
(config: { db: D1Database }): IDbBackend =>
() => {
const jobsState = initJobsState();
const queryRunner = build... | typescript | MIT | de56022c7bb15f3bd10a3de528b30e999afd9801 | 2026-01-05T05:01:22.972790Z | false |
kikko-land/kikko | https://github.com/kikko-land/kikko/blob/de56022c7bb15f3bd10a3de528b30e999afd9801/packages/d1-backend/src/index.ts | packages/d1-backend/src/index.ts | export * from "./d1Backend";
| typescript | MIT | de56022c7bb15f3bd10a3de528b30e999afd9801 | 2026-01-05T05:01:22.972790Z | false |
kikko-land/kikko | https://github.com/kikko-land/kikko/blob/de56022c7bb15f3bd10a3de528b30e999afd9801/packages/vite-react-example/vite.config.ts | packages/vite-react-example/vite.config.ts | import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import checker from "vite-plugin-checker";
import { visualizer } from "rollup-plugin-visualizer";
// https://vitejs.dev/config/
export default defineConfig({
server: {
headers: {
"Cross-Origin-Embedder-Policy": "require-corp",
... | typescript | MIT | de56022c7bb15f3bd10a3de528b30e999afd9801 | 2026-01-05T05:01:22.972790Z | false |
kikko-land/kikko | https://github.com/kikko-land/kikko/blob/de56022c7bb15f3bd10a3de528b30e999afd9801/packages/vite-react-example/src/AppRoutes.tsx | packages/vite-react-example/src/AppRoutes.tsx | import { Route, Routes } from "react-router-dom";
import { AppBenchmark } from "./benchmark/AppBenchmark";
import { AppList } from "./list/AppList";
export const AppRoutes = () => {
return (
<Routes>
<Route path="/" element={<AppList />} />
<Route path="benchmark" element={<AppBenchmark />} />
<... | typescript | MIT | de56022c7bb15f3bd10a3de528b30e999afd9801 | 2026-01-05T05:01:22.972790Z | false |
kikko-land/kikko | https://github.com/kikko-land/kikko/blob/de56022c7bb15f3bd10a3de528b30e999afd9801/packages/vite-react-example/src/quick-react-example.tsx | packages/vite-react-example/src/quick-react-example.tsx | import { absurdWebBackend } from "@kikko-land/absurd-web-backend";
import {
DbProvider,
EnsureDbLoaded,
IInitDbClientConfig,
IMigration,
migrationsPlugin,
reactiveQueriesPlugin,
sql,
} from "@kikko-land/react";
// For Vite:
import sqlWasmUrl from "@kikko-land/sql.js/dist/sql-wasm.wasm?url";
import { List... | typescript | MIT | de56022c7bb15f3bd10a3de528b30e999afd9801 | 2026-01-05T05:01:22.972790Z | false |
kikko-land/kikko | https://github.com/kikko-land/kikko/blob/de56022c7bb15f3bd10a3de528b30e999afd9801/packages/vite-react-example/src/builder-examples.ts | packages/vite-react-example/src/builder-examples.ts | import {
alias,
and,
asc,
deleteFrom,
desc,
eq$,
gtEq,
gtEq$,
in$,
insert,
like$,
ltEq$,
not,
or,
select,
update,
values,
} from "@kikko-land/boono";
import { sql } from "@kikko-land/boono-sql";
// Queries below has correct syntax, but the logic of selecting is
// absurd. The code jus... | typescript | MIT | de56022c7bb15f3bd10a3de528b30e999afd9801 | 2026-01-05T05:01:22.972790Z | false |
kikko-land/kikko | https://github.com/kikko-land/kikko/blob/de56022c7bb15f3bd10a3de528b30e999afd9801/packages/vite-react-example/src/main.tsx | packages/vite-react-example/src/main.tsx | import React from "react";
import ReactDOM from "react-dom/client";
import { BrowserRouter } from "react-router-dom";
import { AppRoutes } from "./AppRoutes";
const el = document.getElementById("root");
if (!el) {
throw new Error("Failed to find root el #root");
}
ReactDOM.createRoot(el).render(
<React.StrictMod... | typescript | MIT | de56022c7bb15f3bd10a3de528b30e999afd9801 | 2026-01-05T05:01:22.972790Z | false |
kikko-land/kikko | https://github.com/kikko-land/kikko/blob/de56022c7bb15f3bd10a3de528b30e999afd9801/packages/vite-react-example/src/example.tsx | packages/vite-react-example/src/example.tsx | /* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
import { deleteFrom, desc, insert, like$, select } from "@kikko-land/boono";
import {
makeId,
sql,
useDbQuery,
useFirstRowDbQuery,
... | typescript | MIT | de56022c7bb15f3bd10a3de528b30e999afd9801 | 2026-01-05T05:01:22.972790Z | false |
kikko-land/kikko | https://github.com/kikko-land/kikko/blob/de56022c7bb15f3bd10a3de528b30e999afd9801/packages/vite-react-example/src/vite-env.d.ts | packages/vite-react-example/src/vite-env.d.ts | /// <reference types="vite/client" />
| typescript | MIT | de56022c7bb15f3bd10a3de528b30e999afd9801 | 2026-01-05T05:01:22.972790Z | false |
kikko-land/kikko | https://github.com/kikko-land/kikko/blob/de56022c7bb15f3bd10a3de528b30e999afd9801/packages/vite-react-example/src/benchmark/AppBenchmark.tsx | packages/vite-react-example/src/benchmark/AppBenchmark.tsx | import { absurdWebBackend } from "@kikko-land/absurd-web-backend";
import {
DbProvider,
EnsureDbLoaded,
IInitDbClientConfig,
makeId,
migrationsPlugin,
} from "@kikko-land/react";
import absurdSqlWasmUrl from "@kikko-land/sql.js/dist/sql-wasm.wasm?url";
import { waSqliteWebBackend } from "@kikko-land/wa-sqlite... | typescript | MIT | de56022c7bb15f3bd10a3de528b30e999afd9801 | 2026-01-05T05:01:22.972790Z | false |
kikko-land/kikko | https://github.com/kikko-land/kikko/blob/de56022c7bb15f3bd10a3de528b30e999afd9801/packages/vite-react-example/src/benchmark/Benchmark.tsx | packages/vite-react-example/src/benchmark/Benchmark.tsx | import { sql } from "@kikko-land/boono-sql";
import {
makeId,
suppressLog,
useDbStrict,
useRunDbQuery,
} from "@kikko-land/react";
import { useCallback, useState } from "react";
import { useSearchParam } from "react-use";
import { backendOptions } from "./AppBenchmark";
export const Benchmark = () => {
cons... | typescript | MIT | de56022c7bb15f3bd10a3de528b30e999afd9801 | 2026-01-05T05:01:22.972790Z | false |
kikko-land/kikko | https://github.com/kikko-land/kikko/blob/de56022c7bb15f3bd10a3de528b30e999afd9801/packages/vite-react-example/src/list/List.tsx | packages/vite-react-example/src/list/List.tsx | import { deleteFrom, insert, like$, select, update } from "@kikko-land/boono";
import {
makeId,
sql,
useCacheDbQuery,
useDbQuery,
useDbState,
useDbStrict,
useRunDbQuery,
} from "@kikko-land/react";
import {
DummyDriver,
Kysely,
SqliteAdapter,
SqliteIntrospector,
SqliteQueryCompiler,
} from "kyse... | typescript | MIT | de56022c7bb15f3bd10a3de528b30e999afd9801 | 2026-01-05T05:01:22.972790Z | false |
kikko-land/kikko | https://github.com/kikko-land/kikko/blob/de56022c7bb15f3bd10a3de528b30e999afd9801/packages/vite-react-example/src/list/AppList.tsx | packages/vite-react-example/src/list/AppList.tsx | import "../builder-examples";
import { absurdWebBackend } from "@kikko-land/absurd-web-backend";
import {
atomicMigrationsPlugin,
DbsHolder,
EnsureDbLoaded,
IInitDbClientConfig,
reactiveQueriesPlugin,
} from "@kikko-land/react";
import absurdSqlWasmUrl from "@kikko-land/sql.js/dist/sql-wasm.wasm?url";
import... | typescript | MIT | de56022c7bb15f3bd10a3de528b30e999afd9801 | 2026-01-05T05:01:22.972790Z | false |
kikko-land/kikko | https://github.com/kikko-land/kikko/blob/de56022c7bb15f3bd10a3de528b30e999afd9801/packages/vite-react-example/src/hooks/usePaginator.ts | packages/vite-react-example/src/hooks/usePaginator.ts | import { ISelectStatement, select } from "@kikko-land/boono";
import { sql, useFirstRowDbQuery } from "@kikko-land/react";
import { useCallback, useEffect, useState } from "react";
export const usePaginator = ({
perPage,
baseQuery,
}: {
perPage: number;
baseQuery: ISelectStatement;
}) => {
const [currentPage... | typescript | MIT | de56022c7bb15f3bd10a3de528b30e999afd9801 | 2026-01-05T05:01:22.972790Z | false |
kikko-land/kikko | https://github.com/kikko-land/kikko/blob/de56022c7bb15f3bd10a3de528b30e999afd9801/packages/vite-react-example/src/migrations/createKV.ts | packages/vite-react-example/src/migrations/createKV.ts | import { IMigration, sql } from "@kikko-land/react";
export const createKVMigration: IMigration = {
up: async (db) => {
await db.runQuery(
sql`
CREATE TABLE kv (key TEXT, value TEXT);
`
);
},
id: 19,
name: "createKV",
};
| typescript | MIT | de56022c7bb15f3bd10a3de528b30e999afd9801 | 2026-01-05T05:01:22.972790Z | false |
kikko-land/kikko | https://github.com/kikko-land/kikko/blob/de56022c7bb15f3bd10a3de528b30e999afd9801/packages/vite-react-example/src/migrations/createNotesTable.ts | packages/vite-react-example/src/migrations/createNotesTable.ts | import { IAtomicMigration, IMigration, sql } from "@kikko-land/react";
export const createNotesTableMigration: IMigration = {
up: async (db) => {
await db.runQuery(
sql`
CREATE TABLE IF NOT EXISTS notes (
id varchar(20) PRIMARY KEY,
title TEXT NOT NULL,
content TEXT NOT NULL,
... | typescript | MIT | de56022c7bb15f3bd10a3de528b30e999afd9801 | 2026-01-05T05:01:22.972790Z | false |
kikko-land/kikko | https://github.com/kikko-land/kikko/blob/de56022c7bb15f3bd10a3de528b30e999afd9801/packages/electron-better-sqlite3-backend/src/electronBetterSqlite3Backend.ts | packages/electron-better-sqlite3-backend/src/electronBetterSqlite3Backend.ts | import {
buildSyncQueryRunner,
getTime,
IDbBackend,
initJobsState,
IPrimitiveValue,
IQuery,
IQueryResult,
IRunRes,
ITransactionOpts,
} from "@kikko-land/kikko";
declare global {
interface Window {
sqliteDb: (path: string) => Promise<{
close: (callback?: (err: Error | null) => void) => voi... | typescript | MIT | de56022c7bb15f3bd10a3de528b30e999afd9801 | 2026-01-05T05:01:22.972790Z | false |
kikko-land/kikko | https://github.com/kikko-land/kikko/blob/de56022c7bb15f3bd10a3de528b30e999afd9801/packages/electron-better-sqlite3-backend/src/initSqliteBridge.ts | packages/electron-better-sqlite3-backend/src/initSqliteBridge.ts | import Database from "better-sqlite3";
import { contextBridge } from "electron";
export const initSqliteBridge = () => {
contextBridge.exposeInMainWorld("sqliteDb", (file: string) => {
const db = new Database(file);
return {
close: () => {
db.close();
},
all: function (sql: string,... | typescript | MIT | de56022c7bb15f3bd10a3de528b30e999afd9801 | 2026-01-05T05:01:22.972790Z | false |
kikko-land/kikko | https://github.com/kikko-land/kikko/blob/de56022c7bb15f3bd10a3de528b30e999afd9801/packages/electron-better-sqlite3-backend/src/index.ts | packages/electron-better-sqlite3-backend/src/index.ts | export * from "./electronBetterSqlite3Backend";
| typescript | MIT | de56022c7bb15f3bd10a3de528b30e999afd9801 | 2026-01-05T05:01:22.972790Z | false |
kikko-land/kikko | https://github.com/kikko-land/kikko/blob/de56022c7bb15f3bd10a3de528b30e999afd9801/packages/reactive-queries-plugin/src/utils.ts | packages/reactive-queries-plugin/src/utils.ts | import { IDb } from "@kikko-land/kikko";
export const getReactiveState = (db: IDb) => {
const reactiveState = db.__state.sharedState.reactiveQueriesState;
if (!reactiveState) {
throw new Error(
"Internal error, maybe you forget to connect the 'reactiveQueries' plugin?"
);
}
return reactiveState... | typescript | MIT | de56022c7bb15f3bd10a3de528b30e999afd9801 | 2026-01-05T05:01:22.972790Z | false |
kikko-land/kikko | https://github.com/kikko-land/kikko/blob/de56022c7bb15f3bd10a3de528b30e999afd9801/packages/reactive-queries-plugin/src/reactivePlugin.ts | packages/reactive-queries-plugin/src/reactivePlugin.ts | import {
IDb,
IDbClientPlugin,
IQueriesMiddleware,
ISqlAdapter,
} from "@kikko-land/kikko";
import { getBroadcastCh } from "./getBroadcastCh";
import { getReactiveState } from "./utils";
const notifyTablesContentChanged = (db: IDb, tables: string[]) => {
if (tables.length === 0) return;
const reactiveSta... | typescript | MIT | de56022c7bb15f3bd10a3de528b30e999afd9801 | 2026-01-05T05:01:22.972790Z | false |
kikko-land/kikko | https://github.com/kikko-land/kikko/blob/de56022c7bb15f3bd10a3de528b30e999afd9801/packages/reactive-queries-plugin/src/getBroadcastCh.ts | packages/reactive-queries-plugin/src/getBroadcastCh.ts | import { ReactiveVar, reactiveVar } from "@kikko-land/kikko";
export type IMessage = { changesInTables: string[] };
export type IListener = (msg: IMessage) => void;
export interface INotifyChannel {
postMessage(msg: IMessage): Promise<void>;
addEventListener(cb: IListener): void;
removeEventListener(cb: IListene... | typescript | MIT | de56022c7bb15f3bd10a3de528b30e999afd9801 | 2026-01-05T05:01:22.972790Z | false |
kikko-land/kikko | https://github.com/kikko-land/kikko/blob/de56022c7bb15f3bd10a3de528b30e999afd9801/packages/reactive-queries-plugin/src/types.ts | packages/reactive-queries-plugin/src/types.ts | import { ReactiveVar } from "@kikko-land/kikko";
import { INotifyChannel } from "./getBroadcastCh";
declare module "@kikko-land/kikko" {
export interface ISharedDbState {
reactiveQueriesState?: {
rEventsCh: ReactiveVar<INotifyChannel | undefined>;
};
}
}
| typescript | MIT | de56022c7bb15f3bd10a3de528b30e999afd9801 | 2026-01-05T05:01:22.972790Z | false |
kikko-land/kikko | https://github.com/kikko-land/kikko/blob/de56022c7bb15f3bd10a3de528b30e999afd9801/packages/reactive-queries-plugin/src/listenQueries.ts | packages/reactive-queries-plugin/src/listenQueries.ts | import { ISqlAdapter } from "@kikko-land/boono-sql";
import { IDb } from "@kikko-land/kikko";
import { IMessage } from "./getBroadcastCh";
import { getReactiveState } from "./utils";
export const listenQueries = <D extends Record<string, unknown>>(
db: IDb,
queries: ISqlAdapter[],
subscriber: (evs: D[][]) => vo... | typescript | MIT | de56022c7bb15f3bd10a3de528b30e999afd9801 | 2026-01-05T05:01:22.972790Z | false |
kikko-land/kikko | https://github.com/kikko-land/kikko/blob/de56022c7bb15f3bd10a3de528b30e999afd9801/packages/reactive-queries-plugin/src/index.ts | packages/reactive-queries-plugin/src/index.ts | import "./types";
export * from "./listenQueries";
export * from "./reactivePlugin";
| typescript | MIT | de56022c7bb15f3bd10a3de528b30e999afd9801 | 2026-01-05T05:01:22.972790Z | false |
kikko-land/kikko | https://github.com/kikko-land/kikko/blob/de56022c7bb15f3bd10a3de528b30e999afd9801/packages/react/src/vite-env.d.ts | packages/react/src/vite-env.d.ts | /// <reference types="vite/client" />
| typescript | MIT | de56022c7bb15f3bd10a3de528b30e999afd9801 | 2026-01-05T05:01:22.972790Z | false |
kikko-land/kikko | https://github.com/kikko-land/kikko/blob/de56022c7bb15f3bd10a3de528b30e999afd9801/packages/react/src/index.ts | packages/react/src/index.ts | export * from "@kikko-land/boono-sql";
export * from "@kikko-land/kikko";
export * from "@kikko-land/migrations-plugin";
export * from "@kikko-land/react-queries-hooks";
export * from "@kikko-land/reactive-queries-plugin";
| typescript | MIT | de56022c7bb15f3bd10a3de528b30e999afd9801 | 2026-01-05T05:01:22.972790Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/jest.config.ts | jest.config.ts | /*
* For a detailed explanation regarding each configuration property and type check, visit:
* https://jestjs.io/docs/configuration
*/
export default {
// All imported modules in your tests should be mocked automatically
// automock: false,
// Stop running tests after `n` failures
// bail: 0,
// The dir... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/tests/utils/is-nan-util.spec.ts | tests/utils/is-nan-util.spec.ts | import IsNaN from "../../lib/utils/is-nan.util"
describe('is-nan.util', () => {
it('should string starts with letters is Nan', () => {
const isN = IsNaN('abc123');
expect(isN).toBeTruthy();
});
it('should string starts with numbers not is Nan', () => {
const isN = IsNaN('123asdv');... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/tests/utils/browser-event-manager.spec.ts | tests/utils/browser-event-manager.spec.ts |
import BrowserEventManager from '../../lib/core/browser-event-manager'
describe('BrowserEventManager', () => {
class CustomEventMock {
type: string;
bubbles: boolean;
detail: any;
constructor(type: string, eventInitDict?: CustomEventInit) {
this.type = type;
... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/tests/utils/normalize.spec.ts | tests/utils/normalize.spec.ts | import Float from '../../lib/utils/normalize-number.util';
describe('normalize', () => {
it('should return 0 if provide an invalid value', () => {
const invalid = {};
const result = Float(invalid as any);
expect(result).toBe(0);
});
it('should transform string in number if is not i... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/tests/utils/subtract-number-util.spec.ts | tests/utils/subtract-number-util.spec.ts | import Subtract from '../../lib/utils/subtract-number.util'
describe('subtract-number', () => {
it('should return 100 - 3 = 97 as number', () => {
const result = Subtract(100, 3);
expect(result).toBe(97);
});
it('should return (-100) - 3 = (-103) as number', () => {
const result = ... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/tests/utils/ensure-number-util.spec.ts | tests/utils/ensure-number-util.spec.ts | import EnsureNumber from '../../lib/utils/ensure-number';
describe('ensure-number.util', () => {
it('should return 0 if Infinity', () => {
const result = EnsureNumber(Infinity);
expect(result).toBe(0);
});
it('should return 0 if NaN', () => {
const result = EnsureNumber(NaN);
... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/tests/utils/sum-number-util.spec.ts | tests/utils/sum-number-util.spec.ts | import Sum from '../../lib/utils/sum-number.util';
describe('sum-number', () => {
it('should return 93 + 7 = 100 as number', () => {
const result = Sum(93, 7);
expect(result).toBe(100);
});
it('should return 93 + (-3) = 90 as number', () => {
const result = Sum(93, -3);
exp... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/tests/utils/multiply-number-util.spec.ts | tests/utils/multiply-number-util.spec.ts | import Multiply from '../../lib/utils/multiply-number.util';
describe('multiply-number', () => {
it('should return 77 x 1.2 = 92.4', () => {
const result = Multiply(77, 1.2);
expect(result).toBe(92.4);
});
it('should return 77 x -1.2 = -92.4', () => {
const result = Multiply(77, -1... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/tests/utils/to-decimal.spec.ts | tests/utils/to-decimal.spec.ts | import ToDecimal from "../../lib/utils/to-decimal-number.util";
describe('to-decimal', () => {
it('should return the same value if is not a number', () => {
const value = 'invalid';
const result = ToDecimal(value as any);
expect(result).toBe(value);
});
it('should divide by 100', (... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/tests/utils/replace-char-util.spec.ts | tests/utils/replace-char-util.spec.ts | import Replace from '../../lib/utils/replace-char.util';
describe('replace', () => {
it('should replace letter "a" to 4', () => {
const target = "Hi My Name Is Jane Doe, I am 18 years old";
const char = 'a';
const value = '4';
const result = Replace(target, char, value);
exp... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/tests/utils/validator.spec.ts | tests/utils/validator.spec.ts | import { Aggregate, Entity, id, Id, ID, Result, ValueObject } from "../../lib/core";
import { _Result } from "../../lib/types";
import { Validator } from "../../lib/utils";
describe('check-types', () => {
const checker = Validator.create();
class Agg extends Aggregate<any>{
private constructor(props: any) {
su... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | true |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/tests/utils/platform-util.spec.ts | tests/utils/platform-util.spec.ts | import { platform } from "../../lib/utils";
describe('platform', () => {
it('should return true if process is defined', () => {
const process = {};
const isNodeJS = platform.isNodeJs(process);
expect(isNodeJS).toBeTruthy();
});
it('should return false if process is not defined', ()... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/tests/utils/divide-number-util.spec.ts | tests/utils/divide-number-util.spec.ts | import Divide from '../../lib/utils/divide-number.util'
describe('divide-number', () => {
it('should return 100 / 3 = 33.33333 as number', () => {
const result = Divide(100, 3);
expect(result).toBe(33.33333);
});
it('should return 100 / 3 = 33.33333 as string', () => {
const result... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/tests/utils/decrement-time-util.spec.ts | tests/utils/decrement-time-util.spec.ts | import DecrementTime from '../../lib/utils/decrement-time.util';
describe('decrement-time', () => {
const date = new Date(2206299212000);
it('should decrement minutes with success', () => {
expect(date.toISOString()).toBe('2039-11-30T20:53:32.000Z');
const result = DecrementTime(date, 53, 'minu... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/tests/utils/to-precision-util.spec.ts | tests/utils/to-precision-util.spec.ts | import ToPrecision from '../../lib/utils/to-precision.util';
describe('to-precision.util', () => {
it('should return numbers with 3 numbers fraction', () => {
const result = ToPrecision(3.1234567, 3);
expect(result).toBe(3.123);
});
it('should return numbers with 3 numbers fraction', () =>... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/tests/utils/to-long.spec.ts | tests/utils/to-long.spec.ts | import ToLong from "../../lib/utils/to-long-number.util";
describe('to-long', () => {
it('should return the same value if is not a number', () => {
const value = 'invalid';
const result = ToLong(value as any);
expect(result).toBe(value);
});
it('should multiply by 100', () => {
... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/tests/utils/remove-spaces-util.spec.ts | tests/utils/remove-spaces-util.spec.ts | import RemoveSpaces from '../../lib/utils/remove-spaces.util';
describe('remove-spaces', () => {
it('should remove space with success', () => {
const text = " Some Text With Space ";
const result = RemoveSpaces(text);
expect(result).toBe("SomeTextWithSpace");
});
it('should do not ... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/tests/utils/increment-time-util.spec.ts | tests/utils/increment-time-util.spec.ts | import IncrementTime from '../../lib/utils/increment-time.util';
describe('increment-time', () => {
const date = new Date(2206299212000);
it('should increment minutes with success', () => {
expect(date.toISOString()).toBe('2039-11-30T20:53:32.000Z');
const result = IncrementTime(date, 42, 'minu... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/tests/utils/remove-special-chars-util.spec.ts | tests/utils/remove-special-chars-util.spec.ts | import RemoveChars from '../../lib/utils/remove-chars.util';
import { Validator } from '../../lib/utils/validator';
describe('remove-special-chars', () => {
beforeAll(() => {
Validator.create();
})
const callback = (char: string): boolean => Validator.create().string(char).isSpecialChar();
... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/tests/utils/utils.spec.ts | tests/utils/utils.spec.ts | import Utils from '../../lib/utils/util';
describe('utils', () => {
describe('string', () => {
it('should remove space with success', () => {
const text = " Some Text With Space ";
const result = Utils.string(text).removeSpaces();
expect(result).toBe("SomeTextWithSpace"... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/tests/core/entity.spec.ts | tests/core/entity.spec.ts | import { Entity, Fail, Id, Ok, Result, ValueObject } from "../../lib/core";
import { Adapter, _Result, UID } from "../../lib/types";
describe("entity", () => {
describe("simple entity", () => {
interface Props { id?: string, foo: string };
class EntitySample extends Entity<Props> {
private constructor(props... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/tests/core/events.spec.ts | tests/core/events.spec.ts | import TsEvents from '../../lib/core/events';
import { EventHandler } from '../../lib/types';
describe('events', () => {
it('should create instance with success', () => {
const instance = new TsEvents({ name: 'Jane', age: 21 });
expect(instance.metrics.totalDispatched()).toBe(0);
expect(in... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/tests/core/auto-mapper.spec.ts | tests/core/auto-mapper.spec.ts | import { Aggregate, AutoMapper, Entity, Id, ID, Iterator, Ok, Result, ValueObject } from "../../lib/core";
import { UID } from "../../lib/types";
describe('auto-mapper', () => {
describe('value-object', () => {
it('should convert value to a simple string', () => {
class StringVo extends ValueObject<{ value: s... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/tests/core/context.spec.ts | tests/core/context.spec.ts | import { Aggregate, Ok, Result, Context } from "../../lib/core";
import { EventHandler } from "../../lib/types";
describe('context', () => {
// Define User class outside of test blocks for reusability
type Props = { name: string };
class User extends Aggregate<Props> {
private constructor(props: ... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/tests/core/fail.spec.ts | tests/core/fail.spec.ts | import Fail from "../../lib/core/fail";
import Result from "../../lib/core/result";
describe('fail', () => {
it('should create a simple no args failure', () => {
const result = Fail();
expect(result.isOk()).toBeFalsy();
expect(result.isFail()).toBeTruthy();
});
it('should create a simple failure', () => {
... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/tests/core/id.spec.ts | tests/core/id.spec.ts | import { ID, Id, id } from "../../lib/core"
describe('ID', () => {
describe('UUID', () => {
it('should create a new uuid if not provide value', () => {
const uuid = ID.create();
expect(uuid).toBeDefined();
expect(uuid.isNew()).toBeTruthy();
});
it('should create different ids', () => {
const uuid1 ... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/tests/core/value-object.spec.ts | tests/core/value-object.spec.ts | import { Class, Ok, Result, ValueObject } from "../../lib/core";
import { Adapter, ICommand, _Result } from "../../lib/types";
import { Utils, Validator } from "../../lib/utils";
describe('value-object', () => {
describe('native static methods', () => {
interface Props {
value: string;
}
class GenericVo ex... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/tests/core/result.spec.ts | tests/core/result.spec.ts | import { Fail, Ok, Result } from "../../lib/core";
import { ICommand, Payload } from "../../lib/types";
describe('result', () => {
type Args = string | void;
type CustomPayload = string;
class Command implements ICommand<Args, CustomPayload> {
execute(args?: Args): CustomPayload {
return args ?? 'no args pro... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/tests/core/adapter.spec.ts | tests/core/adapter.spec.ts | import { ValueObject, Entity, Result, Ok, Fail } from '../../lib/core';
import { Adapter, _Adapter, _Result } from '../../lib/types';
describe('adapter v1', () => {
interface NameProps { value: string; };
class DomainName extends ValueObject<NameProps> {
private constructor(props: NameProps) {
super(props);
... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/tests/core/iterator.spec.ts | tests/core/iterator.spec.ts | import { Iterator } from "../../lib/core";
describe('iterator', () => {
describe('create with no params', () => {
const iterator: Iterator<number> = Iterator.create();
it('should add chained', () => {
iterator.add(1).add(2).add(3).add(4).add(5).add(6).add(7);
expect(iterator.total()).toBe(7);
});
it('... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/tests/core/getters.spec.ts | tests/core/getters.spec.ts | import { GettersAndSetters } from '../../lib/core/index';
describe('getters and setters', () => {
class Def extends GettersAndSetters<any>{
getConfig() {
return this.config;
}
};
it('should be active by default', () => {
const gettersAndSetters = new Def({}, 'ValueObject');
expect(gettersAndSetters.ge... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/tests/core/crypto.spec.ts | tests/core/crypto.spec.ts | import { UUID } from '../../lib/core/crypto';
describe('randomUUID', () => {
it('should generate random uuid', () => {
const id = UUID();
expect(id).toHaveLength(36);
});
it('should generate many unique', () => {
const map = new Map();
let i = 0;
while (i < 300) {
map.set(i, UUID());
i++;
}
ex... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/tests/core/ok.spec.ts | tests/core/ok.spec.ts | import Ok from "../../lib/core/ok";
import Result from "../../lib/core/result";
describe('ok', () => {
it('should create a simple success with no args', () => {
const result = Ok();
expect(result.isOk()).toBeTruthy();
expect(result.isFail()).toBeFalsy();
});
it('should create a simple success with null valu... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/tests/core/aggregate.spec.ts | tests/core/aggregate.spec.ts | import { Aggregate, ID, Ok, Result, TsEvents, ValueObject } from "../../lib/core";
import { DEvent, EventHandler, _Result, Settings, UID } from "../../lib/types";
describe('aggregate', () => {
describe('aggregate native methods', () => {
interface Props {
id: string;
name: string;
}
class AggregateErr ... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/example/index.ts | example/index.ts | import assert from 'node:assert/strict';
import { Result, ValueObject } from '../dist/core/index';
interface Props { value: number };
export class MyValueObject extends ValueObject<Props>{
private constructor(props: Props) {
super(props);
}
validation(): boolean {
return false;
}
sum(value: number): number... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/lib/types-util.ts | lib/types-util.ts | /**
* A utility type to recursively make all properties of a type `T` deeply readonly.
* - Handles built-in types, objects, arrays, tuples, sets, and maps.
* - Special cases include skipping class constructors and functions.
*
* @template T The type to be made deeply readonly.
*/
export type ReadonlyDeep<T> =
... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/lib/types.ts | lib/types.ts | import { Entity, ValueObject } from "./core";
import { BuiltIns, ReadonlyDeep } from "./types-util";
/**
* @description Represents a generic event with a detail property for storing event-specific data.
*/
export type Event = { detail: any[] };
/**
* @abstract
* @description Abstract class defining the structure ... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/lib/index.ts | lib/index.ts | export * from './core/index';
export * from './utils/validator';
export * from './types';
export * from './utils/util';
export * from './utils/remove-spaces.util';
export * from './utils/remove-chars.util';
export * from './utils/replace-char.util';
export * from './utils/divide-number.util';
export * from './utils/mul... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/lib/utils/remove-spaces.util.ts | lib/utils/remove-spaces.util.ts | import RemoveChars from "./remove-chars.util";
/**
* @description Removes all spaces from a given string. It utilizes the `RemoveChars` utility function,
* passing a condition to identify spaces as the characters to remove.
*
* @param target The input string from which spaces will be removed.
*
* @returns A ne... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/lib/utils/remove-chars.util.ts | lib/utils/remove-chars.util.ts | /**
* @description Removes characters from a string based on a condition defined by the provided `IsChar` function.
*
* @param target The input string from which characters will be removed.
* @param IsChar A callback function that determines whether a character should be removed.
* It receives a character as inpu... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/lib/utils/divide-number.util.ts | lib/utils/divide-number.util.ts | import EnsureNumber from "./ensure-number";
import IsNaN from "./is-nan.util";
import Float from "./normalize-number.util";
import ToLong from "./to-long-number.util";
import ToPrecision from "./to-precision.util";
/**
* @description Divides two numbers (`valueA` by `valueB`) with support for validation and normaliza... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/lib/utils/stringify.util.ts | lib/utils/stringify.util.ts | const { stringify: $stringify } = JSON;
const { keys } = Object;
const Primitive = String; // Could also be Number
const primitive = 'string'; // Could also be 'number'
const ignore = {};
const object = 'object';
const noop = (_, value) => value;
/**
* @description Revives an object from a parsed structure, rest... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/lib/utils/util.ts | lib/utils/util.ts | import validator, { Validator } from "./validator";
import RemoveSpaces from "./remove-spaces.util";
import RemoveChars from "./remove-chars.util";
import Replace from "./replace-char.util";
import Multiply from "./multiply-number.util";
import Divide from "./divide-number.util";
import Subtract from "./subtract-number... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/lib/utils/to-decimal-number.util.ts | lib/utils/to-decimal-number.util.ts | /**
* @description Converts a number to its decimal equivalent by dividing it by 100.
* This is useful for normalizing values, such as converting percentages to decimals.
*
* @param value The input value to convert. Must be a number.
*
* @returns The decimal equivalent of the input number.
* If the input is n... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/lib/utils/is-nan.util.ts | lib/utils/is-nan.util.ts | /**
* @description Checks if the provided value is `NaN` (Not-a-Number). The function attempts to parse the value into a number
* and determines if the result is `NaN`.
*
* @param value The value to check. Can be a string or a number.
*
* @returns `true` if the value is `NaN`, otherwise `false`.
*
* @example... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/lib/utils/validate-context-event-name.util.ts | lib/utils/validate-context-event-name.util.ts | /**
* @description Validates the format of an event name to ensure it follows the required pattern.
* The expected pattern is `"contextName:EventName"`, where the event name must include a colon (`":"`)
* to separate the context name and the event name.
*
* @param eventName The event name to validate. Must be a s... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/lib/utils/ensure-number.ts | lib/utils/ensure-number.ts | import IsNaN from "./is-nan.util";
/**
* @description Ensures the input is a valid number. If the input is `NaN` or `Infinity`, it returns `0`.
*
* @param value The number to validate.
*
* @returns The original number if it is valid, or `0` if the input is `NaN` or `Infinity`.
*
* @example
* ```typescript
... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/lib/utils/decrement-time.util.ts | lib/utils/decrement-time.util.ts | import { ONE_DAY, ONE_HOUR, ONE_MINUTE, ONE_MONTH, ONE_WEEK, ONE_YEAR, Unit } from "../types";
/**
* @description Decreases a given date by a specified amount of time based on the unit provided.
*
* @param date The starting date from which the time will be decremented.
* @param value The number of units to decrem... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/lib/utils/to-long-number.util.ts | lib/utils/to-long-number.util.ts | /**
* @description Converts a number to its "long" equivalent by multiplying it by 100.
* This is useful for denormalizing values, such as converting decimals to percentages.
*
* @param value The input value to convert. Must be a number.
*
* @returns The "long" equivalent of the input number.
* If the input is... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/lib/utils/normalize-number.util.ts | lib/utils/normalize-number.util.ts | import IsNaN from "./is-nan.util";
/**
* @description Normalizes a value into a floating-point number (`float`).
* If the value is a string representation of a number, it parses it into a `float`.
* If the value is already a number, it returns the value as is.
* If the value is invalid (`NaN` or non-numeric), i... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/lib/utils/platform.util.ts | lib/utils/platform.util.ts | /**
* @description Utility object to detect the runtime environment. It provides methods to determine
* whether the current platform is Node.js or a browser environment.
*/
export const platform = {
/**
* @description Checks if the runtime environment is Node.js.
*
* @param process The global `p... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/lib/utils/validator.ts | lib/utils/validator.ts | import { Aggregate, Entity, ID, ValueObject } from "../core";
import { stringify } from '../utils/stringify.util';
/**
* @description A utility class for validating various data types, including numbers, strings, objects, dates, and more.
* Provides methods to check the type and properties of values, as well as to ... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/lib/utils/deep-freeze.util.ts | lib/utils/deep-freeze.util.ts | /**
* @description Recursively freezes an object to make it immutable. This prevents any modifications to the object or its nested properties.
*
* @typeParam T - The type of the object being frozen.
*
* @param obj The object to be deeply frozen. If the input is not an object, it is returned as is.
*
* @return... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/lib/utils/index.ts | lib/utils/index.ts | export * from './validator';
export * from './util';
export * from './remove-spaces.util';
export * from './remove-chars.util';
export * from './replace-char.util';
export * from './divide-number.util';
export * from './multiply-number.util';
export * from './subtract-number.util';
export * from './sum-number.util';
ex... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/lib/utils/replace-char.util.ts | lib/utils/replace-char.util.ts | /**
* @description Replaces all occurrences of a specified character in a string with a given value.
* The replacement is performed globally (all occurrences).
*
* @param target The string in which the replacements will be made.
* @param char The character or substring to replace. A global regular expression wil... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/lib/utils/to-precision.util.ts | lib/utils/to-precision.util.ts | /**
* @description Adjusts a number or numeric string to a specified precision. The function ensures that the
* result maintains the desired level of precision, handling both integer and decimal parts appropriately.
*
* @param value The input value to be adjusted. Can be a number or a numeric string.
* @param pr... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/lib/utils/increment-time.util.ts | lib/utils/increment-time.util.ts | import { ONE_DAY, ONE_HOUR, ONE_MINUTE, ONE_MONTH, ONE_WEEK, ONE_YEAR, Unit } from "../types";
/**
* @description Increments a given date by a specified amount of time based on the unit provided.
*
* @param date The starting date to increment.
* @param value The number of units to increment. If not a valid number... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/lib/utils/subtract-number.util.ts | lib/utils/subtract-number.util.ts | import EnsureNumber from "./ensure-number";
import IsNaN from "./is-nan.util";
import Float from "./normalize-number.util";
import ToDecimal from "./to-decimal-number.util";
import ToLong from "./to-long-number.util";
import ToPrecision from "./to-precision.util";
/**
* @description Subtracts one number (`valueB`) fr... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/lib/utils/sum-number.util.ts | lib/utils/sum-number.util.ts | import EnsureNumber from "./ensure-number";
import IsNaN from "./is-nan.util";
import Float from "./normalize-number.util";
import ToDecimal from "./to-decimal-number.util";
import ToLong from "./to-long-number.util";
import ToPrecision from "./to-precision.util";
/**
* @description Adds two numbers (`valueA` and `va... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/lib/utils/multiply-number.util.ts | lib/utils/multiply-number.util.ts | import EnsureNumber from "./ensure-number";
import IsNaN from "./is-nan.util";
import Float from "./normalize-number.util";
import ToDecimal from "./to-decimal-number.util";
import ToLong from "./to-long-number.util";
import ToPrecision from "./to-precision.util";
/**
* @description Multiplies two numbers (`valueA` a... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/lib/core/browser-event-manager.ts | lib/core/browser-event-manager.ts | import { Event, EventManager, EventType } from "../types";
import validateContextEventName from "../utils/validate-context-event-name.util";
/**
* @description BrowserEventManager provides a global event management system
* utilizing the browser's Window and Event mechanisms. It allows subscribing to
* events tha... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/lib/core/ok.ts | lib/core/ok.ts | import { _Result } from "../types";
import Result from "./result";
/**
* @description Creates a `Result` instance representing a success state.
*
* The `Ok` function returns a result indicating that an operation has succeeded.
* Optionally, it can include a payload (`data`) representing the successful result
* a... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/lib/core/server-event-manager.ts | lib/core/server-event-manager.ts | import { EventEmitter } from "events";
import { Event, EventManager, EventType } from "../types";
import validateContextEventName from "../utils/validate-context-event-name.util";
/**
* @class ServerEventManager
* @description A singleton class to manage server-side events. This class ensures that event listeners ar... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/lib/core/id.ts | lib/core/id.ts | import { UUID } from './crypto';
import { UID } from "../types";
/**
* @description Represents a unique identifier for Entities or Aggregates, providing methods
* to generate and manipulate ID values, including the ability to create new IDs, convert them
* to a shorter format, clone them, and check for equality.
... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
4lessandrodev/rich-domain | https://github.com/4lessandrodev/rich-domain/blob/3b3cf7c211fadfd9807e0a74389260baa79051c1/lib/core/auto-mapper.ts | lib/core/auto-mapper.ts | import { AutoMapperSerializer, EntityMapperPayload, _AutoMapper, _Entity, _ValueObject } from "../types";
import { Validator } from "../utils";
import ID from "./id";
/**
* @description The AutoMapper class is responsible for transforming domain resources (entities, value objects)
* into plain objects or primitive ... | typescript | MIT | 3b3cf7c211fadfd9807e0a74389260baa79051c1 | 2026-01-05T05:01:27.440427Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.