Skip to content

Commit e2b5d35

Browse files
SerayaErynEomm
authored andcommitted
Update standard (#183)
1 parent 06acd3b commit e2b5d35

File tree

6 files changed

+26
-26
lines changed

6 files changed

+26
-26
lines changed

index.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ function build (schema, options) {
7474
`
7575
}
7676

77-
if (schema['$ref']) {
78-
schema = refFinder(schema['$ref'], schema, options.schema)
77+
if (schema.$ref) {
78+
schema = refFinder(schema.$ref, schema, options.schema)
7979
}
8080

8181
if (schema.type === undefined) {
@@ -309,8 +309,8 @@ function addPatternProperties (schema, externalSchema, fullSchema) {
309309
if (properties[keys[i]]) continue
310310
`
311311
Object.keys(pp).forEach((regex, index) => {
312-
if (pp[regex]['$ref']) {
313-
pp[regex] = refFinder(pp[regex]['$ref'], fullSchema, externalSchema, fullSchema)
312+
if (pp[regex].$ref) {
313+
pp[regex] = refFinder(pp[regex].$ref, fullSchema, externalSchema, fullSchema)
314314
}
315315
var type = pp[regex].type
316316
code += `
@@ -385,8 +385,8 @@ function additionalProperty (schema, externalSchema, fullSchema) {
385385
}
386386
`
387387
}
388-
if (ap['$ref']) {
389-
ap = refFinder(ap['$ref'], fullSchema, externalSchema)
388+
if (ap.$ref) {
389+
ap = refFinder(ap.$ref, fullSchema, externalSchema)
390390
}
391391

392392
var type = ap.type
@@ -486,8 +486,8 @@ function refFinder (ref, schema, externalSchema) {
486486
if (ref[0]) {
487487
schema = externalSchema[ref[0]]
488488

489-
if (schema['$ref']) {
490-
return refFinder(schema['$ref'], schema, externalSchema)
489+
if (schema.$ref) {
490+
return refFinder(schema.$ref, schema, externalSchema)
491491
}
492492
}
493493

@@ -532,8 +532,8 @@ function sanitizeKey (key) {
532532

533533
function buildCode (schema, code, laterCode, name, externalSchema, fullSchema) {
534534
Object.keys(schema.properties || {}).forEach((key, i, a) => {
535-
if (schema.properties[key]['$ref']) {
536-
schema.properties[key] = refFinder(schema.properties[key]['$ref'], fullSchema, externalSchema)
535+
if (schema.properties[key].$ref) {
536+
schema.properties[key] = refFinder(schema.properties[key].$ref, fullSchema, externalSchema)
537537
}
538538

539539
// Using obj['key'] !== undefined instead of obj.hasOwnProperty(prop) for perf reasons,
@@ -783,8 +783,8 @@ function buildArray (schema, code, name, externalSchema, fullSchema) {
783783
`
784784
var laterCode = ''
785785

786-
if (schema.items['$ref']) {
787-
schema.items = refFinder(schema.items['$ref'], fullSchema, externalSchema)
786+
if (schema.items.$ref) {
787+
schema.items = refFinder(schema.items.$ref, fullSchema, externalSchema)
788788
}
789789

790790
var result = { code: '', laterCode: '' }

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"long": "^4.0.0",
3838
"pre-commit": "^1.2.2",
3939
"proxyquire": "^2.1.0",
40-
"standard": "^13.0.1",
40+
"standard": "^14.0.0",
4141
"tap": "^12.6.5",
4242
"tap-mocha-reporter": "^3.0.9",
4343
"typescript": "^3.0.0",

test/integer.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const validator = require('is-my-json-valid')
55
const proxyquire = require('proxyquire')
66
const build = proxyquire('..', { long: null })
77

8-
test(`render an integer as JSON`, (t) => {
8+
test('render an integer as JSON', (t) => {
99
t.plan(2)
1010

1111
const schema = {
@@ -21,7 +21,7 @@ test(`render an integer as JSON`, (t) => {
2121
t.ok(validate(JSON.parse(output)), 'valid schema')
2222
})
2323

24-
test(`render an object with an integer as JSON`, (t) => {
24+
test('render an object with an integer as JSON', (t) => {
2525
t.plan(2)
2626

2727
const schema = {
@@ -44,7 +44,7 @@ test(`render an object with an integer as JSON`, (t) => {
4444
t.ok(validate(JSON.parse(output)), 'valid schema')
4545
})
4646

47-
test(`render an array with an integer as JSON`, (t) => {
47+
test('render an array with an integer as JSON', (t) => {
4848
t.plan(2)
4949

5050
const schema = {
@@ -63,7 +63,7 @@ test(`render an array with an integer as JSON`, (t) => {
6363
t.ok(validate(JSON.parse(output)), 'valid schema')
6464
})
6565

66-
test(`render an object with an additionalProperty of type integer as JSON`, (t) => {
66+
test('render an object with an additionalProperty of type integer as JSON', (t) => {
6767
t.plan(2)
6868

6969
const schema = {

test/long.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const validator = require('is-my-json-valid')
55
const Long = require('long')
66
const build = require('..')
77

8-
test(`render a long as JSON`, (t) => {
8+
test('render a long as JSON', (t) => {
99
t.plan(2)
1010

1111
const schema = {
@@ -21,7 +21,7 @@ test(`render a long as JSON`, (t) => {
2121
t.ok(validate(JSON.parse(output)), 'valid schema')
2222
})
2323

24-
test(`render an object with long as JSON`, (t) => {
24+
test('render an object with long as JSON', (t) => {
2525
t.plan(2)
2626

2727
const schema = {
@@ -44,7 +44,7 @@ test(`render an object with long as JSON`, (t) => {
4444
t.ok(validate(JSON.parse(output)), 'valid schema')
4545
})
4646

47-
test(`render an array with long as JSON`, (t) => {
47+
test('render an array with long as JSON', (t) => {
4848
t.plan(2)
4949

5050
const schema = {
@@ -63,7 +63,7 @@ test(`render an array with long as JSON`, (t) => {
6363
t.ok(validate(JSON.parse(output)), 'valid schema')
6464
})
6565

66-
test(`render an object with a long additionalProperty as JSON`, (t) => {
66+
test('render an object with a long additionalProperty as JSON', (t) => {
6767
t.plan(2)
6868

6969
const schema = {

test/sanitize.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const stringify = build({
1717
description: 'Age in years"',
1818
type: 'integer'
1919
},
20-
[(() => `phra'&& process.exit(1) ||'phra`)()]: {},
20+
[(() => "phra'&& process.exit(1) ||'phra")()]: {},
2121
now: {
2222
type: 'string'
2323
},

test/surrogate.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const test = require('tap').test
44
const validator = require('is-my-json-valid')
55
const build = require('..')
66

7-
test(`render a string with surrogate pairs as JSON:test 1`, (t) => {
7+
test('render a string with surrogate pairs as JSON:test 1', (t) => {
88
t.plan(2)
99

1010
const schema = {
@@ -20,7 +20,7 @@ test(`render a string with surrogate pairs as JSON:test 1`, (t) => {
2020
t.ok(validate(JSON.parse(output)), 'valid schema')
2121
})
2222

23-
test(`render a string with surrogate pairs as JSON: test 2`, (t) => {
23+
test('render a string with surrogate pairs as JSON: test 2', (t) => {
2424
t.plan(2)
2525

2626
const schema = {
@@ -36,7 +36,7 @@ test(`render a string with surrogate pairs as JSON: test 2`, (t) => {
3636
t.ok(validate(JSON.parse(output)), 'valid schema')
3737
})
3838

39-
test(`render a string with Unpaired surrogate code as JSON`, (t) => {
39+
test('render a string with Unpaired surrogate code as JSON', (t) => {
4040
t.plan(2)
4141

4242
const schema = {
@@ -51,7 +51,7 @@ test(`render a string with Unpaired surrogate code as JSON`, (t) => {
5151
t.ok(validate(JSON.parse(output)), 'valid schema')
5252
})
5353

54-
test(`render a string with lone surrogate code as JSON`, (t) => {
54+
test('render a string with lone surrogate code as JSON', (t) => {
5555
t.plan(2)
5656

5757
const schema = {

0 commit comments

Comments
 (0)