Skip to content

Commit

Permalink
Merge pull request #88 from hckrnews/fix-optional-keys
Browse files Browse the repository at this point in the history
Add mixed field types for more flexibility
  • Loading branch information
w3nl authored Apr 20, 2021
2 parents bc53eec + 5ad07b8 commit da876c7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@hckrnews/objects",
"description": "Hack JavaScript objects",
"version": "2.2.5",
"version": "2.3.0",
"author": {
"name": "Pieter Wigboldus",
"url": "https://hckr.news/"
Expand Down Expand Up @@ -78,6 +78,6 @@
"flat"
],
"dependencies": {
"@hckrnews/validator": "^4.2.3"
"@hckrnews/validator": "^4.2.5"
}
}
4 changes: 4 additions & 0 deletions src/__tests__/validate-objects.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ describe('Object test', () => {
city: String,
country: String,
build: Function,
'example?': 'mixed',
};

const Address = Obj({ schema: addressSchema });
Expand All @@ -26,6 +27,7 @@ describe('Object test', () => {
city: 'Example',
country: 'The Netherlands',
build,
example: 'ok',
});

expect(myAddress).toEqual({
Expand All @@ -35,6 +37,7 @@ describe('Object test', () => {
city: 'Example',
country: 'The Netherlands',
build,
example: 'ok',
});

expect(myAddress.keys()).toEqual([
Expand All @@ -44,6 +47,7 @@ describe('Object test', () => {
'city',
'country',
'build',
'example',
]);
});

Expand Down

0 comments on commit da876c7

Please sign in to comment.