Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: replace var statements #742

Merged
merged 2 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,20 +252,16 @@ const numberKeywords = [
* https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6
*/
function inferTypeByKeyword (schema) {
// eslint-disable-next-line
for (var keyword of objectKeywords) {
for (const keyword of objectKeywords) {
if (keyword in schema) return 'object'
}
// eslint-disable-next-line
for (var keyword of arrayKeywords) {
for (const keyword of arrayKeywords) {
if (keyword in schema) return 'array'
}
// eslint-disable-next-line
for (var keyword of stringKeywords) {
for (const keyword of stringKeywords) {
if (keyword in schema) return 'string'
}
// eslint-disable-next-line
for (var keyword of numberKeywords) {
for (const keyword of numberKeywords) {
if (keyword in schema) return 'number'
}
return schema.type
Expand Down
3 changes: 1 addition & 2 deletions lib/serializer.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,7 @@ module.exports = class Serializer {
let result = ''
let last = -1
let point = 255
// eslint-disable-next-line
for (var i = 0; i < len; i++) {
for (let i = 0; i < len; i++) {
point = str.charCodeAt(i)
if (
point === 0x22 || // '"'
Expand Down