Merge branch 'release/v0.24.7' #453
Annotations
2 errors and 1 warning
src/index.spec.ts > treeshake > should shake it:
src/index.spec.ts#L27
Error: Snapshot `treeshake > should shake it 1` mismatched
- Expected
+ Received
"(() => {
- // src/common/data/array.ts
+ // src/common/data/array.ts
- function arrayUnique(x) {
+ function arrayUnique(x) {
- return x.filter((n, index) => x.indexOf(n) === index);
+ return x.filter((n, index) => x.indexOf(n) === index);
- }
- function arrayUnion(...a2) {
+ }
+ function arrayUnion(...a2) {
- return arrayUnique(a2.reduce((acc = [], value) => acc.concat(value), []));
+ return arrayUnique(a2.reduce((acc = [], value) => acc.concat(value), []));
- }
-
- // <stdin>
+ }
+
+ // src/common/data/is.ts
+ function isFunction(obj) {
+ return obj != null && typeof obj === "function";
+ }
+ function isString(obj) {
+ return typeof obj === "string";
+ }
+ function isNumber(obj) {
+ return typeof obj === "number" && !Number.isNaN(obj);
+ }
+ function isInteger(obj) {
+ return isNumber(obj) && Number.isInteger(obj);
+ }
+ function isBoolean(obj) {
+ return typeof obj === "boolean";
+ }
+
+ // src/common/schema/schema.ts
+ function preParse(obj, info) {
+ if (obj == null) {
+ if (info._default != null) {
+ if (isFunction(info._default))
+ obj = info._default();
+ else
+ obj = info._default;
+ }
+ }
+ if (obj == null && info._optional === true)
+ return void 0;
+ if (obj == null)
+ throw new Error("cannot be undefined");
+ if (!info._check || info._check(obj))
+ return obj;
+ throw new Error("wrong value");
+ }
+ function generic(type, opt) {
+ const info = {
+ parse(obj) {
+ return preParse(obj, this);
+ },
+ map(obj, fn2) {
+ return fn2.call(this, obj, this) ?? obj;
+ },
+ _check() {
+ return true;
+ },
+ ...opt,
+ type,
+ optional() {
+ this._optional = true;
+ return this;
+ },
+ default(value) {
+ this._default = value;
+ return this;
+ },
+ props(props) {
+ this._props = props;
+ return this;
+ }
+ };
+ return info;
+ }
+ function string() {
+ return generic("string", {
+ _check: isString
+ });
+ }
+ function number() {
+ return generic("number", {
+ _check: isNumber
+ });
+ }
+ function int() {
+ return generic("int", {
+ _check: isInteger
+ });
+ }
+ function boolean() {
+ return generic("boolean", {
+ _check: isBoolean
+ });
+ }
+ function tuple(items) {
+ return generic("tuple", {
+ _check: (v) => items.every((item, i) => item._check(v[i]))
+ });
+ }
+ var tt = tuple([number(), string(), boolean()]);
+ function func(args, ret) {
+ return {};
+ }
+ var fn = func([string(), boolean(), int()], string());
+
+ // <stdin>
- var a = [1, 2, 3, 3, 4];
+ var a = [1, 2, 3, 3, 4];
- var aa = arrayUnion(a);
+ var aa = arrayUnion(a);
- console.log("result arrayUnion", aa);
+ console.log("result arrayUnion", aa);
})();
"
❯ src/index.spec.ts:27:45
|
build
Process completed with exit code 1.
|
build
The following actions use a deprecated Node.js version and will be forced to run on node20: actions/checkout@v3, actions/setup-node@v3. For more info: https://github.blog/changelog/2024-03-07-github-actions-all-actions-will-run-on-node20-instead-of-node16-by-default/
|