@kakasoo/sortable
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "@kakasoo/sortable", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "private": false, |
@@ -1,9 +0,12 @@ | ||
import { DeepStrictObjectKeys } from "@kakasoo/deep-strict-types"; | ||
import { StringPrototype } from "@kakasoo/proto-typescript"; | ||
import { StringPrototype, StringType } from "@kakasoo/proto-typescript"; | ||
import { StringToDeepObject } from "./types"; | ||
export function getSortable<T extends object>( | ||
key: DeepStrictObjectKeys<T>, | ||
direction: "asc" | "desc" | ||
) { | ||
const sortable: Record<string, any> = {}; | ||
export function getSortable< | ||
Key extends string, | ||
Direction extends "asc" | "desc" | ||
>( | ||
key: Key, | ||
direction: Direction | ||
): StringToDeepObject<StringType.Split<Key, ".">, Direction> { | ||
const sortable: any = {}; | ||
const keys = StringPrototype.split(key, "."); | ||
@@ -10,0 +13,0 @@ keys.reduce((acc, key, index, arr) => { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14292
5
152