Skip to content

Commit 15b42e6

Browse files
authored
Use consistent style in README examples (#216)
1 parent adf56df commit 15b42e6

File tree

1 file changed

+34
-34
lines changed

1 file changed

+34
-34
lines changed

README.md

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -317,16 +317,16 @@ If the `properties` keyword is not present in the same schema object, schema com
317317
const schema = {
318318
type: "object",
319319
properties: {
320-
foo: {type: 'number'},
321-
bar: {type: 'number'}
322-
}
323-
allRequired: true
324-
};
320+
foo: {type: "number"},
321+
bar: {type: "number"},
322+
},
323+
allRequired: true,
324+
}
325325

326-
const validData = { foo: 1, bar: 2 };
327-
const alsoValidData = { foo: 1, bar: 2, baz: 3 };
326+
const validData = {foo: 1, bar: 2}
327+
const alsoValidData = {foo: 1, bar: 2, baz: 3}
328328

329-
const invalidDataList = [ {}, { foo: 1 }, { bar: 2 } ];
329+
const invalidDataList = [{}, {foo: 1}, {bar: 2}]
330330
```
331331

332332
#### `anyRequired`
@@ -533,54 +533,54 @@ This keyword correctly tracks evaluated properties and items to work with `uneva
533533
**Please note**: these keywords require Ajv `$data` option to support [\$data reference](https://github.com/ajv-validator/ajv/blob/master/docs/validation.md#data-reference).
534534

535535
```javascript
536-
require('ajv-keywords')(ajv, 'select');
536+
require("ajv-keywords")(ajv, "select")
537537

538538
const schema = {
539539
type: "object",
540-
required: ['kind'],
540+
required: ["kind"],
541541
properties: {
542-
kind: { type: 'string' }
542+
kind: {type: "string"},
543543
},
544-
select: { $data: '0/kind' },
544+
select: {$data: "0/kind"},
545545
selectCases: {
546546
foo: {
547-
required: ['foo'],
547+
required: ["foo"],
548548
properties: {
549549
kind: {},
550-
foo: { type: 'string' }
550+
foo: {type: "string"},
551551
},
552-
additionalProperties: false
552+
additionalProperties: false,
553553
},
554554
bar: {
555-
required: ['bar'],
555+
required: ["bar"],
556556
properties: {
557557
kind: {},
558-
bar: { type: 'number' }
558+
bar: {type: "number"},
559559
},
560-
additionalProperties: false
561-
}
560+
additionalProperties: false,
561+
},
562562
},
563563
selectDefault: {
564564
propertyNames: {
565-
not: { enum: ['foo', 'bar'] }
566-
}
567-
}
568-
};
565+
not: {enum: ["foo", "bar"]},
566+
},
567+
},
568+
}
569569

570570
const validDataList = [
571-
{ kind: 'foo', foo: 'any' },
572-
{ kind: 'bar', bar: 1 },
573-
{ kind: 'anything_else', not_bar_or_foo: 'any value' }
574-
];
571+
{kind: "foo", foo: "any"},
572+
{kind: "bar", bar: 1},
573+
{kind: "anything_else", not_bar_or_foo: "any value"},
574+
]
575575

576576
const invalidDataList = [
577-
{ kind: 'foo' }, // no property foo
578-
{ kind: 'bar' }, // no property bar
579-
{ kind: 'foo', foo: 'any', another: 'any value' }, // additional property
580-
{ kind: 'bar', bar: 1, another: 'any value' }, // additional property
581-
{ kind: 'anything_else', foo: 'any' } // property foo not allowed
582-
{ kind: 'anything_else', bar: 1 } // property bar not allowed
583-
];
577+
{kind: "foo"}, // no property foo
578+
{kind: "bar"}, // no property bar
579+
{kind: "foo", foo: "any", another: "any value"}, // additional property
580+
{kind: "bar", bar: 1, another: "any value"}, // additional property
581+
{kind: "anything_else", foo: "any"}, // property foo not allowed
582+
{kind: "anything_else", bar: 1}, // property bar not allowed
583+
]
584584
```
585585

586586
#### `dynamicDefaults`

0 commit comments

Comments
 (0)