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
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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)