@karmaniverous/entity-tools
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -9,2 +9,3 @@ 'use strict'; | ||
* | ||
* @typeParam P - Entity property type. Defaults to {@link DefaultProperty | `DefaultProperty`}. | ||
* @typeParam I - {@link Indexable | `Indexable`} property type. Defaults to {@link DefaultIndexableProperty | `DefaultIndexableProperty`}, and should be specified if necessary. | ||
@@ -11,0 +12,0 @@ * @typeParam E - Entity type. Should be inferred from items. |
@@ -8,2 +8,3 @@ 'use strict'; | ||
* | ||
* @typeParam P - Entity property type. Defaults to {@link DefaultProperty | `DefaultProperty`}. | ||
* @typeParam I - {@link Indexable | `Indexable`} property type. Defaults to {@link DefaultIndexableProperty | `DefaultIndexableProperty`}, and should be specified if necessary. | ||
@@ -10,0 +11,0 @@ * @typeParam E - {@link Entity | `Entity`} type. Should be inferred from items. |
@@ -37,2 +37,3 @@ /** | ||
* @typeParam E - {@link Entity | `Entity`} type. | ||
* @typeParam P - Entity property type. Defaults to {@link DefaultProperty | `DefaultProperty`}. | ||
* @typeParam I - Indexable property type. Defaults to {@link DefaultIndexableProperty | `DefaultIndexableProperty`}. | ||
@@ -56,3 +57,3 @@ * | ||
*/ | ||
type Indexable<E extends Entity, I = DefaultIndexableProperty> = keyof { | ||
type Indexable<E extends Entity<P>, P = DefaultProperty, I = DefaultIndexableProperty> = keyof { | ||
[P in keyof E as E[P] extends I ? P : never]: E[P]; | ||
@@ -64,2 +65,3 @@ }; | ||
* | ||
* @typeParam P - Entity property type. Defaults to {@link DefaultProperty | `DefaultProperty`}. | ||
* @typeParam I - {@link Indexable | `Indexable`} property type. Defaults to {@link DefaultIndexableProperty | `DefaultIndexableProperty`}, and should be specified if necessary. | ||
@@ -81,3 +83,3 @@ * @typeParam E - Entity type. Should be inferred from items. | ||
*/ | ||
declare const sort: <I = DefaultIndexableProperty, E extends Entity = Entity>(items?: E[], index?: Indexable<E, I>[], desc?: { [key in Indexable<E, I>]?: boolean; }) => E[]; | ||
declare const sort: <P = DefaultProperty, I = DefaultIndexableProperty, E extends Entity<P> = Entity<P>>(items?: E[], index?: Indexable<E, P, I>[], desc?: { [key in Indexable<E, P, I>]?: boolean; }) => E[]; | ||
@@ -87,2 +89,3 @@ /** | ||
* | ||
* @typeParam P - Entity property type. Defaults to {@link DefaultProperty | `DefaultProperty`}. | ||
* @typeParam I - {@link Indexable | `Indexable`} property type. Defaults to {@link DefaultIndexableProperty | `DefaultIndexableProperty`}, and should be specified if necessary. | ||
@@ -100,4 +103,4 @@ * @typeParam E - {@link Entity | `Entity`} type. Should be inferred from items. | ||
*/ | ||
declare const uniq: <I = DefaultIndexableProperty, E extends Entity = Entity>(items?: E[], index?: Indexable<E, I>[], delimiter?: string) => E[]; | ||
declare const uniq: <P = DefaultProperty, I = DefaultIndexableProperty, E extends Entity<P> = Entity<P>>(items?: E[], index?: Indexable<E, P, I>[], delimiter?: string) => E[]; | ||
export { type DefaultIndexableProperty, type DefaultProperty, type Entity, type Indexable, sort, uniq }; |
@@ -7,2 +7,3 @@ import { isNumber, isString } from 'radash'; | ||
* | ||
* @typeParam P - Entity property type. Defaults to {@link DefaultProperty | `DefaultProperty`}. | ||
* @typeParam I - {@link Indexable | `Indexable`} property type. Defaults to {@link DefaultIndexableProperty | `DefaultIndexableProperty`}, and should be specified if necessary. | ||
@@ -9,0 +10,0 @@ * @typeParam E - Entity type. Should be inferred from items. |
@@ -6,2 +6,3 @@ import { unique } from 'radash'; | ||
* | ||
* @typeParam P - Entity property type. Defaults to {@link DefaultProperty | `DefaultProperty`}. | ||
* @typeParam I - {@link Indexable | `Indexable`} property type. Defaults to {@link DefaultIndexableProperty | `DefaultIndexableProperty`}, and should be specified if necessary. | ||
@@ -8,0 +9,0 @@ * @typeParam E - {@link Entity | `Entity`} type. Should be inferred from items. |
@@ -130,3 +130,3 @@ { | ||
"types": "dist/index.d.ts", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"dependencies": { | ||
@@ -133,0 +133,0 @@ "radash": "^12.1.0" |
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
15178
227