Skip to content

Commit 636a908

Browse files
authored
add quick exit in toStructure() for primitive types (#1352)
Thanks to @zemberdotnet for the suggestion!
1 parent 8716a7d commit 636a908

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

packages/bolt-connection/src/bolt/transformer.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ export default class Transformer {
6161
* @returns {<T>|structure.Structure} The structure or the object, if any transformer was found
6262
*/
6363
toStructure (type) {
64+
const valueType = typeof type
65+
// captures 'string' | 'boolean' | 'bigint' | 'number' | 'undefined' | null
66+
if ((valueType !== 'object' && valueType !== 'function' && valueType !== 'symbol') || type === null) {
67+
return type
68+
}
6469
const transformer = this._transformers.find(({ isTypeInstance }) => isTypeInstance(type))
6570
if (transformer !== undefined) {
6671
return transformer.toStructure(type)

packages/neo4j-driver-deno/lib/bolt-connection/bolt/transformer.js

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)