dde272c4b8
i18n - Build Validation / Validate i18n Builds (24) (push) Has been cancelled
CI - Node.js / Lint (24) (push) Has been cancelled
CI - Node.js / Build (24) (push) Has been cancelled
CI - Node.js / Test (24) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (24) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 24) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 24) (push) Has been cancelled
CD - Docker - GHCR Images / Build and Push Images (push) Has been cancelled
1.1 KiB
1.1 KiB
id, title, challengeType, dashedName
| id | title | challengeType | dashedName |
|---|---|---|---|
| 6a0dcc730cb92a616f86f0bf | Challenge 295: Schema Validator Part 1 | 28 | challenge-295 |
--description--
Given an object (JavaScript) or dictionary (Python), determine if it matches the following schema:
{
username: string
}
- Extra keys are allowed
--hints--
isValidSchema({ username: "bob" }) should return true.
assert.isTrue(isValidSchema({ username: "bob" }));
isValidSchema({ username: "jen", posts: 30 }) should return true.
assert.isTrue(isValidSchema({ username: "jen", posts: 30 }));
isValidSchema({ username: "" }) should return true.
assert.isTrue(isValidSchema({ username: "" }));
isValidSchema({ username: 7 }) should return false.
assert.isFalse(isValidSchema({ username: 7 }));
isValidSchema({ posts: 25 }) should return false.
assert.isFalse(isValidSchema({ posts: 25 }));
--seed--
--seed-contents--
function isValidSchema(obj) {
return obj;
}
--solutions--
function isValidSchema(obj) {
return typeof obj.username === 'string';
}