Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ code in this repository.
release).

CI runs `npm run lint` then `npm test -- --ci --coverage --runInBand` against
Node 20.x, 22.x, and 24.x. The package targets `node >= 20` and is CommonJS
Node 22.x, 24.x, and 26.x. The package targets `node >= 22` and is CommonJS
(`require` / `module.exports`).

## Architecture
Expand Down
10 changes: 0 additions & 10 deletions package-lock.json

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

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"test": "jest"
},
"dependencies": {
"is": "^3.3.2",
"joi": "^18.2.4"
},
"devDependencies": {
Expand Down
4 changes: 1 addition & 3 deletions src/adapters/base.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
const is = require('is')

const AdapterValidator = require('../validators/adapter')
const NotImplementedError = require('../errors/not_implemented')

Expand Down Expand Up @@ -41,7 +39,7 @@ class BaseAdapter {

const operatorMethod = `filter:${operator}`

if (is.fn(this[operatorMethod])) {
if (typeof this[operatorMethod] === 'function') {
return this[operatorMethod](builder, filter)
}

Expand Down
4 changes: 1 addition & 3 deletions src/orchestrators/base.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
const is = require('is')

const cache = require('../services/cache_function')
const NotImplementedError = require('../errors/not_implemented')
const ValidationError = require('../errors/validation')
Expand Down Expand Up @@ -58,7 +56,7 @@ class BaseOrchestrator {
const args = [this.querier.builder, values]

this.querier.builder =
querierMethod && is.fn(this.querier[querierMethod])
querierMethod && typeof this.querier[querierMethod] === 'function'
? this.querier[querierMethod](...args)
: this.querier.adapter[this.queryKey](...args)

Expand Down
7 changes: 4 additions & 3 deletions src/parsers/filter.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
const is = require('is')

const BaseParser = require('./base')
const flattenMap = require('../services/flatten_map')

Expand Down Expand Up @@ -95,7 +93,10 @@ class FilterParser extends BaseParser {
const filters = []

for (const [name, value] of entries) {
if (is.object(value)) {
// `Object.prototype.toString` is used instead of `typeof` so that arrays,
// `null`, and exotic objects (like `Date`) are treated as filter values
// rather than operator objects.
if (Object.prototype.toString.call(value) === '[object Object]') {
filters.push(...this.parseObject(name, value))
} else {
filters.push(this.parseNonObject(name, value))
Expand Down
7 changes: 4 additions & 3 deletions src/parsers/page.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
const is = require('is')

const BaseParser = require('./base')
const flattenMap = require('../services/flatten_map')

Expand Down Expand Up @@ -60,7 +58,10 @@ class PageParser extends BaseParser {

if (!this.query) {
page = this.defaults
} else if (is.number(this.query) || is.string(this.query)) {
} else if (
typeof this.query === 'number' ||
typeof this.query === 'string'
) {
page = this.parseNumber()
} else {
page = this.parseObject()
Expand Down
6 changes: 2 additions & 4 deletions src/parsers/sort.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
const is = require('is')

const BaseParser = require('./base')
const flattenMap = require('../services/flatten_map')

Expand Down Expand Up @@ -89,9 +87,9 @@ class SortParser extends BaseParser {

const sorts = []

if (is.string(this.query)) {
if (typeof this.query === 'string') {
sorts.push(this.parseString(this.query))
} else if (is.array(this.query)) {
} else if (Array.isArray(this.query)) {
sorts.push(...this.parseArray(this.query))
} else {
sorts.push(...this.parseObject(this.query))
Expand Down
4 changes: 1 addition & 3 deletions src/schema.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
const is = require('is')

class Schema {
constructor() {
this.filters = new Map()
Expand Down Expand Up @@ -33,7 +31,7 @@ class Schema {
}

page(isEnabledOrOptions = true) {
if (is.bool(isEnabledOrOptions)) {
if (typeof isEnabledOrOptions === 'boolean') {
this.pageOptions = { isEnabled: isEnabledOrOptions }
} else {
this.pageOptions = {
Expand Down