Skip to content

Commit

Permalink
Legacy api. Closes #1926
Browse files Browse the repository at this point in the history
  • Loading branch information
hueniverse committed Jun 22, 2019
1 parent 3108872 commit 5d4c0c9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
17 changes: 13 additions & 4 deletions lib/types/any/index.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
'use strict';

const Hoek = require('@hapi/hoek');
const Marker = require('@hapi/marker');

const Cast = require('../../cast');
const Settings = require('./settings');
const Ref = require('../../ref');
const Errors = require('../../errors');
const State = require('../state');
const Symbols = require('../symbols');

const Pkg = require('../../../package.json');

let Alternatives = null; // Delay-loaded to prevent circular dependencies
let Cast = null;
let Schemas = null;


const internals = {
Set: require('../../set')
Set: require('../../set'),
symbol: Marker('joi-any-base')
};


Expand All @@ -37,8 +41,6 @@ module.exports = internals.Any = class {

constructor() {

Cast = Cast || require('../../cast');

this.isJoi = true;
this._type = 'any';
this._settings = null;
Expand Down Expand Up @@ -957,6 +959,13 @@ internals.Any.prototype.disallow = internals.Any.prototype.not = internals.Any.p
internals.Any.prototype.exist = internals.Any.prototype.required;


internals.Any.prototype[internals.symbol] = {
version: Pkg.version,
compile: Cast.schema,
root: '_currentJoi'
};


internals._try = function (fn, args = []) {

let err;
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
"validation"
],
"dependencies": {
"@hapi/hoek": "6.x.x",
"@hapi/address": "2.x.x",
"@hapi/hoek": "6.x.x",
"@hapi/marker": "1.x.x",
"@hapi/topo": "3.x.x"
},
"devDependencies": {
Expand Down

0 comments on commit 5d4c0c9

Please sign in to comment.