Skip to content

Commit

Permalink
chore: use the same noop everywhere
Browse files Browse the repository at this point in the history
This minor cleanup uses the same `noop` utility function across the
codebase, rather than defining them as one-offs.
  • Loading branch information
EvanHahn committed Mar 9, 2024
1 parent 210ab8b commit c92ca34
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
4 changes: 1 addition & 3 deletions src/datatype/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { validate } from '@mapeo/schema'
import { getTableConfig } from 'drizzle-orm/sqlite-core'
import { eq, inArray, placeholder } from 'drizzle-orm'
import { randomBytes } from 'node:crypto'
import { deNullify } from '../utils.js'
import { noop, deNullify } from '../utils.js'
import crypto from 'hypercore-crypto'
import { TypedEmitter } from 'tiny-typed-emitter'

Expand Down Expand Up @@ -291,5 +291,3 @@ export class DataType extends TypedEmitter {
this.emit('updated-docs', updatedDocs)
}
}

function noop() {}
3 changes: 1 addition & 2 deletions src/discovery/local-discovery.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { TypedEmitter } from 'tiny-typed-emitter'
import net from 'node:net'
import NoiseSecretStream from '@hyperswarm/secret-stream'
import { once } from 'node:events'
import { noop } from '../utils.js'
import { DnsSd } from './dns-sd.js'
import { isPrivate } from 'bogon'
import StartStopStateMachine from 'start-stop-state-machine'
Expand Down Expand Up @@ -299,5 +300,3 @@ function getAddress(server) {
}
return addr
}

function noop() {}
4 changes: 1 addition & 3 deletions src/local-peers.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @ts-check
import { TypedEmitter } from 'tiny-typed-emitter'
import Protomux from 'protomux'
import { ExhaustivenessError, keyToId } from './utils.js'
import { noop, ExhaustivenessError, keyToId } from './utils.js'
import { isBlank } from './lib/string.js'
import cenc from 'compact-encoding'
import {
Expand Down Expand Up @@ -624,8 +624,6 @@ function isProjectJoinDetailsValid(details) {
)
}

function noop() {}

/**
* We can temporarily have more than 1 peer for a device while connections are
* deduplicating. We don't expose these duplicate connections until only one
Expand Down

0 comments on commit c92ca34

Please sign in to comment.