@poap-xyz/utils
Advanced tools
Comparing version 0.2.1-beta-v7 to 0.2.1-beta-v8
@@ -6,3 +6,4 @@ import { EqFilter, FieldFilter, GtFilter, GteFilter, InFilter, LikeFilter, LtFilter, LteFilter, NeqFilter, NinFilter, Value } from '../types/filter'; | ||
export declare function createBoolFilter(key: string, value?: boolean): FieldFilter<EqFilter<'true' | 'false'>>; | ||
export declare function createAddressFilter(key: string, value?: string, filterZeroAddress?: boolean, filterDeadAddress?: boolean): FieldFilter<Partial<EqFilter<string>> & Partial<NeqFilter<string>> & Partial<NinFilter<string>>>; | ||
export declare function createAddressFilter(key: string, value?: string): FieldFilter<Partial<EqFilter<string>>>; | ||
export declare function createNotNullAddressFilter(key: string, filterZeroAddress?: boolean, filterDeadAddress?: boolean): FieldFilter<Partial<NeqFilter<string>> & Partial<NinFilter<string>>>; | ||
export declare function createInFilter(key: string, values?: Array<Value>): FieldFilter<InFilter>; | ||
@@ -9,0 +10,0 @@ export declare function createNinFilter(key: string, values?: Array<Value>): FieldFilter<NinFilter>; |
@@ -1,4 +0,2 @@ | ||
import { Order } from '../types/order'; | ||
export declare function createOrderBy<E extends string = string>(key: E | undefined, value?: Order | undefined): { | ||
[key: string]: Order; | ||
}; | ||
import { Order, OrderBy } from '../types/order'; | ||
export declare function createOrderBy<E extends string = string>(key: E | undefined, value?: Order | undefined): OrderBy; |
@@ -5,8 +5,7 @@ export declare enum Order { | ||
} | ||
export interface OrderBy { | ||
[key: string]: Order; | ||
} | ||
export interface OrderByVariables { | ||
orderBy: { | ||
[key: string]: Order; | ||
} | Array<{ | ||
[key: string]: Order; | ||
}>; | ||
orderBy: OrderBy | Array<OrderBy>; | ||
} |
@@ -6,3 +6,4 @@ import { EqFilter, FieldFilter, GtFilter, GteFilter, InFilter, LikeFilter, LtFilter, LteFilter, NeqFilter, NinFilter, Value } from '../types/filter'; | ||
export declare function createBoolFilter(key: string, value?: boolean): FieldFilter<EqFilter<'true' | 'false'>>; | ||
export declare function createAddressFilter(key: string, value?: string, filterZeroAddress?: boolean, filterDeadAddress?: boolean): FieldFilter<Partial<EqFilter<string>> & Partial<NeqFilter<string>> & Partial<NinFilter<string>>>; | ||
export declare function createAddressFilter(key: string, value?: string): FieldFilter<Partial<EqFilter<string>>>; | ||
export declare function createNotNullAddressFilter(key: string, filterZeroAddress?: boolean, filterDeadAddress?: boolean): FieldFilter<Partial<NeqFilter<string>> & Partial<NinFilter<string>>>; | ||
export declare function createInFilter(key: string, values?: Array<Value>): FieldFilter<InFilter>; | ||
@@ -9,0 +10,0 @@ export declare function createNinFilter(key: string, values?: Array<Value>): FieldFilter<NinFilter>; |
@@ -1,4 +0,2 @@ | ||
import { Order } from '../types/order'; | ||
export declare function createOrderBy<E extends string = string>(key: E | undefined, value?: Order | undefined): { | ||
[key: string]: Order; | ||
}; | ||
import { Order, OrderBy } from '../types/order'; | ||
export declare function createOrderBy<E extends string = string>(key: E | undefined, value?: Order | undefined): OrderBy; |
@@ -5,8 +5,7 @@ export declare enum Order { | ||
} | ||
export interface OrderBy { | ||
[key: string]: Order; | ||
} | ||
export interface OrderByVariables { | ||
orderBy: { | ||
[key: string]: Order; | ||
} | Array<{ | ||
[key: string]: Order; | ||
}>; | ||
orderBy: OrderBy | Array<OrderBy>; | ||
} |
@@ -53,21 +53,7 @@ (function (global, factory) { | ||
} | ||
function createAddressFilter(key, value, filterZeroAddress, filterDeadAddress) { | ||
return filterZeroAddress || filterDeadAddress || value | ||
function createAddressFilter(key, value) { | ||
return value | ||
? { | ||
[key]: { | ||
...(filterZeroAddress && filterDeadAddress | ||
? { | ||
_nin: [ | ||
'0x0000000000000000000000000000000000000000', | ||
'0x000000000000000000000000000000000000dead', | ||
], | ||
} | ||
: {}), | ||
...(filterZeroAddress && !filterDeadAddress | ||
? { _neq: '0x0000000000000000000000000000000000000000' } | ||
: {}), | ||
...(!filterZeroAddress && filterDeadAddress | ||
? { _neq: '0x000000000000000000000000000000000000dead' } | ||
: {}), | ||
...(value ? { _eq: value.toLowerCase() } : {}), | ||
_eq: value.toLowerCase(), | ||
}, | ||
@@ -77,2 +63,21 @@ } | ||
} | ||
function createNotNullAddressFilter(key, filterZeroAddress = true, filterDeadAddress = true) { | ||
if (filterZeroAddress && filterDeadAddress) { | ||
return { | ||
[key]: { | ||
_nin: [ | ||
'0x0000000000000000000000000000000000000000', | ||
'0x000000000000000000000000000000000000dead', | ||
], | ||
}, | ||
}; | ||
} | ||
if (filterZeroAddress) { | ||
return { [key]: { _neq: '0x0000000000000000000000000000000000000000' } }; | ||
} | ||
if (filterDeadAddress) { | ||
return { [key]: { _neq: '0x000000000000000000000000000000000000dead' } }; | ||
} | ||
return {}; | ||
} | ||
function createInFilter(key, values) { | ||
@@ -130,2 +135,3 @@ return values && values.length > 0 ? { [key]: { _in: values } } : {}; | ||
exports.createNinFilter = createNinFilter; | ||
exports.createNotNullAddressFilter = createNotNullAddressFilter; | ||
exports.createOrderBy = createOrderBy; | ||
@@ -132,0 +138,0 @@ exports.isNumeric = isNumeric; |
@@ -6,3 +6,4 @@ import { EqFilter, FieldFilter, GtFilter, GteFilter, InFilter, LikeFilter, LtFilter, LteFilter, NeqFilter, NinFilter, Value } from '../types/filter'; | ||
export declare function createBoolFilter(key: string, value?: boolean): FieldFilter<EqFilter<'true' | 'false'>>; | ||
export declare function createAddressFilter(key: string, value?: string, filterZeroAddress?: boolean, filterDeadAddress?: boolean): FieldFilter<Partial<EqFilter<string>> & Partial<NeqFilter<string>> & Partial<NinFilter<string>>>; | ||
export declare function createAddressFilter(key: string, value?: string): FieldFilter<Partial<EqFilter<string>>>; | ||
export declare function createNotNullAddressFilter(key: string, filterZeroAddress?: boolean, filterDeadAddress?: boolean): FieldFilter<Partial<NeqFilter<string>> & Partial<NinFilter<string>>>; | ||
export declare function createInFilter(key: string, values?: Array<Value>): FieldFilter<InFilter>; | ||
@@ -9,0 +10,0 @@ export declare function createNinFilter(key: string, values?: Array<Value>): FieldFilter<NinFilter>; |
@@ -1,4 +0,2 @@ | ||
import { Order } from '../types/order'; | ||
export declare function createOrderBy<E extends string = string>(key: E | undefined, value?: Order | undefined): { | ||
[key: string]: Order; | ||
}; | ||
import { Order, OrderBy } from '../types/order'; | ||
export declare function createOrderBy<E extends string = string>(key: E | undefined, value?: Order | undefined): OrderBy; |
@@ -5,8 +5,7 @@ export declare enum Order { | ||
} | ||
export interface OrderBy { | ||
[key: string]: Order; | ||
} | ||
export interface OrderByVariables { | ||
orderBy: { | ||
[key: string]: Order; | ||
} | Array<{ | ||
[key: string]: Order; | ||
}>; | ||
orderBy: OrderBy | Array<OrderBy>; | ||
} |
{ | ||
"name": "@poap-xyz/utils", | ||
"version": "0.2.1-beta-v7", | ||
"version": "0.2.1-beta-v8", | ||
"description": "Utils module for the poap.js library", | ||
@@ -5,0 +5,0 @@ "main": "dist/cjs/index.cjs", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
689
55963