Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 49d4727

Browse files
add error message
1 parent e4459e0 commit 49d4727

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

‎__test__/utils.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@
77
export function includeAllKeys(obj: Object, schema: Object) {
88
for (let key in schema) {
99
if (!obj.hasOwnProperty(key)) {
10+
console.log(`key '${key}' lost`)
1011
return false
1112
}
1213
if (schema[key] !== null) {
1314
if (typeof schema[key] === 'string') {
1415
if (typeof obj[key] !== schema[key]) {
16+
console.error(`the type of ${obj.toString()} is incorrect`)
1517
return false
1618
}
1719
} else if (typeof schema[key] === 'object') {
@@ -33,6 +35,7 @@ export function includeAllKeys(obj: Object, schema: Object) {
3335
export function excludeKeys(obj: Object, schema: Object) {
3436
for (let key in obj) {
3537
if (!schema.hasOwnProperty(key)) {
38+
console.error(`unexpected key: ${key}`)
3639
return false
3740
}
3841
if (schema[key] !== null && typeof schema[key] === 'object') {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /