Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
@kakasoo/sortable
Advanced tools
$ npm i @kakasoo/sortable
This is very simple function to create object for make prisma
orderBy statement.
For example, you can just write user.articles.created_at
as parameter, like below code.
getSortable("user.articles.created_at", "desc"); // { user: { articles: { created_at: "desc" } } }
Because it is a type inference, it is much easier to use if you create and use a function in advance.
namespace IUser {
namespace IRequest {
type SortbaleColumns =
| "user.articles.created_at"
| "user.articles.updated_at";
}
}
export const orderBy = <T extends IUser.IRequest.SortableColumns>(
key: T,
direction: "asc" | "desc"
) => {
return getSortable(
key,
direction
) satisfies Prisma.usersOrderByWithRelationInput;
};
then, You can use like it, Right?
prisma.user.findMany({
orderBy: orderBy("user.articles.created_at", "desc"),
});
interface Example {
user: {
name: string;
createdAt: string;
};
}
// #1
const sortable = createSortable<Example>();
sortable("user.createdAt", "asc"); // It guarantees type inference.
// #2
// also you can use like this:
createSortable<Example>()("user.createdAt", "asc");
FAQs
## getSortable
We found that @kakasoo/sortable demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.