-
-
Notifications
You must be signed in to change notification settings - Fork 59
Expand file tree
/
Copy pathIntegerSchema.js
More file actions
30 lines (27 loc) · 774 Bytes
/
IntegerSchema.js
File metadata and controls
30 lines (27 loc) · 774 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
'use strict'
const { NumberSchema } = require('./NumberSchema')
const initialState = {
type: 'integer'
}
/**
* Represents a NumberSchema.
* @param {Object} [options] - Options
* @param {NumberSchema} [options.schema] - Default schema
* @param {boolean} [options.generateIds = false] - generate the id automatically e.g. #properties.foo
* @returns {NumberSchema}
*/
// https://medium.com/javascript-scene/javascript-factory-functions-with-es6-4d224591a8b1
// Factory Functions for Mixin Composition withBaseSchema
const IntegerSchema = (
{ schema, ...options } = {
schema: initialState,
generateIds: false,
factory: IntegerSchema
}
) => ({
...NumberSchema({ ...options, schema })
})
module.exports = {
IntegerSchema,
default: IntegerSchema
}