Skip to content

Commit

Permalink
Style.
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmorris committed Sep 5, 2024
1 parent 8232915 commit c311e21
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Dict.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Tuple from "./Tuple.mjs";
import { size, keys } from "./Tuple.mjs";
import Tuple from './Tuple.mjs';
import { size, keys } from './Tuple.mjs';

const base = Object.create(null);
base.toString = Object.prototype.toString;
Expand Down
4 changes: 2 additions & 2 deletions Group.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Tuple from "./Tuple.mjs";
import { _index, size } from "./Tuple.mjs";
import Tuple from './Tuple.mjs';
import { _index, size } from './Tuple.mjs';

const base = Object.create(null);
base.toString = Object.prototype.toString;
Expand Down
4 changes: 2 additions & 2 deletions Record.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Tuple from "./Tuple.mjs";
import { size, keys } from "./Tuple.mjs";
import Tuple from './Tuple.mjs';
import { size, keys } from './Tuple.mjs';

const base = Object.create(null);
base.toString = Object.prototype.toString;
Expand Down
12 changes: 8 additions & 4 deletions Schema.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,13 @@ const Schema = {
record(schema = {})
{
return (arg, path = '') => {
const entries = Object.entries(arg);
return Record(Object.fromEntries(
entries.map(([key, value]) => [key, schema[key] ? schema[key](value, `${path || 'root'}[${key}]`) : value])
const entries = Object.entries(schema);
return Record(Object.assign(
{},
arg,
Object.fromEntries(
entries.map(([key, schema]) => [key, schema(arg[key], `${path || 'root'}[${key}]`)])
)
));
}
},
Expand Down Expand Up @@ -984,7 +988,7 @@ const Schema = {
}
}

const multi = new Error(errors.map(e => e.message).join(", "));
const multi = new Error(errors.map(e => e.message).join(', '));
multi.errors = errors;
throw multi;
};
Expand Down
2 changes: 1 addition & 1 deletion test/test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Group from '../Group.mjs';
import Record from '../Record.mjs';
import Dict from '../Dict.mjs';

import { size } from "../Tuple.mjs";
import { size } from '../Tuple.mjs';

const tests = [];

Expand Down

0 comments on commit c311e21

Please sign in to comment.