Skip to content

Commit

Permalink
update deps and export types
Browse files Browse the repository at this point in the history
  • Loading branch information
Arcath committed Mar 23, 2021
1 parent 033d14a commit 9c18abd
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 43 deletions.
73 changes: 42 additions & 31 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@
"homepage": "https://github.com/Arcath/sodb",
"devDependencies": {
"@types/crypto-js": "^4.0.1",
"@types/jest": "^26.0.15",
"@types/node": "^14.14.7",
"@types/jest": "^26.0.21",
"@types/node": "^14.14.35",
"coveralls": "^3.1.0",
"jest": "^26.6.3",
"ts-jest": "^26.4.4",
"typescript": "^4.0.5"
"ts-jest": "^26.5.4",
"typescript": "^4.2.3"
},
"dependencies": {
"@arcath/utils": "^0.4.0",
"@arcath/utils": "^0.7.0",
"crypto-js": "^4.0.0"
}
}
14 changes: 7 additions & 7 deletions src/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ type Primative =
number |
Primative[]

type WithIndex<T> = T & {__id: number}
export type WithIndex<T> = T & {__id: number}

type SearchObject<T> = {[P in keyof T]?: SearchQuery<T, P>}
export type SearchObject<T> = {[P in keyof T]?: SearchQuery<T, P>}

type SearchQuery<T, P extends keyof T> =
T[P] |
Expand All @@ -47,7 +47,7 @@ type SearchQuery<T, P extends keyof T> =
FilterFunction<T, P>


interface Filters<T>{
export interface Filters<T>{
is: FilterFunction<T>
isnot: FilterFunction<T>
gt: FilterFunction<T>
Expand All @@ -56,14 +56,14 @@ interface Filters<T>{
lte: FilterFunction<T>
}

interface ArrayFilters<T>{
export interface ArrayFilters<T>{
includes: ArrayFilterFunction<T>
}

type FilterFunction<T, K extends keyof T = keyof T> = (entry: T, field: K, value: T[K]) => boolean
type ArrayFilterFunction<T, K extends keyof T = keyof T> = (entry: T, field: K, value: Primative) => boolean
export type FilterFunction<T, K extends keyof T = keyof T> = (entry: T, field: K, value: T[K]) => boolean
export type ArrayFilterFunction<T, K extends keyof T = keyof T> = (entry: T, field: K, value: Primative) => boolean

interface DBOptions<T>{
export interface DBOptions<T>{
/** Should the results of searches be cached? */
cache: boolean
/** The field to index on */
Expand Down

0 comments on commit 9c18abd

Please sign in to comment.