@poap-xyz/utils
Advanced tools
Comparing version 0.2.1-beta-v5 to 0.2.1-beta-v6
@@ -6,3 +6,3 @@ 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, filterZeroAddress: boolean, value?: string): FieldFilter<Partial<EqFilter<string>> & Partial<NeqFilter<string>>>; | ||
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 createInFilter(key: string, values?: Array<Value>): FieldFilter<InFilter>; | ||
@@ -9,0 +9,0 @@ export declare function createNinFilter(key: string, values?: Array<Value>): FieldFilter<NinFilter>; |
@@ -6,3 +6,3 @@ 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, filterZeroAddress: boolean, value?: string): FieldFilter<Partial<EqFilter<string>> & Partial<NeqFilter<string>>>; | ||
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 createInFilter(key: string, values?: Array<Value>): FieldFilter<InFilter>; | ||
@@ -9,0 +9,0 @@ export declare function createNinFilter(key: string, values?: Array<Value>): FieldFilter<NinFilter>; |
@@ -53,9 +53,20 @@ (function (global, factory) { | ||
} | ||
function createAddressFilter(key, filterZeroAddress, value) { | ||
return filterZeroAddress || value | ||
function createAddressFilter(key, value, filterZeroAddress, filterDeadAddress) { | ||
return filterZeroAddress || filterDeadAddress || value | ||
? { | ||
[key]: { | ||
...(filterZeroAddress | ||
...(filterZeroAddress && filterDeadAddress | ||
? { | ||
_nin: [ | ||
'0x0000000000000000000000000000000000000000', | ||
'0x000000000000000000000000000000000000dead', | ||
], | ||
} | ||
: {}), | ||
...(filterZeroAddress && !filterDeadAddress | ||
? { _neq: '0x0000000000000000000000000000000000000000' } | ||
: {}), | ||
...(!filterZeroAddress && filterDeadAddress | ||
? { _neq: '0x000000000000000000000000000000000000dead' } | ||
: {}), | ||
...(value ? { _eq: value.toLowerCase() } : {}), | ||
@@ -62,0 +73,0 @@ }, |
@@ -6,3 +6,3 @@ 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, filterZeroAddress: boolean, value?: string): FieldFilter<Partial<EqFilter<string>> & Partial<NeqFilter<string>>>; | ||
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 createInFilter(key: string, values?: Array<Value>): FieldFilter<InFilter>; | ||
@@ -9,0 +9,0 @@ export declare function createNinFilter(key: string, values?: Array<Value>): FieldFilter<NinFilter>; |
{ | ||
"name": "@poap-xyz/utils", | ||
"version": "0.2.1-beta-v5", | ||
"version": "0.2.1-beta-v6", | ||
"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
55899
672