trimmedRange() — drizzle-orm Function Reference
Architecture documentation for the trimmedRange() function in views.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD 8c73740c_ec23_fcc8_175c_f81fe951dd2b["trimmedRange()"] 217e2cbd_4fb7_ceab_251c_5733ece08a8f["views.ts"] 8c73740c_ec23_fcc8_175c_f81fe951dd2b -->|defined in| 217e2cbd_4fb7_ceab_251c_5733ece08a8f 5300a679_d9ea_0981_226a_556588f8f2d0["render()"] 5300a679_d9ea_0981_226a_556588f8f2d0 -->|calls| 8c73740c_ec23_fcc8_175c_f81fe951dd2b style 8c73740c_ec23_fcc8_175c_f81fe951dd2b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
drizzle-kit/src/cli/views.ts lines 627–658
export const trimmedRange = <T>(
arr: T[],
index: number,
limitLines: number,
): {
trimmed: T[];
offset: number;
startTrimmed: boolean;
endTrimmed: boolean;
} => {
const limit = limitLines - 2;
const sideLimit = Math.round(limit / 2);
const endTrimmed = arr.length - sideLimit > index;
const startTrimmed = index > sideLimit - 1;
const paddingStart = Math.max(index + sideLimit - arr.length, 0);
const paddingEnd = Math.min(index - sideLimit + 1, 0);
const d1 = endTrimmed ? 1 : 0;
const d2 = startTrimmed ? 0 : 1;
const start = Math.max(0, index - sideLimit + d1 - paddingStart);
const end = Math.min(arr.length, index + sideLimit + d2 - paddingEnd);
return {
trimmed: arr.slice(start, end),
offset: start,
startTrimmed,
endTrimmed,
};
};
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does trimmedRange() do?
trimmedRange() is a function in the drizzle-orm codebase, defined in drizzle-kit/src/cli/views.ts.
Where is trimmedRange() defined?
trimmedRange() is defined in drizzle-kit/src/cli/views.ts at line 627.
What calls trimmedRange()?
trimmedRange() is called by 1 function(s): render.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free