Comparing version 0.7.0 to 0.7.1
@@ -40,7 +40,9 @@ "use strict"; | ||
const keys = Object.keys(args); | ||
const names = this.namesSet; | ||
const names = this.names; | ||
const namesSet = this.namesSet; | ||
const codecs = this.subCodecs; | ||
const codecsLen = codecs.length; | ||
if (keys.length !== codecsLen) { | ||
throw new Error(`expected ${codecsLen} argument${codecsLen === 1 ? "" : "s"}, got ${keys.length}`); | ||
if (keys.length > codecsLen) { | ||
const extraKeys = keys.filter((key) => !namesSet.has(key)); | ||
throw new Error(`unexpected named argument${extraKeys.length === 1 ? "" : "s"}: "${extraKeys.join('", "')}"`); | ||
} | ||
@@ -52,8 +54,8 @@ if (!codecsLen) { | ||
for (let i = 0; i < codecsLen; i++) { | ||
const key = keys[i]; | ||
if (!names.has(key)) { | ||
throw new Error('unexpeced named argument "${key}"'); | ||
const key = names[i]; | ||
const val = args[key]; | ||
if (val === undefined) { | ||
throw new Error(`missing named argument "${key}"`); | ||
} | ||
const val = args[key]; | ||
if (val == null) { | ||
if (val === null) { | ||
elemData.writeInt32(-1); | ||
@@ -60,0 +62,0 @@ } |
@@ -240,6 +240,18 @@ "use strict"; | ||
res = await con.fetchOne(`select <str>$a ++ <str>$b`, { | ||
b: "abc", | ||
a: "123", | ||
}); | ||
expect(res).toBe("123abc"); | ||
res = await con | ||
.fetchOne(`select <str>$a ++ <str>$b`, { | ||
b: "abc", | ||
a: "123", | ||
c: "def", | ||
}) | ||
.then(() => { | ||
throw new Error("there should have been an unexpected named argument error"); | ||
}) | ||
.catch((e) => { | ||
expect(e.toString()).toMatch(/unexpected named argument: "c"/); | ||
}); | ||
expect(res).toBe("123abc"); | ||
res = await con.fetchOne(`select len(<str>$a ?? "aa")`, { a: null }); | ||
@@ -246,0 +258,0 @@ expect(res).toBe(2); |
@@ -13,3 +13,3 @@ { | ||
}, | ||
"version": "0.7.0", | ||
"version": "0.7.1", | ||
"main": "./dist/src/index.js", | ||
@@ -16,0 +16,0 @@ "types": "./dist/src/index.d.ts", |
@@ -63,11 +63,12 @@ # The NodeJS driver for EdgeDB | ||
We use yarn to develop edgedb-js. | ||
A local installation of EdgeDB is required to run tests. Download | ||
EdgeDB from [here](https://edgedb.com/download) or | ||
[build it manually](https://edgedb.com/docs/internals/dev/). | ||
Instructions for installing EdgeDB and edgedb-js locally can be found | ||
[here](https://edgedb.com/docs/internals/dev/). | ||
We use TypeScript, yarn, prettier, and tslint to develop edgedb-js. | ||
To run the test suite, run `yarn test`. To lint or format the code, run | ||
`yarn lint` / `yarn format`. | ||
To run the test suite, run `yarn test`. | ||
## License | ||
edgedb-js is developed and distributed under the Apache 2.0 license. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
298837
8339
74