shinkansen-transmission 2.4.0 → 2.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. package/package.json +4 -4
  2. package/src/transmission/common/index.d.mts +2 -2
  3. package/src/transmission/common/index.mjs +97 -100
  4. package/src/transmission/from-document-to-hash/boolean/index.mjs +4 -1
  5. package/src/transmission/from-document-to-hash/index.mjs +15 -8
  6. package/src/transmission/from-document-to-hash/null/index.mjs +4 -1
  7. package/src/transmission/from-document-to-hash/number/index.mjs +4 -1
  8. package/src/transmission/from-document-to-hash/string/index.mjs +2 -5
  9. package/src/transmission/from-hash-to-document/boolean/index.mjs +5 -5
  10. package/src/transmission/from-hash-to-document/index.mjs +13 -13
  11. package/src/transmission/from-hash-to-document/null/index.mjs +5 -5
  12. package/src/transmission/from-hash-to-document/number/index.mjs +5 -5
  13. package/src/transmission/from-hash-to-document/string/index.mjs +5 -5
  14. package/src/transmission/to-zashiki/params/index.mjs +8 -8
  15. package/src/transmission/to-zashiki/render/array/index.mjs +20 -20
  16. package/src/transmission/to-zashiki/render/boolean/index.mjs +25 -25
  17. package/src/transmission/to-zashiki/render/null/index.mjs +25 -25
  18. package/src/transmission/to-zashiki/render/number/index.mjs +25 -25
  19. package/src/transmission/to-zashiki/render/object/index.mjs +20 -20
  20. package/src/transmission/to-zashiki/render/string/index.mjs +25 -25
  21. package/src/transmission/to-zashiki/render-params/schema/index.mjs +15 -15
  22. package/src/transmission/to-zashiki/transform-root-schema.mjs +6 -2
  23. package/src/transmission/to-zashiki/transform-schema.mjs +147 -129
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shinkansen-transmission",
3
- "version": "2.4.0",
3
+ "version": "2.4.2",
4
4
  "description": "Shinkansen Transmission",
5
5
  "keywords": [
6
6
  "Shinkansen",
@@ -19,7 +19,7 @@
19
19
  },
20
20
  "license": "ISC",
21
21
  "engines": {
22
- "node": ">=23.0.0"
22
+ "node": ">=22.11.0"
23
23
  },
24
24
  "repository": {
25
25
  "type": "git",
@@ -44,8 +44,8 @@
44
44
  "@babel/eslint-parser": "^7.26.8",
45
45
  "@babel/preset-env": "^7.26.9",
46
46
  "@babel/register": "^7.25.9",
47
- "@sequencemedia/eslint-config-standard": "^0.2.34",
48
- "@sequencemedia/eslint-config-typescript": "^0.1.48",
47
+ "@sequencemedia/eslint-config-standard": "^0.2.35",
48
+ "@sequencemedia/eslint-config-typescript": "^0.1.50",
49
49
  "@types/babel__register": "^7.17.3",
50
50
  "@types/chai": "^5.0.1",
51
51
  "@types/debug": "^4.1.12",
@@ -71,8 +71,8 @@ export function getFindByEqual (value?: MemberType): (item?: MemberType | Member
71
71
 
72
72
  export function toString (value?: MemberType): string
73
73
 
74
- export function getArray (schema?: { items?: SchemaType | SchemaType[] }, parentUri?: string, uri?: string): SchemaType | undefined
75
- export function getObject (schema?: { properties?: Record<string, SchemaType> }, parentUri?: string, uri?: string): SchemaType | undefined
74
+ export function getSchemaFromItems (schema?: { items?: SchemaType | SchemaType[] }, parentUri?: string, uri?: string): SchemaType | undefined
75
+ export function getSchemaFromProperties (schema?: { properties?: Record<string, SchemaType> }, parentUri?: string, uri?: string): SchemaType | undefined
76
76
 
77
77
  declare function getSchema (
78
78
  schema: (
@@ -47,15 +47,15 @@ log('`shinkansen` is awake')
47
47
 
48
48
  /**
49
49
  * @param {unknown} [v]
50
- * @returns {v is (Record<PropertyKey, MemberType | MemberArrayType> | Record<PropertyKey, never>)}
50
+ * @returns {v is (MemberArrayType)} // | SchemaType)[]}
51
51
  */
52
- export const isObject = (v) => (v || false) instanceof Object && !isArray(v)
52
+ export const isArray = (v) => Array.isArray(v)
53
53
 
54
54
  /**
55
55
  * @param {unknown} [v]
56
- * @returns {v is (MemberArrayType)} // | SchemaType)[]}
56
+ * @returns {v is (Record<PropertyKey, MemberType | MemberArrayType> | Record<PropertyKey, never>)}
57
57
  */
58
- export const isArray = (v) => Array.isArray(v)
58
+ export const isObject = (v) => (v || false) instanceof Object && !isArray(v)
59
59
 
60
60
  /**
61
61
  * @param {unknown} [v]
@@ -67,7 +67,7 @@ export const isPrimitive = (v) => !isObject(v) && !isArray(v)
67
67
  * @param {SchemaType | object} [v]
68
68
  * @returns {v is SchemaType}
69
69
  */
70
- export const isSchema = (v = {}) => 'type' in v // Reflect.has(v, 'type')
70
+ export const isSchema = (v = {}) => 'type' in v
71
71
 
72
72
  /**
73
73
  * @param {SchemaType} schema
@@ -149,11 +149,7 @@ export function getSelectedItems (values = {}, uri = '#') {
149
149
  const u = normaliseUri(uri)
150
150
 
151
151
  if (u in values) { // if (Reflect.has(values, u)) {
152
- const v = values[u] // Reflect.get(values, u)
153
-
154
- // transformByKeyForEnum
155
- // transformByKeyForAnyOf
156
- // transformByKeyForOneOf
152
+ const v = values[u]
157
153
 
158
154
  if (isPrimitive(v)) {
159
155
  const n = Number(v)
@@ -172,10 +168,6 @@ export function getSelectedItems (values = {}, uri = '#') {
172
168
  })
173
169
  }
174
170
 
175
- // transformByKeyForEnum
176
- // transformByKeyForAnyOf
177
- // transformByKeyForOneOf
178
-
179
171
  /*
180
172
  * Given the uri `#/`
181
173
  *
@@ -220,7 +212,7 @@ export function getMetaProps (params = {}, uri = '#') {
220
212
  if (uri in params) { // if (Reflect.has(params, uri)) {
221
213
  const {
222
214
  meta = {}
223
- } = params[uri] // Reflect.get(params, uri))
215
+ } = params[uri]
224
216
 
225
217
  return meta
226
218
  }
@@ -234,7 +226,7 @@ export function getMetaProps (params = {}, uri = '#') {
234
226
  */
235
227
  export function hasMetaDefaultValue (schema = {}) {
236
228
  if ('default' in schema) { // if (Reflect.has(schema, 'default') {
237
- const defaultValue = schema.default // Reflect.get(schema, 'default')
229
+ const defaultValue = schema.default
238
230
 
239
231
  return isPrimitive(defaultValue)
240
232
  }
@@ -248,7 +240,7 @@ export function hasMetaDefaultValue (schema = {}) {
248
240
  */
249
241
  export function getMetaDefaultValue (schema = {}) {
250
242
  if ('default' in schema) { // if (Reflect.has(schema, 'default') {
251
- const defaultValue = schema.default // Reflect.get(schema, 'default')
243
+ const defaultValue = schema.default
252
244
 
253
245
  return { defaultValue: String(defaultValue) }
254
246
  }
@@ -263,14 +255,14 @@ export function getMetaDefaultValue (schema = {}) {
263
255
  * @returns {boolean}
264
256
  */
265
257
  export function hasMetaValue (values = {}, uri = '#', schema = {}) {
266
- if (uri in values) { // Reflect.has(values, uri)) {
267
- const value = values[uri] // Reflect.get(values, uri)
258
+ if (uri in values) {
259
+ const value = values[uri]
268
260
 
269
261
  return isPrimitive(value)
270
262
  }
271
263
 
272
- if ('const' in schema) { // Reflect.has(schema, 'const')) {
273
- const constValue = schema.const // Reflect.get(schema, 'const')
264
+ if ('const' in schema) {
265
+ const constValue = schema.const
274
266
 
275
267
  return isPrimitive(constValue)
276
268
  }
@@ -286,7 +278,7 @@ export function hasMetaValue (values = {}, uri = '#', schema = {}) {
286
278
  */
287
279
  export function getMetaValue (values = {}, uri = '#', schema = {}) {
288
280
  if (uri in values) { // if (Reflect.has(values, uri)) {
289
- const value = values[uri] // Reflect.get(values, uri)
281
+ const value = values[uri]
290
282
 
291
283
  if (isPrimitive(value)) {
292
284
  return { value: String(value) }
@@ -294,7 +286,7 @@ export function getMetaValue (values = {}, uri = '#', schema = {}) {
294
286
  }
295
287
 
296
288
  if ('const' in schema) { // if (Reflect.has(schema, 'const')) {
297
- const constValue = schema.const // Reflect.get(schema, 'const')
289
+ const constValue = schema.const
298
290
 
299
291
  if (isPrimitive(constValue)) {
300
292
  return { value: String(constValue) }
@@ -313,7 +305,7 @@ export function transformToValue (item) {
313
305
 
314
306
  if (isPrimitive(item)) return item
315
307
 
316
- if (isArray(item)) return item // .map(transformToValue)
308
+ if (isArray(item)) return item
317
309
 
318
310
  if (isObject(item)) {
319
311
  if (hasConst(item)) {
@@ -396,7 +388,9 @@ export function getFindByEqual (value) {
396
388
  /*
397
389
  * log('find')
398
390
  */
399
- return equal(value, transformToValue(item))
391
+ return (
392
+ equal(value, transformToValue(item))
393
+ )
400
394
  }
401
395
  }
402
396
 
@@ -412,14 +406,14 @@ export function toString (value) {
412
406
  }
413
407
 
414
408
  /**
415
- * @param {{ items?: SchemaType | SchemaType[] }} [schema]
409
+ * @param {{ items?: SchemaType | SchemaType[] }} schema
416
410
  * @param {string} parentUri
417
411
  * @param {string} uri
418
412
  * @returns {SchemaType | undefined}
419
413
  */
420
- export function getArray ({ items /* array or object */ } = {}, parentUri = '', uri = '') {
414
+ export function getSchemaFromItems ({ items /* array or object */ }, parentUri, uri) {
421
415
  /*
422
- * log('getArray')
416
+ * log('getSchemaFromItems')
423
417
  */
424
418
 
425
419
  if (isArray(items)) {
@@ -438,14 +432,14 @@ export function getArray ({ items /* array or object */ } = {}, parentUri = '',
438
432
  }
439
433
 
440
434
  /**
441
- * @param {{ properties?: Record<string, SchemaType> }} [schema]
442
- * @param {string} [parentUri]
443
- * @param {string} [uri]
435
+ * @param {{ properties?: Record<string, SchemaType> }} schema
436
+ * @param {string} parentUri
437
+ * @param {string} uri
444
438
  * @returns {SchemaType | undefined}
445
439
  */
446
- export function getObject ({ properties /* object */ } = {}, parentUri = '', uri = '') {
440
+ export function getSchemaFromProperties ({ properties /* object */ }, parentUri, uri) {
447
441
  /*
448
- * log('getObject')
442
+ * log('getSchemaFromProperties')
449
443
  */
450
444
 
451
445
  if (isObject(properties)) {
@@ -462,6 +456,8 @@ export function getObject ({ properties /* object */ } = {}, parentUri = '', uri
462
456
  }
463
457
 
464
458
  /**
459
+ * @deprecated
460
+ *
465
461
  * @overload
466
462
  * @param {(
467
463
  * StringSchemaType |
@@ -476,12 +472,12 @@ export function getObject ({ properties /* object */ } = {}, parentUri = '', uri
476
472
  * @returns {SchemaType | undefined}
477
473
  *
478
474
  *
479
- * @param {*} [schema]
480
- * @param {string} [parentUri]
481
- * @param {string} [uri]
475
+ * @param {*} schema
476
+ * @param {string} parentUri
477
+ * @param {string} uri
482
478
  * @returns {* | undefined}
483
479
  */
484
- export function getSchema (schema = {}, parentUri = '', uri = '') {
480
+ export function getSchema (schema, parentUri, uri) {
485
481
  /*
486
482
  * log('getSchema')
487
483
  */
@@ -492,13 +488,10 @@ export function getSchema (schema = {}, parentUri = '', uri = '') {
492
488
 
493
489
  switch (type) {
494
490
  case 'array':
495
- return getArray(schema, parentUri, uri)
491
+ return getSchemaFromItems(schema, parentUri, uri)
496
492
 
497
493
  case 'object':
498
- return getObject(schema, parentUri, uri)
499
-
500
- default:
501
- return schema
494
+ return getSchemaFromProperties(schema, parentUri, uri)
502
495
  }
503
496
  }
504
497
 
@@ -573,6 +566,8 @@ export function findIndexByEqual (array, value) {
573
566
  }
574
567
 
575
568
  /**
569
+ * @deprecated
570
+ *
576
571
  * @param {ValuesType} [values]
577
572
  * @param {string} [uri]
578
573
  * @param {SchemaType} [schema]
@@ -580,13 +575,13 @@ export function findIndexByEqual (array, value) {
580
575
  */
581
576
  export function hasValue (values = {}, uri = '#', schema = {}) {
582
577
  if (uri in values) { // if (Reflect.has(values, uri)) {
583
- const value = values[uri] // Reflect.get(values, uri)
578
+ const value = values[uri]
584
579
 
585
580
  return isPrimitive(value)
586
581
  }
587
582
 
588
583
  if ('const' in schema) { // if (Reflect.has(schema, 'const')) {
589
- const constValue = schema.const // Reflect.get(schema, 'const')
584
+ const constValue = schema.const
590
585
 
591
586
  return isPrimitive(constValue)
592
587
  }
@@ -595,6 +590,8 @@ export function hasValue (values = {}, uri = '#', schema = {}) {
595
590
  }
596
591
 
597
592
  /**
593
+ * @deprecated
594
+ *
598
595
  * @param {ValuesType} [values]
599
596
  * @param {string} [uri]
600
597
  * @param {SchemaType} [schema]
@@ -602,7 +599,7 @@ export function hasValue (values = {}, uri = '#', schema = {}) {
602
599
  */
603
600
  export function getValue (values = {}, uri = '#', schema = {}) {
604
601
  if (uri in values) { // if (Reflect.has(values, uri)) {
605
- const value = values[uri] // Reflect.get(values, uri)
602
+ const value = values[uri]
606
603
 
607
604
  if (isPrimitive(value)) {
608
605
  return String(value)
@@ -610,7 +607,7 @@ export function getValue (values = {}, uri = '#', schema = {}) {
610
607
  }
611
608
 
612
609
  if ('const' in schema) { // if (Reflect.has(schema, 'const')) {
613
- const constValue = schema.const // Reflect.get(schema, 'const')
610
+ const constValue = schema.const
614
611
 
615
612
  if (isPrimitive(constValue)) {
616
613
  return String(constValue)
@@ -629,7 +626,7 @@ export function getElementsProps (params = {}, uri = '#') {
629
626
  if (uri in params) { // if (Reflect.has(values, uri)) {
630
627
  const {
631
628
  elements = {}
632
- } = params[uri] // Reflect.get(values, uri)
629
+ } = params[uri]
633
630
 
634
631
  return elements
635
632
  }
@@ -651,7 +648,7 @@ export function getElementsFieldPropsForEnum (params = {}, uri = '#') {
651
648
  elements: {
652
649
  enum: value = {}
653
650
  } = {}
654
- } = params[uri] // Reflect.get(values, uri)
651
+ } = params[uri]
655
652
 
656
653
  return value
657
654
  }
@@ -673,7 +670,7 @@ export function getElementsFieldPropsForOneOf (params = {}, uri = '#') {
673
670
  elements: {
674
671
  oneOf: value = {}
675
672
  } = {}
676
- } = params[uri] // Reflect.get(values, uri)
673
+ } = params[uri]
677
674
 
678
675
  return value
679
676
  }
@@ -695,7 +692,7 @@ export function getElementsFieldPropsForAnyOf (params = {}, uri = '#') {
695
692
  elements: {
696
693
  anyOf: value = {}
697
694
  } = {}
698
- } = params[uri] // Reflect.get(values, uri)
695
+ } = params[uri]
699
696
 
700
697
  return value
701
698
  }
@@ -717,7 +714,7 @@ export function getElementsFieldPropsForAllOf (params = {}, uri = '#') {
717
714
  elements: {
718
715
  field: value = {}
719
716
  } = {}
720
- } = params[uri] // Reflect.get(values, uri)
717
+ } = params[uri]
721
718
 
722
719
  return value
723
720
  }
@@ -739,7 +736,7 @@ export function getElementsFieldProps (params = {}, uri = '#') {
739
736
  elements: {
740
737
  field: value = {}
741
738
  } = {}
742
- } = params[uri] // Reflect.get(values, uri)
739
+ } = params[uri]
743
740
 
744
741
  return value
745
742
  }
@@ -755,23 +752,23 @@ export function getElementsFieldProps (params = {}, uri = '#') {
755
752
  */
756
753
  export function getElementsFieldValue (values = {}, uri = '#', schema = {}) {
757
754
  if (uri in values) { // (Reflect.has(values, uri)) {
758
- const value = values[uri] // Reflect.get(values, uri)
755
+ const value = values[uri]
759
756
 
760
757
  if (isPrimitive(value)) {
761
758
  return { value: String(value) }
762
759
  }
763
760
  }
764
761
 
765
- if ('const' in schema) { // Reflect.has(schema, 'const')) {
766
- const constValue = schema.const // Reflect.get(schema, 'const')
762
+ if ('const' in schema) {
763
+ const constValue = schema.const
767
764
 
768
765
  if (isPrimitive(constValue)) {
769
766
  return { value: String(constValue) }
770
767
  }
771
768
  }
772
769
 
773
- if ('default' in schema) { // Reflect.has(schema, 'default')) {
774
- const defaultValue = schema.default // Reflect.get(schema, 'default')
770
+ if ('default' in schema) {
771
+ const defaultValue = schema.default
775
772
 
776
773
  if (isPrimitive(defaultValue)) {
777
774
  return { value: String(defaultValue) }
@@ -785,7 +782,7 @@ export function getElementsFieldValue (values = {}, uri = '#', schema = {}) {
785
782
  * @param {{ 'enum'?: MemberArrayType }} [schema]
786
783
  * @returns {schema is { 'enum': MemberArrayType }}
787
784
  */
788
- export const hasEnum = (schema = {}) => 'enum' in schema // Reflect.has(schema, 'enum')
785
+ export const hasEnum = (schema = {}) => 'enum' in schema
789
786
 
790
787
  /**
791
788
  * @overload
@@ -795,45 +792,13 @@ export const hasEnum = (schema = {}) => 'enum' in schema // Reflect.has(schema,
795
792
  * @param {{ 'enum'?: MemberArrayType }} [schema]
796
793
  * @returns {MemberArrayType | undefined}
797
794
  */
798
- export const getEnum = (schema = {}) => schema.enum // Reflect.get(schema, 'enum')
799
-
800
- /**
801
- * @param {{ 'const'?: MemberType }} [schema]
802
- * @returns {schema is { 'const': MemberType }}
803
- */
804
- export const hasConst = (schema = {}) => 'const' in schema // Reflect.has(schema, 'const')
805
-
806
- /**
807
- * @overload
808
- * @param {{ 'const': MemberType }} schema
809
- * @returns {MemberType}
810
- *
811
- * @param {{ 'const'?: MemberType }} [schema]
812
- * @returns {MemberType | undefined}
813
- */
814
- export const getConst = (schema = {}) => schema.const // Reflect.get(schema, 'const')
815
-
816
- /**
817
- * @param {{ 'default'?: MemberType }} [schema]
818
- * @returns {schema is { 'default': MemberType }}
819
- */
820
- export const hasDefault = (schema = {}) => 'default' in schema // Reflect.has(schema, 'default')
821
-
822
- /**
823
- * @overload
824
- * @param {{ 'default': MemberType }} schema
825
- * @returns {MemberType}
826
- *
827
- * @param {{ 'default'?: MemberType }} [schema]
828
- * @returns {MemberType | undefined}
829
- */
830
- export const getDefault = (schema = {}) => schema.default // Reflect.get(schema, 'default')
795
+ export const getEnum = (schema = {}) => schema.enum
831
796
 
832
797
  /**
833
798
  * @param {{ 'anyOf'?: MemberArrayType }} [schema]
834
799
  * @returns {schema is { 'anyOf': MemberArrayType }}
835
800
  */
836
- export const hasAnyOf = (schema = {}) => 'anyOf' in schema // Reflect.has(schema, 'anyOf')
801
+ export const hasAnyOf = (schema = {}) => 'anyOf' in schema
837
802
 
838
803
  /**
839
804
  * @overload
@@ -843,13 +808,13 @@ export const hasAnyOf = (schema = {}) => 'anyOf' in schema // Reflect.has(schema
843
808
  * @param {{ 'anyOf'?: MemberArrayType }} [schema]
844
809
  * @returns {MemberArrayType | undefined}
845
810
  */
846
- export const getAnyOf = (schema = {}) => schema.anyOf // Reflect.get(schema, 'anyOf')
811
+ export const getAnyOf = (schema = {}) => schema.anyOf
847
812
 
848
813
  /**
849
814
  * @param {{ 'oneOf'?: MemberArrayType }} [schema]
850
815
  * @returns {schema is { 'oneOf': MemberArrayType }}
851
816
  */
852
- export const hasOneOf = (schema = {}) => 'oneOf' in schema // Reflect.has(schema, 'oneOf')
817
+ export const hasOneOf = (schema = {}) => 'oneOf' in schema
853
818
 
854
819
  /**
855
820
  * @overload
@@ -859,13 +824,13 @@ export const hasOneOf = (schema = {}) => 'oneOf' in schema // Reflect.has(schema
859
824
  * @param {{ 'oneOf'?: MemberArrayType }} schema
860
825
  * @returns {MemberArrayType | undefined}
861
826
  */
862
- export const getOneOf = (schema = {}) => schema.oneOf // Reflect.get(schema, 'oneOf')
827
+ export const getOneOf = (schema = {}) => schema.oneOf
863
828
 
864
829
  /**
865
830
  * @param {{ 'allOf'?: MemberArrayType }} [schema]
866
831
  * @returns {schema is { 'allOf': MemberArrayType }}
867
832
  */
868
- export const hasAllOf = (schema = {}) => 'allOf' in schema // Reflect.has(schema, 'allOf')
833
+ export const hasAllOf = (schema = {}) => 'allOf' in schema
869
834
 
870
835
  /**
871
836
  * @overload
@@ -875,7 +840,39 @@ export const hasAllOf = (schema = {}) => 'allOf' in schema // Reflect.has(schema
875
840
  * @param {{ 'allOf'?: MemberArrayType }} [schema]
876
841
  * @returns {MemberArrayType | undefined}
877
842
  */
878
- export const getAllOf = (schema = {}) => schema.allOf // Reflect.get(schema, 'allOf')
843
+ export const getAllOf = (schema = {}) => schema.allOf
844
+
845
+ /**
846
+ * @param {{ 'const'?: MemberType }} [schema]
847
+ * @returns {schema is { 'const': MemberType }}
848
+ */
849
+ export const hasConst = (schema = {}) => 'const' in schema
850
+
851
+ /**
852
+ * @overload
853
+ * @param {{ 'const': MemberType }} schema
854
+ * @returns {MemberType}
855
+ *
856
+ * @param {{ 'const'?: MemberType }} [schema]
857
+ * @returns {MemberType | undefined}
858
+ */
859
+ export const getConst = (schema = {}) => schema.const
860
+
861
+ /**
862
+ * @param {{ 'default'?: MemberType }} [schema]
863
+ * @returns {schema is { 'default': MemberType }}
864
+ */
865
+ export const hasDefault = (schema = {}) => 'default' in schema
866
+
867
+ /**
868
+ * @overload
869
+ * @param {{ 'default': MemberType }} schema
870
+ * @returns {MemberType}
871
+ *
872
+ * @param {{ 'default'?: MemberType }} [schema]
873
+ * @returns {MemberType | undefined}
874
+ */
875
+ export const getDefault = (schema = {}) => schema.default
879
876
 
880
877
  /**
881
878
  * @param {string} [uri]
@@ -956,7 +953,7 @@ export function getMaxItems ({ maxItems } = {}) {
956
953
  */
957
954
  export function getHasUniqueItems (schema = {}) {
958
955
  if ('uniqueItems' in schema) { // if (Reflect.has(schema, 'uniqueItems') {
959
- const value = schema.uniqueItems // Reflect.get(schema, 'uniqueItems')
956
+ const value = schema.uniqueItems
960
957
 
961
958
  return (typeof value === 'boolean') ? { hasUniqueItems: value } : {}
962
959
  }
@@ -1010,7 +1007,7 @@ export function getMaxProperties ({ maxProperties } = {}) {
1010
1007
  */
1011
1008
  export function getIsExclusiveMin (schema = {}) {
1012
1009
  if ('exclusiveMinimum' in schema) { // if (Reflect.has(schema, 'exclusiveMinimum') {
1013
- const value = schema.exclusiveMinimum // Reflect.get(schema, 'exclusiveMinimum')
1010
+ const value = schema.exclusiveMinimum
1014
1011
 
1015
1012
  return (typeof value === 'boolean') ? { isExclusiveMin: value } : {}
1016
1013
  }
@@ -1024,7 +1021,7 @@ export function getIsExclusiveMin (schema = {}) {
1024
1021
  */
1025
1022
  export function getIsExclusiveMax (schema = {}) {
1026
1023
  if ('exclusiveMaximum' in schema) { // if (Reflect.has(schema, 'exclusiveMaximum') {
1027
- const value = schema.exclusiveMaximum // Reflect.get(schema, 'exclusiveMaximum')
1024
+ const value = schema.exclusiveMaximum
1028
1025
 
1029
1026
  return (typeof value === 'boolean') ? { isExclusiveMax: value } : {}
1030
1027
  }
@@ -23,7 +23,7 @@ const log = debug('shinkansen-transmission/from-document-to-hash/boolean')
23
23
  log('`shinkansen` is awake')
24
24
 
25
25
  /**
26
- * Document can be `undefined`
26
+ * Document can be undefined
27
27
  *
28
28
  * @param {DocumentType} [document]
29
29
  * @param {SchemaType} [schema]
@@ -36,6 +36,9 @@ export default function transformBooleanSchema (document, schema = {}, hash = {}
36
36
  log('transformBooleanSchema')
37
37
 
38
38
  if (hasEnum(schema)) {
39
+ /**
40
+ * @link https://json-schema.org/draft/2019-09/json-schema-validation#rfc.section.6.1.2
41
+ */
39
42
  const array = getEnum(schema)
40
43
  const value = transformIndexToValueByFindValue(array, document)
41
44
 
@@ -8,7 +8,8 @@ import debug from 'debug'
8
8
 
9
9
  import {
10
10
  toString,
11
- getSchema,
11
+ getSchemaFromItems,
12
+ getSchemaFromProperties,
12
13
  isObject,
13
14
  isArray,
14
15
  hasEnum,
@@ -44,7 +45,7 @@ function getReduceArrayFor (schema, parentUri) {
44
45
  return function reduce (hash, document, index) {
45
46
  const schemaUri = getUri(parentUri, index)
46
47
 
47
- return fromDocumentToHash(document, getSchema(schema, parentUri, schemaUri), hash, schemaUri, schemaUri)
48
+ return fromDocumentToHash(document, getSchemaFromItems(schema, parentUri, schemaUri), hash, schemaUri, schemaUri)
48
49
  }
49
50
  }
50
51
 
@@ -80,6 +81,9 @@ export function transformArray (document, schema, hash, parentUri, uri) {
80
81
  */
81
82
 
82
83
  if (hasEnum(schema)) {
84
+ /**
85
+ * @link https://json-schema.org/draft/2019-09/json-schema-validation#rfc.section.6.1.2
86
+ */
83
87
  const array = getEnum(schema)
84
88
  const value = transformIndexToValueByFindEqual(array, document)
85
89
 
@@ -113,7 +117,7 @@ export function transformArray (document, schema, hash, parentUri, uri) {
113
117
  }
114
118
 
115
119
  /**
116
- * Document can be `undefined`
120
+ * Document can be undefined
117
121
  *
118
122
  * @param {DocumentType} [document]
119
123
  * @param {SchemaType} [schema]
@@ -157,7 +161,7 @@ function getReduceObjectFor (schema, parentUri) {
157
161
  return function reduce (hash, [key, document]) {
158
162
  const schemaUri = getUri(parentUri, key)
159
163
 
160
- return fromDocumentToHash(document, getSchema(schema, parentUri, schemaUri), hash, schemaUri, schemaUri)
164
+ return fromDocumentToHash(document, getSchemaFromProperties(schema, parentUri, schemaUri), hash, schemaUri, schemaUri)
161
165
  }
162
166
  }
163
167
 
@@ -193,6 +197,9 @@ export function transformObject (document, schema, hash, parentUri, uri) {
193
197
  */
194
198
 
195
199
  if (hasEnum(schema)) {
200
+ /**
201
+ * @link https://json-schema.org/draft/2019-09/json-schema-validation#rfc.section.6.1.2
202
+ */
196
203
  const array = getEnum(schema)
197
204
  const value = transformIndexToValueByFindEqual(array, document)
198
205
 
@@ -226,7 +233,7 @@ export function transformObject (document, schema, hash, parentUri, uri) {
226
233
  }
227
234
 
228
235
  /**
229
- * Document can be `undefined`
236
+ * Document can be undefined
230
237
  *
231
238
  * @param {DocumentType} [document]
232
239
  * @param {SchemaType} [schema]
@@ -257,7 +264,7 @@ export function transformObjectSchema (document, schema = {}, hash = {}, parentU
257
264
  }
258
265
 
259
266
  /**
260
- * Document can be `undefined`
267
+ * Document can be undefined
261
268
  *
262
269
  * @param {DocumentType} [document]
263
270
  * @param {SchemaType} [schema]
@@ -300,7 +307,7 @@ export default function fromDocumentToHash (document, schema = {}, hash = {}, pa
300
307
 
301
308
  return hash
302
309
  } else {
303
- /**
310
+ /*
304
311
  * Is the schema an `anyOf`?
305
312
  */
306
313
  if (hasAnyOf(schema)) {
@@ -311,7 +318,7 @@ export default function fromDocumentToHash (document, schema = {}, hash = {}, pa
311
318
 
312
319
  return hash
313
320
  } else {
314
- /**
321
+ /*
315
322
  * Is the schema a `oneOf`?
316
323
  */
317
324
  if (hasOneOf(schema)) {
@@ -23,7 +23,7 @@ const log = debug('shinkansen-transmission/from-document-to-hash/null')
23
23
  log('`shinkansen` is awake')
24
24
 
25
25
  /**
26
- * Document can be `undefined`
26
+ * Document can be undefined
27
27
  *
28
28
  * @param {DocumentType} [document]
29
29
  * @param {SchemaType} [schema]
@@ -36,6 +36,9 @@ export default function transformNullSchema (document, schema = {}, hash = {}, p
36
36
  log('transformNullSchema')
37
37
 
38
38
  if (hasEnum(schema)) {
39
+ /**
40
+ * @link https://json-schema.org/draft/2019-09/json-schema-validation#rfc.section.6.1.2
41
+ */
39
42
  const array = getEnum(schema)
40
43
  const value = transformIndexToValueByFindValue(array, document)
41
44
 
@@ -23,7 +23,7 @@ const log = debug('shinkansen-transmission/from-document-to-hash/number')
23
23
  log('`shinkansen` is awake')
24
24
 
25
25
  /**
26
- * Document can be `undefined`
26
+ * Document can be undefined
27
27
  *
28
28
  * @param {DocumentType} [document]
29
29
  * @param {SchemaType} [schema]
@@ -36,6 +36,9 @@ export default function transformNumberSchema (document, schema = {}, hash = {},
36
36
  log('transformNumberSchema')
37
37
 
38
38
  if (hasEnum(schema)) {
39
+ /**
40
+ * @link https://json-schema.org/draft/2019-09/json-schema-validation#rfc.section.6.1.2
41
+ */
39
42
  const array = getEnum(schema)
40
43
  const value = transformIndexToValueByFindValue(array, document)
41
44