Skip to content

Commit bbbce88

Browse files
authored
Merge pull request #2069 from aquapi/master
Update stnl to 1.1.6
2 parents 2d75d15 + e6e34fc commit bbbce88

File tree

4 files changed

+25
-39
lines changed

4 files changed

+25
-39
lines changed

bun.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"runtypes": "6.7.0",
5757
"simple-runtypes": "7.1.3",
5858
"spectypes": "2.1.11",
59-
"stnl": "0.3.5",
59+
"stnl": "1.1.6",
6060
"succulent": "0.18.1",
6161
"superstruct": "2.0.2",
6262
"suretype": "2.4.1",
@@ -1392,7 +1392,7 @@
13921392

13931393
"std-env": ["std-env@3.9.0", "", {}, "sha512-UGvjygr6F6tpH7o2qyqR6QYpwraIjKSdtzyBdyytFOHmPZY917kwdwLG0RbOjWOnKmnm3PeHjaoLLMie7kPLQw=="],
13941394

1395-
"stnl": ["stnl@0.3.5", "", {}, "sha512-d5SozAjuuKqNQXleLIiLKrsnyL4Rm8FU28hmA/Ja/G/frzDMX66fodU09IUdWJhf1Xm+B1pG/KG/eQY4buiBoQ=="],
1395+
"stnl": ["stnl@1.1.6", "", {}, "sha512-E6tfWe7z8B/1SwMo7lCUOoC940y6d+Y0EfdOaN3yUetkN0O9NZ+XdBirDzPZYQZp65Q33x0r8bnlhjC+YcRpXQ=="],
13961396

13971397
"string-width": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="],
13981398

cases/stnl.ts

Lines changed: 14 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,23 @@
1-
import compose from 'stnl/compilers/validate-json/compose';
2-
import { build } from 'stnl/compilers/validate-json';
3-
import stnl from 'stnl';
1+
import { build, t } from 'stnl';
42

53
import { createCase } from '../benchmarks';
64

7-
const assertLoose = stnl({
8-
props: {
9-
number: 'f64',
10-
negNumber: 'f64',
11-
maxNumber: 'f64',
12-
string: 'string',
13-
longString: 'string',
14-
boolean: 'bool',
15-
deeplyNested: {
16-
props: {
17-
foo: 'string',
18-
num: 'f64',
19-
bool: 'bool',
20-
},
21-
},
22-
},
23-
});
24-
25-
createCase('stnl (composition)', 'assertLoose', () => {
26-
const check = compose(assertLoose);
27-
28-
return data => {
29-
if (check(data)) return true;
30-
throw null;
31-
};
5+
const assertLoose = t.dict({
6+
number: t.float,
7+
negNumber: t.float,
8+
maxNumber: t.float,
9+
string: t.string,
10+
longString: t.string,
11+
boolean: t.bool,
12+
deeplyNested: t.dict({
13+
foo: t.string,
14+
num: t.float,
15+
bool: t.bool,
16+
}),
3217
});
3318

3419
createCase('stnl (just-in-time)', 'assertLoose', () => {
35-
const check = build(assertLoose);
20+
const check = build.json.assert.compile(assertLoose);
3621

3722
return data => {
3823
if (check(data)) return true;

package-lock.json

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
"runtypes": "6.7.0",
8181
"simple-runtypes": "7.1.3",
8282
"spectypes": "2.1.11",
83-
"stnl": "0.3.5",
83+
"stnl": "1.1.6",
8484
"succulent": "0.18.1",
8585
"superstruct": "2.0.2",
8686
"suretype": "2.4.1",

0 commit comments

Comments
 (0)