json模式功能签名
该包提供了一种通过定义来验证函数的输入,输出和上下文的方法。
基本用法
通过使用建议的管道运算符。
import { number, object, string } from "json-schema-shorthand";
import { funcSchema }
from "json-schema-function-signatures";
const myFunc =
function(foo, bar) {
return { sum: foo + bar, ctx: { baz: this } };
}
|> funcSchema(
[number({ minimum: 2 }), number({ maximum: 3 })],
object({
评论0
最新资源