Skip to content

Commit 0464639

Browse files
committed
Move types into their own folder
1 parent 78843fa commit 0464639

File tree

27 files changed

+69
-69
lines changed

27 files changed

+69
-69
lines changed

lib/cast.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,20 @@ const Ref = require('./ref');
1212

1313
const internals = {
1414
any: null,
15-
date: require('./date'),
16-
string: require('./string'),
17-
number: require('./number'),
18-
boolean: require('./boolean'),
15+
date: require('./types/date'),
16+
string: require('./types/string'),
17+
number: require('./types/number'),
18+
boolean: require('./types/boolean'),
1919
alt: null,
2020
object: null
2121
};
2222

2323

2424
exports.schema = function (config) {
2525

26-
internals.any = internals.any || new (require('./any'))();
27-
internals.alt = internals.alt || require('./alternatives');
28-
internals.object = internals.object || require('./object');
26+
internals.any = internals.any || new (require('./types/any'))();
27+
internals.alt = internals.alt || require('./types/alternatives');
28+
internals.object = internals.object || require('./types/object');
2929

3030
if (config !== undefined && config !== null && typeof config === 'object') {
3131

lib/index.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,24 @@
33
// Load modules
44

55
const Hoek = require('hoek');
6-
const Any = require('./any');
6+
const Any = require('./types/any');
77
const Cast = require('./cast');
88
const Errors = require('./errors');
9-
const Lazy = require('./lazy');
9+
const Lazy = require('./types/lazy');
1010
const Ref = require('./ref');
1111

1212

1313
// Declare internals
1414

1515
const internals = {
16-
alternatives: require('./alternatives'),
17-
array: require('./array'),
18-
boolean: require('./boolean'),
19-
binary: require('./binary'),
20-
date: require('./date'),
21-
number: require('./number'),
22-
object: require('./object'),
23-
string: require('./string')
16+
alternatives: require('./types/alternatives'),
17+
array: require('./types/array'),
18+
boolean: require('./types/boolean'),
19+
binary: require('./types/binary'),
20+
date: require('./types/date'),
21+
number: require('./types/number'),
22+
object: require('./types/object'),
23+
string: require('./types/string')
2424
};
2525

2626

lib/alternatives.js renamed to lib/types/alternatives/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
// Load modules
44

55
const Hoek = require('hoek');
6-
const Any = require('./any');
7-
const Cast = require('./cast');
8-
const Ref = require('./ref');
6+
const Any = require('../any');
7+
const Cast = require('../../cast');
8+
const Ref = require('../../ref');
99

1010

1111
// Declare internals

lib/any.js renamed to lib/types/any/index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
// Load modules
44

55
const Hoek = require('hoek');
6-
const Ref = require('./ref');
7-
const Errors = require('./errors');
6+
const Ref = require('../../ref');
7+
const Errors = require('../../errors');
88
let Alternatives = null; // Delay-loaded to prevent circular dependencies
99
let Cast = null;
1010

1111

1212
// Declare internals
1313

1414
const internals = {
15-
Set: require('./set')
15+
Set: require('../../set')
1616
};
1717

1818

@@ -35,7 +35,7 @@ module.exports = internals.Any = class {
3535

3636
constructor() {
3737

38-
Cast = Cast || require('./cast');
38+
Cast = Cast || require('../../cast');
3939

4040
this.isJoi = true;
4141
this._type = 'any';
@@ -83,7 +83,7 @@ module.exports = internals.Any = class {
8383

8484
checkOptions(options) {
8585

86-
const Schemas = require('./schemas');
86+
const Schemas = require('../../schemas');
8787
const result = Schemas.options.validate(options);
8888
if (result.error) {
8989
throw new Error(result.error.details[0].message);
@@ -381,7 +381,7 @@ module.exports = internals.Any = class {
381381
const then = options.hasOwnProperty('then') ? this.concat(Cast.schema(options.then)) : undefined;
382382
const otherwise = options.hasOwnProperty('otherwise') ? this.concat(Cast.schema(options.otherwise)) : undefined;
383383

384-
Alternatives = Alternatives || require('./alternatives');
384+
Alternatives = Alternatives || require('../alternatives');
385385
const obj = Alternatives.when(ref, { is: options.is, then, otherwise });
386386
obj._flags.presence = 'ignore';
387387
obj._baseType = this;

lib/array.js renamed to lib/types/array/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
// Load modules
44

5-
const Any = require('./any');
6-
const Cast = require('./cast');
5+
const Any = require('../any');
6+
const Cast = require('../../cast');
77
const Hoek = require('hoek');
88

99

lib/binary.js renamed to lib/types/binary/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// Load modules
44

5-
const Any = require('./any');
5+
const Any = require('../any');
66
const Hoek = require('hoek');
77

88

lib/boolean.js renamed to lib/types/boolean/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
// Load modules
44

5-
const Any = require('./any');
5+
const Any = require('../any');
66
const Hoek = require('hoek');
77

88

99
// Declare internals
1010

1111
const internals = {
12-
Set: require('./set')
12+
Set: require('../../set')
1313
};
1414

1515

lib/date.js renamed to lib/types/date/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
// Load modules
44

5-
const Any = require('./any');
6-
const Ref = require('./ref');
5+
const Any = require('../any');
6+
const Ref = require('../../ref');
77
const Hoek = require('hoek');
88

99

lib/lazy.js renamed to lib/types/lazy/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// Load modules
44

5-
const Any = require('./any');
5+
const Any = require('../any');
66
const Hoek = require('hoek');
77

88

lib/number.js renamed to lib/types/number/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
// Load modules
44

5-
const Any = require('./any');
6-
const Ref = require('./ref');
5+
const Any = require('../any');
6+
const Ref = require('../../ref');
77
const Hoek = require('hoek');
88

99

0 commit comments

Comments
 (0)