@poap-xyz/utils
Advanced tools
Comparing version 0.2.1-beta-v4 to 0.2.1-beta-v5
@@ -1,9 +0,11 @@ | ||
import { EqFilter, FieldFilter, GteFilter, InFilter, LikeFilter, LteFilter, NeqFilter, NinFilter } from '../types/filter'; | ||
export declare function createLikeFilter(key: string, value?: string): FieldFilter<LikeFilter>; | ||
export declare function createEqFilter(key: string, value?: string | number): FieldFilter<EqFilter>; | ||
export declare function createNeqFilter(key: string, value?: string | number): FieldFilter<NeqFilter>; | ||
import { EqFilter, FieldFilter, GtFilter, GteFilter, InFilter, LikeFilter, LtFilter, LteFilter, NeqFilter, NinFilter, Value } from '../types/filter'; | ||
export declare function createLikeFilter(key: string, value?: Value): FieldFilter<LikeFilter>; | ||
export declare function createEqFilter(key: string, value?: Value): FieldFilter<EqFilter>; | ||
export declare function createNeqFilter(key: string, value?: Value): FieldFilter<NeqFilter>; | ||
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> & Partial<NeqFilter>>; | ||
export declare function createInFilter(key: string, values?: Array<string | number | boolean>): FieldFilter<InFilter>; | ||
export declare function createNinFilter(key: string, values?: Array<string | number | boolean>): FieldFilter<NinFilter>; | ||
export declare function createBetweenFilter(key: string, from?: string, to?: string): FieldFilter<Partial<GteFilter> & Partial<LteFilter>>; | ||
export declare function createAddressFilter(key: string, filterZeroAddress: boolean, value?: string): FieldFilter<Partial<EqFilter<string>> & Partial<NeqFilter<string>>>; | ||
export declare function createInFilter(key: string, values?: Array<Value>): FieldFilter<InFilter>; | ||
export declare function createNinFilter(key: string, values?: Array<Value>): FieldFilter<NinFilter>; | ||
export declare function createLtFilter(key: string, value?: Value): FieldFilter<LtFilter>; | ||
export declare function createGtFilter(key: string, value?: Value): FieldFilter<GtFilter>; | ||
export declare function createBetweenFilter(key: string, from?: Value, to?: Value): FieldFilter<Partial<GteFilter> & Partial<LteFilter>>; |
@@ -1,2 +0,2 @@ | ||
type Value = string | number | boolean; | ||
export type Value = string | number | boolean; | ||
export interface EqFilter<V = Value> { | ||
@@ -44,2 +44,1 @@ _eq: V; | ||
} | ||
export {}; |
@@ -1,9 +0,11 @@ | ||
import { EqFilter, FieldFilter, GteFilter, InFilter, LikeFilter, LteFilter, NeqFilter, NinFilter } from '../types/filter'; | ||
export declare function createLikeFilter(key: string, value?: string): FieldFilter<LikeFilter>; | ||
export declare function createEqFilter(key: string, value?: string | number): FieldFilter<EqFilter>; | ||
export declare function createNeqFilter(key: string, value?: string | number): FieldFilter<NeqFilter>; | ||
import { EqFilter, FieldFilter, GtFilter, GteFilter, InFilter, LikeFilter, LtFilter, LteFilter, NeqFilter, NinFilter, Value } from '../types/filter'; | ||
export declare function createLikeFilter(key: string, value?: Value): FieldFilter<LikeFilter>; | ||
export declare function createEqFilter(key: string, value?: Value): FieldFilter<EqFilter>; | ||
export declare function createNeqFilter(key: string, value?: Value): FieldFilter<NeqFilter>; | ||
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> & Partial<NeqFilter>>; | ||
export declare function createInFilter(key: string, values?: Array<string | number | boolean>): FieldFilter<InFilter>; | ||
export declare function createNinFilter(key: string, values?: Array<string | number | boolean>): FieldFilter<NinFilter>; | ||
export declare function createBetweenFilter(key: string, from?: string, to?: string): FieldFilter<Partial<GteFilter> & Partial<LteFilter>>; | ||
export declare function createAddressFilter(key: string, filterZeroAddress: boolean, value?: string): FieldFilter<Partial<EqFilter<string>> & Partial<NeqFilter<string>>>; | ||
export declare function createInFilter(key: string, values?: Array<Value>): FieldFilter<InFilter>; | ||
export declare function createNinFilter(key: string, values?: Array<Value>): FieldFilter<NinFilter>; | ||
export declare function createLtFilter(key: string, value?: Value): FieldFilter<LtFilter>; | ||
export declare function createGtFilter(key: string, value?: Value): FieldFilter<GtFilter>; | ||
export declare function createBetweenFilter(key: string, from?: Value, to?: Value): FieldFilter<Partial<GteFilter> & Partial<LteFilter>>; |
@@ -1,2 +0,2 @@ | ||
type Value = string | number | boolean; | ||
export type Value = string | number | boolean; | ||
export interface EqFilter<V = Value> { | ||
@@ -44,2 +44,1 @@ _eq: V; | ||
} | ||
export {}; |
@@ -66,7 +66,13 @@ (function (global, factory) { | ||
function createInFilter(key, values) { | ||
return values && values.length ? { [key]: { _in: values } } : {}; | ||
return values && values.length > 0 ? { [key]: { _in: values } } : {}; | ||
} | ||
function createNinFilter(key, values) { | ||
return values && values.length ? { [key]: { _nin: values } } : {}; | ||
return values && values.length > 0 ? { [key]: { _nin: values } } : {}; | ||
} | ||
function createLtFilter(key, value) { | ||
return value ? { [key]: { _lt: value } } : {}; | ||
} | ||
function createGtFilter(key, value) { | ||
return value ? { [key]: { _gt: value } } : {}; | ||
} | ||
function createBetweenFilter(key, from, to) { | ||
@@ -106,4 +112,6 @@ const betweenFilter = {}; | ||
exports.createEqFilter = createEqFilter; | ||
exports.createGtFilter = createGtFilter; | ||
exports.createInFilter = createInFilter; | ||
exports.createLikeFilter = createLikeFilter; | ||
exports.createLtFilter = createLtFilter; | ||
exports.createNeqFilter = createNeqFilter; | ||
@@ -110,0 +118,0 @@ exports.createNinFilter = createNinFilter; |
@@ -1,9 +0,11 @@ | ||
import { EqFilter, FieldFilter, GteFilter, InFilter, LikeFilter, LteFilter, NeqFilter, NinFilter } from '../types/filter'; | ||
export declare function createLikeFilter(key: string, value?: string): FieldFilter<LikeFilter>; | ||
export declare function createEqFilter(key: string, value?: string | number): FieldFilter<EqFilter>; | ||
export declare function createNeqFilter(key: string, value?: string | number): FieldFilter<NeqFilter>; | ||
import { EqFilter, FieldFilter, GtFilter, GteFilter, InFilter, LikeFilter, LtFilter, LteFilter, NeqFilter, NinFilter, Value } from '../types/filter'; | ||
export declare function createLikeFilter(key: string, value?: Value): FieldFilter<LikeFilter>; | ||
export declare function createEqFilter(key: string, value?: Value): FieldFilter<EqFilter>; | ||
export declare function createNeqFilter(key: string, value?: Value): FieldFilter<NeqFilter>; | ||
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> & Partial<NeqFilter>>; | ||
export declare function createInFilter(key: string, values?: Array<string | number | boolean>): FieldFilter<InFilter>; | ||
export declare function createNinFilter(key: string, values?: Array<string | number | boolean>): FieldFilter<NinFilter>; | ||
export declare function createBetweenFilter(key: string, from?: string, to?: string): FieldFilter<Partial<GteFilter> & Partial<LteFilter>>; | ||
export declare function createAddressFilter(key: string, filterZeroAddress: boolean, value?: string): FieldFilter<Partial<EqFilter<string>> & Partial<NeqFilter<string>>>; | ||
export declare function createInFilter(key: string, values?: Array<Value>): FieldFilter<InFilter>; | ||
export declare function createNinFilter(key: string, values?: Array<Value>): FieldFilter<NinFilter>; | ||
export declare function createLtFilter(key: string, value?: Value): FieldFilter<LtFilter>; | ||
export declare function createGtFilter(key: string, value?: Value): FieldFilter<GtFilter>; | ||
export declare function createBetweenFilter(key: string, from?: Value, to?: Value): FieldFilter<Partial<GteFilter> & Partial<LteFilter>>; |
@@ -1,2 +0,2 @@ | ||
type Value = string | number | boolean; | ||
export type Value = string | number | boolean; | ||
export interface EqFilter<V = Value> { | ||
@@ -44,2 +44,1 @@ _eq: V; | ||
} | ||
export {}; |
{ | ||
"name": "@poap-xyz/utils", | ||
"version": "0.2.1-beta-v4", | ||
"version": "0.2.1-beta-v5", | ||
"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
51437
639