New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

vue-types

Package Overview
Dependencies
Maintainers
1
Versions
97
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-types - npm Package Compare versions

Comparing version 0.6.5 to 1.0.0-beta.1

66

dist/index.js

@@ -16,5 +16,4 @@ 'use strict';

get any() {
return (0, _utils.toType)({
type: null,
name: 'any'
return (0, _utils.toType)('any', {
type: null
});

@@ -24,5 +23,4 @@ },

get func() {
return (0, _utils.toType)({
return (0, _utils.toType)('function', {
type: Function,
name: 'function',
default: _utils.noop

@@ -33,5 +31,4 @@ });

get bool() {
return (0, _utils.toType)({
return (0, _utils.toType)('boolean', {
type: Boolean,
name: 'boolean',
default: true

@@ -42,5 +39,4 @@ });

get string() {
return (0, _utils.toType)({
return (0, _utils.toType)('string', {
type: String,
name: 'string',
default: ''

@@ -51,5 +47,4 @@ });

get number() {
return (0, _utils.toType)({
return (0, _utils.toType)('number', {
type: Number,
name: 'number',
default: 0

@@ -60,5 +55,4 @@ });

get array() {
return (0, _utils.toType)({
return (0, _utils.toType)('array', {
type: Array,
name: 'array',
default: Array

@@ -69,5 +63,4 @@ });

get object() {
return (0, _utils.toType)({
return (0, _utils.toType)('object', {
type: Object,
name: 'object',
default: Object

@@ -78,5 +71,4 @@ });

get integer() {
return (0, _utils.toType)({
return (0, _utils.toType)('integer', {
type: Number,
name: 'integer',
validator: function validator(value) {

@@ -97,7 +89,6 @@ return (0, _utils.isInteger)(value);

return (0, _utils.toType)({
name: validatorFn.name || '<<anonymous function>>',
return (0, _utils.toType)(validatorFn.name || '<<anonymous function>>', {
validator: function validator() {
var valid = validatorFn.apply(undefined, arguments);
if (!valid) (0, _utils.warn)(warnMsg);
if (!valid) (0, _utils.warn)(this._vueTypes_name + ' - ' + warnMsg);
return valid;

@@ -111,3 +102,3 @@ }

}
var msg = 'value should be one of "' + arr.join('", "') + '"';
var msg = 'oneOf - value should be one of "' + arr.join('", "') + '"';
var allowedTypes = arr.reduce(function (ret, v) {

@@ -120,4 +111,3 @@ if (v !== null && v !== undefined) {

return (0, _utils.toType)({
name: 'oneOf',
return (0, _utils.toType)('oneOf', {
type: allowedTypes.length > 0 ? allowedTypes : null,

@@ -132,4 +122,3 @@ validator: function validator(value) {

instanceOf: function instanceOf(instanceConstructor) {
return (0, _utils.toType)({
name: 'instanceOf',
return (0, _utils.toType)('instanceOf', {
type: instanceConstructor

@@ -147,3 +136,3 @@ });

if ((0, _lodash2.default)(type)) {
if (type.name === 'oneOf') {
if (type._vueTypes_name === 'oneOf') {
return ret.concat(type.type || []);

@@ -166,4 +155,3 @@ }

// delegate to Vue native prop check
return (0, _utils.toType)({
name: 'oneOfType',
return (0, _utils.toType)('oneOfType', {
type: nativeChecks

@@ -184,3 +172,3 @@ });

var valid = arr.some(function (type) {
if (type.name === 'oneOf') {
if (type._vueTypes_name === 'oneOf') {
return type.type ? (0, _utils.validateType)(type.type, value, true) : true;

@@ -190,3 +178,3 @@ }

});
if (!valid) (0, _utils.warn)('value type should be one of "' + typesStr + '"');
if (!valid) (0, _utils.warn)('oneOfType - value type should be one of "' + typesStr + '"');
return valid;

@@ -196,4 +184,3 @@ });

arrayOf: function arrayOf(type) {
return (0, _utils.toType)({
name: 'arrayOf',
return (0, _utils.toType)('arrayOf', {
type: Array,

@@ -204,3 +191,3 @@ validator: function validator(values) {

});
if (!valid) (0, _utils.warn)('value must be an array of \'' + (0, _utils.getType)(type) + '\'');
if (!valid) (0, _utils.warn)('arrayOf - value must be an array of "' + (0, _utils.getType)(type) + '"');
return valid;

@@ -211,4 +198,3 @@ }

objectOf: function objectOf(type) {
return (0, _utils.toType)({
name: 'objectOf',
return (0, _utils.toType)('objectOf', {
type: Object,

@@ -219,3 +205,3 @@ validator: function validator(obj) {

});
if (!valid) (0, _utils.warn)('value must be an object of \'' + (0, _utils.getType)(type) + '\'');
if (!valid) (0, _utils.warn)('objectOf - value must be an object of "' + (0, _utils.getType)(type) + '"');
return valid;

@@ -231,4 +217,3 @@ }

var type = (0, _utils.toType)({
name: 'shape',
var type = (0, _utils.toType)('shape', {
type: Object,

@@ -247,3 +232,3 @@ validator: function validator(value) {

})) {
(0, _utils.warn)('at least one of required properties "' + requiredKeys.join('", "') + '" is not present');
(0, _utils.warn)('shape - at least one of required properties "' + requiredKeys.join('", "') + '" is not present');
return false;

@@ -255,3 +240,3 @@ }

if (_this._vueTypes_isLoose === true) return true;
(0, _utils.warn)('object is missing "' + key + '" property');
(0, _utils.warn)('shape - object is missing "' + key + '" property');
return false;

@@ -264,3 +249,2 @@ }

});
type.validator = type.validator.bind(type);

@@ -267,0 +251,0 @@ Object.defineProperty(type, '_vueTypes_isLoose', {

@@ -10,6 +10,2 @@ 'use strict';

var _objectAssign = require('object-assign');
var _objectAssign2 = _interopRequireDefault(_objectAssign);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -91,14 +87,9 @@

if (!validateType(this, def)) {
warn('invalid default value', def);
return type;
warn(this._vueTypes_name + ' - invalid default value: "' + def + '"', def);
return this;
}
var newType = (0, _objectAssign2.default)({}, this, {
default: isArray(def) || (0, _lodash2.default)(def) ? function () {
return def;
} : def
});
if (!hasOwn.call(newType, 'required')) {
withRequired(newType);
}
return newType;
this.default = isArray(def) || (0, _lodash2.default)(def) ? function () {
return def;
} : def;
return this;
},

@@ -119,5 +110,4 @@

get: function get() {
var newType = (0, _objectAssign2.default)({ required: true }, this);
withDefault(newType);
return newType;
this.required = true;
return this;
},

@@ -132,8 +122,18 @@

*
* @param {string} name - Type internal name
* @param {object} obj - Object to enhance
* @returns {object}
*/
var toType = exports.toType = function toType(obj) {
var toType = exports.toType = function toType(name, obj) {
Object.defineProperty(obj, '_vueTypes_name', {
enumerable: false,
writable: false,
value: name
});
withRequired(obj);
withDefault(obj);
if (isFunction(obj.validator)) {
obj.validator = obj.validator.bind(obj);
}
return obj;

@@ -143,3 +143,3 @@ };

/**
* Validates a given value agains a prop type object
* Validates a given value against a prop type object
*

@@ -160,2 +160,3 @@ * @param {Object|*} type - Type to use for validation. Either a type object or a constructor

}
var namePrefix = typeToCheck._vueTypes_name ? typeToCheck._vueTypes_name + ' - ' : '';

@@ -186,3 +187,3 @@ if (hasOwn.call(typeToCheck, 'type') && typeToCheck.type !== null) {

if (!valid) {
silent === false && warn('value "' + value + '" should be of type \'' + expectedType + '\'');
silent === false && warn(namePrefix + 'value "' + value + '" should be of type "' + expectedType + '"');
return false;

@@ -193,3 +194,3 @@ }

valid = typeToCheck.validator(value);
if (!valid && silent === false) warn('custom validation failed');
if (!valid && silent === false) warn(namePrefix + 'custom validation failed');
return valid;

@@ -196,0 +197,0 @@ }

@@ -7,5 +7,4 @@ import isPlainObject from 'lodash.isplainobject';

get any() {
return toType({
type: null,
name: 'any'
return toType('any', {
type: null
});

@@ -15,5 +14,4 @@ },

get func() {
return toType({
return toType('function', {
type: Function,
name: 'function',
default: noop

@@ -24,5 +22,4 @@ });

get bool() {
return toType({
return toType('boolean', {
type: Boolean,
name: 'boolean',
default: true

@@ -33,5 +30,4 @@ });

get string() {
return toType({
return toType('string', {
type: String,
name: 'string',
default: ''

@@ -42,5 +38,4 @@ });

get number() {
return toType({
return toType('number', {
type: Number,
name: 'number',
default: 0

@@ -51,5 +46,4 @@ });

get array() {
return toType({
return toType('array', {
type: Array,
name: 'array',
default: Array

@@ -60,5 +54,4 @@ });

get object() {
return toType({
return toType('object', {
type: Object,
name: 'object',
default: Object

@@ -69,5 +62,4 @@ });

get integer() {
return toType({
return toType('integer', {
type: Number,
name: 'integer',
validator: function validator(value) {

@@ -88,7 +80,6 @@ return isInteger(value);

return toType({
name: validatorFn.name || '<<anonymous function>>',
return toType(validatorFn.name || '<<anonymous function>>', {
validator: function validator() {
var valid = validatorFn.apply(undefined, arguments);
if (!valid) warn(warnMsg);
if (!valid) warn(this._vueTypes_name + ' - ' + warnMsg);
return valid;

@@ -102,3 +93,3 @@ }

}
var msg = 'value should be one of "' + arr.join('", "') + '"';
var msg = 'oneOf - value should be one of "' + arr.join('", "') + '"';
var allowedTypes = arr.reduce(function (ret, v) {

@@ -111,4 +102,3 @@ if (v !== null && v !== undefined) {

return toType({
name: 'oneOf',
return toType('oneOf', {
type: allowedTypes.length > 0 ? allowedTypes : null,

@@ -123,4 +113,3 @@ validator: function validator(value) {

instanceOf: function instanceOf(instanceConstructor) {
return toType({
name: 'instanceOf',
return toType('instanceOf', {
type: instanceConstructor

@@ -138,3 +127,3 @@ });

if (isPlainObject(type)) {
if (type.name === 'oneOf') {
if (type._vueTypes_name === 'oneOf') {
return ret.concat(type.type || []);

@@ -157,4 +146,3 @@ }

// delegate to Vue native prop check
return toType({
name: 'oneOfType',
return toType('oneOfType', {
type: nativeChecks

@@ -175,3 +163,3 @@ });

var valid = arr.some(function (type) {
if (type.name === 'oneOf') {
if (type._vueTypes_name === 'oneOf') {
return type.type ? validateType(type.type, value, true) : true;

@@ -181,3 +169,3 @@ }

});
if (!valid) warn('value type should be one of "' + typesStr + '"');
if (!valid) warn('oneOfType - value type should be one of "' + typesStr + '"');
return valid;

@@ -187,4 +175,3 @@ });

arrayOf: function arrayOf(type) {
return toType({
name: 'arrayOf',
return toType('arrayOf', {
type: Array,

@@ -195,3 +182,3 @@ validator: function validator(values) {

});
if (!valid) warn('value must be an array of \'' + getType(type) + '\'');
if (!valid) warn('arrayOf - value must be an array of "' + getType(type) + '"');
return valid;

@@ -202,4 +189,3 @@ }

objectOf: function objectOf(type) {
return toType({
name: 'objectOf',
return toType('objectOf', {
type: Object,

@@ -210,3 +196,3 @@ validator: function validator(obj) {

});
if (!valid) warn('value must be an object of \'' + getType(type) + '\'');
if (!valid) warn('objectOf - value must be an object of "' + getType(type) + '"');
return valid;

@@ -222,4 +208,3 @@ }

var type = toType({
name: 'shape',
var type = toType('shape', {
type: Object,

@@ -238,3 +223,3 @@ validator: function validator(value) {

})) {
warn('at least one of required properties "' + requiredKeys.join('", "') + '" is not present');
warn('shape - at least one of required properties "' + requiredKeys.join('", "') + '" is not present');
return false;

@@ -246,3 +231,3 @@ }

if (_this._vueTypes_isLoose === true) return true;
warn('object is missing "' + key + '" property');
warn('shape - object is missing "' + key + '" property');
return false;

@@ -255,3 +240,2 @@ }

});
type.validator = type.validator.bind(type);

@@ -258,0 +242,0 @@ Object.defineProperty(type, '_vueTypes_isLoose', {

import isPlainObject from 'lodash.isplainobject';
import objectAssign from 'object-assign';

@@ -78,14 +77,9 @@ var ObjProto = Object.prototype;

if (!validateType(this, def)) {
warn('invalid default value', def);
return type;
warn(this._vueTypes_name + ' - invalid default value: "' + def + '"', def);
return this;
}
var newType = objectAssign({}, this, {
default: isArray(def) || isPlainObject(def) ? function () {
return def;
} : def
});
if (!hasOwn.call(newType, 'required')) {
withRequired(newType);
}
return newType;
this.default = isArray(def) || isPlainObject(def) ? function () {
return def;
} : def;
return this;
},

@@ -106,5 +100,4 @@

get: function get() {
var newType = objectAssign({ required: true }, this);
withDefault(newType);
return newType;
this.required = true;
return this;
},

@@ -119,8 +112,18 @@

*
* @param {string} name - Type internal name
* @param {object} obj - Object to enhance
* @returns {object}
*/
export var toType = function toType(obj) {
export var toType = function toType(name, obj) {
Object.defineProperty(obj, '_vueTypes_name', {
enumerable: false,
writable: false,
value: name
});
withRequired(obj);
withDefault(obj);
if (isFunction(obj.validator)) {
obj.validator = obj.validator.bind(obj);
}
return obj;

@@ -130,3 +133,3 @@ };

/**
* Validates a given value agains a prop type object
* Validates a given value against a prop type object
*

@@ -147,2 +150,3 @@ * @param {Object|*} type - Type to use for validation. Either a type object or a constructor

}
var namePrefix = typeToCheck._vueTypes_name ? typeToCheck._vueTypes_name + ' - ' : '';

@@ -173,3 +177,3 @@ if (hasOwn.call(typeToCheck, 'type') && typeToCheck.type !== null) {

if (!valid) {
silent === false && warn('value "' + value + '" should be of type \'' + expectedType + '\'');
silent === false && warn(namePrefix + 'value "' + value + '" should be of type "' + expectedType + '"');
return false;

@@ -180,3 +184,3 @@ }

valid = typeToCheck.validator(value);
if (!valid && silent === false) warn('custom validation failed');
if (!valid && silent === false) warn(namePrefix + 'custom validation failed');
return valid;

@@ -183,0 +187,0 @@ }

{
"name": "vue-types",
"version": "0.6.5",
"version": "1.0.0-beta.1",
"description": "Prop types utility for Vue",

@@ -39,35 +39,34 @@ "author": "Marco Solazzi",

"devDependencies": {
"babel-cli": "6.18.0",
"babel-core": "6.18.0",
"babel-loader": "6.2.7",
"babel-cli": "6.24.0",
"babel-core": "6.24.0",
"babel-loader": "6.4.1",
"babel-plugin-add-module-exports": "0.2.1",
"babel-preset-es2015": "6.18.0",
"cross-env": "3.1.3",
"eslint": "3.8.1",
"eslint-config-vue": "1.1.0",
"eslint-plugin-html": "1.5.5",
"eslint-plugin-vue": "0.1.1",
"babel-preset-es2015": "6.24.0",
"cross-env": "4.0.0",
"eslint": "3.19.0",
"eslint-config-vue": "2.0.2",
"eslint-plugin-html": "2.0.1",
"eslint-plugin-vue": "2.0.1",
"expect": "1.20.2",
"express": "4.14.0",
"karma": "1.3.0",
"express": "4.15.2",
"karma": "1.5.0",
"karma-chrome-launcher": "2.0.0",
"karma-firefox-launcher": "1.0.0",
"karma-firefox-launcher": "1.0.1",
"karma-ie-launcher": "1.0.0",
"karma-mocha": "1.2.0",
"karma-mocha-reporter": "2.2.0",
"karma-mocha": "1.3.0",
"karma-mocha-reporter": "2.2.3",
"karma-opera-launcher": "1.0.0",
"karma-phantomjs-launcher": "1.0.2",
"karma-phantomjs-launcher": "1.0.4",
"karma-safari-launcher": "1.0.0",
"karma-sauce-launcher": "1.1.0",
"karma-sourcemap-loader": "0.3.7",
"karma-webpack": "1.8.0",
"mocha": "3.1.2",
"rimraf": "2.5.4",
"karma-webpack": "2.0.3",
"mocha": "3.2.0",
"rimraf": "2.6.1",
"serve-index": "1.8.0",
"webpack": "2.1.0-beta.25"
"webpack": "2.3.3"
},
"dependencies": {
"lodash.isplainobject": "4.0.6",
"object-assign": "4.1.0"
"lodash.isplainobject": "4.0.6"
}
}

@@ -7,5 +7,4 @@ import isPlainObject from 'lodash.isplainobject'

get any() {
return toType({
type: null,
name: 'any'
return toType('any', {
type: null
})

@@ -15,5 +14,4 @@ },

get func() {
return toType({
return toType('function', {
type: Function,
name: 'function',
default: noop

@@ -24,5 +22,4 @@ })

get bool() {
return toType({
return toType('boolean', {
type: Boolean,
name: 'boolean',
default: true

@@ -33,5 +30,4 @@ })

get string() {
return toType({
return toType('string', {
type: String,
name: 'string',
default: ''

@@ -42,5 +38,4 @@ })

get number() {
return toType({
return toType('number', {
type: Number,
name: 'number',
default: 0

@@ -51,5 +46,4 @@ })

get array() {
return toType({
return toType('array', {
type: Array,
name: 'array',
default: Array

@@ -60,5 +54,4 @@ })

get object() {
return toType({
return toType('object', {
type: Object,
name: 'object',
default: Object

@@ -69,5 +62,4 @@ })

get integer() {
return toType({
return toType('integer', {
type: Number,
name: 'integer',
validator(value) {

@@ -85,7 +77,6 @@ return isInteger(value)

return toType({
name: validatorFn.name || '<<anonymous function>>',
return toType(validatorFn.name || '<<anonymous function>>', {
validator(...args) {
const valid = validatorFn(...args)
if (!valid) warn(warnMsg)
if (!valid) warn(`${this._vueTypes_name} - ${warnMsg}`)
return valid

@@ -100,3 +91,3 @@ }

}
const msg = `value should be one of "${arr.join('", "')}"`
const msg = `oneOf - value should be one of "${arr.join('", "')}"`
const allowedTypes = arr.reduce((ret, v) => {

@@ -109,4 +100,3 @@ if (v !== null && v !== undefined) {

return toType({
name: 'oneOf',
return toType('oneOf', {
type: allowedTypes.length > 0 ? allowedTypes : null,

@@ -122,4 +112,3 @@ validator(value) {

instanceOf(instanceConstructor) {
return toType({
name: 'instanceOf',
return toType('instanceOf', {
type: instanceConstructor

@@ -138,3 +127,3 @@ })

if (isPlainObject(type)) {
if (type.name === 'oneOf') {
if (type._vueTypes_name === 'oneOf') {
return ret.concat(type.type || [])

@@ -157,4 +146,3 @@ }

// delegate to Vue native prop check
return toType({
name: 'oneOfType',
return toType('oneOfType', {
type: nativeChecks

@@ -173,3 +161,3 @@ })

const valid = arr.some((type) => {
if (type.name === 'oneOf') {
if (type._vueTypes_name === 'oneOf') {
return type.type ? validateType(type.type, value, true) : true

@@ -179,3 +167,3 @@ }

})
if (!valid) warn(`value type should be one of "${typesStr}"`)
if (!valid) warn(`oneOfType - value type should be one of "${typesStr}"`)
return valid

@@ -186,8 +174,7 @@ })

arrayOf(type) {
return toType({
name: 'arrayOf',
return toType('arrayOf', {
type: Array,
validator(values) {
const valid = values.every((value) => validateType(type, value))
if (!valid) warn(`value must be an array of '${getType(type)}'`)
if (!valid) warn(`arrayOf - value must be an array of "${getType(type)}"`)
return valid

@@ -199,8 +186,7 @@ }

objectOf(type) {
return toType({
name: 'objectOf',
return toType('objectOf', {
type: Object,
validator(obj) {
const valid = Object.keys(obj).every((key) => validateType(type, obj[key]))
if (!valid) warn(`value must be an object of '${getType(type)}'`)
if (!valid) warn(`objectOf - value must be an object of "${getType(type)}"`)
return valid

@@ -215,4 +201,3 @@ }

const type = toType({
name: 'shape',
const type = toType('shape', {
type: Object,

@@ -227,3 +212,3 @@ validator(value) {

if (requiredKeys.length > 0 && requiredKeys.some((req) => valueKeys.indexOf(req) === -1)) {
warn(`at least one of required properties "${requiredKeys.join('", "')}" is not present`)
warn(`shape - at least one of required properties "${requiredKeys.join('", "')}" is not present`)
return false

@@ -235,3 +220,3 @@ }

if (this._vueTypes_isLoose === true) return true
warn(`object is missing "${key}" property`)
warn(`shape - object is missing "${key}" property`)
return false

@@ -244,3 +229,2 @@ }

})
type.validator = type.validator.bind(type)

@@ -247,0 +231,0 @@ Object.defineProperty(type, '_vueTypes_isLoose', {

import isPlainObject from 'lodash.isplainobject'
import objectAssign from 'object-assign'

@@ -74,14 +73,9 @@ const ObjProto = Object.prototype

if (!validateType(this, def)) {
warn('invalid default value', def)
return type
warn(`${this._vueTypes_name} - invalid default value: "${def}"`, def)
return this
}
const newType = objectAssign({}, this, {
default: (isArray(def) || isPlainObject(def)) ? function () {
return def
} : def
})
if (!hasOwn.call(newType, 'required')) {
withRequired(newType)
}
return newType
this.default = (isArray(def) || isPlainObject(def)) ? function () {
return def
} : def
return this
},

@@ -101,5 +95,4 @@ enumerable: false,

get() {
const newType = objectAssign({ required: true }, this)
withDefault(newType)
return newType
this.required = true
return this
},

@@ -113,8 +106,18 @@ enumerable: false

*
* @param {string} name - Type internal name
* @param {object} obj - Object to enhance
* @returns {object}
*/
export const toType = (obj) => {
export const toType = (name, obj) => {
Object.defineProperty(obj, '_vueTypes_name', {
enumerable: false,
writable: false,
value: name
})
withRequired(obj)
withDefault(obj)
if (isFunction(obj.validator)) {
obj.validator = obj.validator.bind(obj)
}
return obj

@@ -124,3 +127,3 @@ }

/**
* Validates a given value agains a prop type object
* Validates a given value against a prop type object
*

@@ -139,2 +142,3 @@ * @param {Object|*} type - Type to use for validation. Either a type object or a constructor

}
const namePrefix = typeToCheck._vueTypes_name ? (typeToCheck._vueTypes_name + ' - ') : ''

@@ -161,3 +165,3 @@ if (hasOwn.call(typeToCheck, 'type') && typeToCheck.type !== null) {

if (!valid) {
silent === false && warn(`value "${value}" should be of type '${expectedType}'`)
silent === false && warn(`${namePrefix}value "${value}" should be of type "${expectedType}"`)
return false

@@ -168,3 +172,3 @@ }

valid = typeToCheck.validator(value)
if (!valid && silent === false) warn('custom validation failed')
if (!valid && silent === false) warn(`${namePrefix}custom validation failed`)
return valid

@@ -171,0 +175,0 @@ }

/**
* vue-types v0.6.4
* Copyright (c) 2016 Marco Solazzi
* vue-types v1.0.0-beta.1
* Copyright (c) 2017 Marco Solazzi
* MIT License

@@ -52,12 +52,14 @@ */

/******/
/******/ // identity function for calling harmory imports with the correct context
/******/ // identity function for calling harmony imports with the correct context
/******/ __webpack_require__.i = function(value) { return value; };
/******/
/******/ // define getter function for harmory exports
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };

@@ -81,3 +83,3 @@ /******/

/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 4);
/******/ return __webpack_require__(__webpack_require__.s = 3);
/******/ })

@@ -87,3 +89,3 @@ /************************************************************************/

/* 0 */
/***/ function(module, exports) {
/***/ (function(module, exports) {

@@ -231,9 +233,9 @@ /**

/***/ },
/***/ }),
/* 1 */
/***/ function(module, exports, __webpack_require__) {
/***/ (function(module, exports, __webpack_require__) {
"use strict";
'use strict';
exports.__esModule = true;

@@ -252,5 +254,4 @@

get any() {
return (0, _utils.toType)({
type: null,
name: 'any'
return (0, _utils.toType)('any', {
type: null
});

@@ -260,5 +261,4 @@ },

get func() {
return (0, _utils.toType)({
return (0, _utils.toType)('function', {
type: Function,
name: 'function',
default: _utils.noop

@@ -269,5 +269,4 @@ });

get bool() {
return (0, _utils.toType)({
return (0, _utils.toType)('boolean', {
type: Boolean,
name: 'boolean',
default: true

@@ -278,5 +277,4 @@ });

get string() {
return (0, _utils.toType)({
return (0, _utils.toType)('string', {
type: String,
name: 'string',
default: ''

@@ -287,5 +285,4 @@ });

get number() {
return (0, _utils.toType)({
return (0, _utils.toType)('number', {
type: Number,
name: 'number',
default: 0

@@ -296,5 +293,4 @@ });

get array() {
return (0, _utils.toType)({
return (0, _utils.toType)('array', {
type: Array,
name: 'array',
default: Array

@@ -305,5 +301,4 @@ });

get object() {
return (0, _utils.toType)({
return (0, _utils.toType)('object', {
type: Object,
name: 'object',
default: Object

@@ -314,5 +309,4 @@ });

get integer() {
return (0, _utils.toType)({
return (0, _utils.toType)('integer', {
type: Number,
name: 'integer',
validator: function validator(value) {

@@ -333,7 +327,6 @@ return (0, _utils.isInteger)(value);

return (0, _utils.toType)({
name: validatorFn.name || '<<anonymous function>>',
return (0, _utils.toType)(validatorFn.name || '<<anonymous function>>', {
validator: function validator() {
var valid = validatorFn.apply(undefined, arguments);
if (!valid) (0, _utils.warn)(warnMsg);
if (!valid) (0, _utils.warn)(this._vueTypes_name + ' - ' + warnMsg);
return valid;

@@ -347,3 +340,3 @@ }

}
var msg = 'value should be one of "' + arr.join('", "') + '"';
var msg = 'oneOf - value should be one of "' + arr.join('", "') + '"';
var allowedTypes = arr.reduce(function (ret, v) {

@@ -356,4 +349,3 @@ if (v !== null && v !== undefined) {

return (0, _utils.toType)({
name: 'oneOf',
return (0, _utils.toType)('oneOf', {
type: allowedTypes.length > 0 ? allowedTypes : null,

@@ -368,4 +360,3 @@ validator: function validator(value) {

instanceOf: function instanceOf(instanceConstructor) {
return (0, _utils.toType)({
name: 'instanceOf',
return (0, _utils.toType)('instanceOf', {
type: instanceConstructor

@@ -383,3 +374,3 @@ });

if ((0, _lodash2.default)(type)) {
if (type.name === 'oneOf') {
if (type._vueTypes_name === 'oneOf') {
return ret.concat(type.type || []);

@@ -402,4 +393,3 @@ }

// delegate to Vue native prop check
return (0, _utils.toType)({
name: 'oneOfType',
return (0, _utils.toType)('oneOfType', {
type: nativeChecks

@@ -420,3 +410,3 @@ });

var valid = arr.some(function (type) {
if (type.name === 'oneOf') {
if (type._vueTypes_name === 'oneOf') {
return type.type ? (0, _utils.validateType)(type.type, value, true) : true;

@@ -426,3 +416,3 @@ }

});
if (!valid) (0, _utils.warn)('value type should be one of "' + typesStr + '"');
if (!valid) (0, _utils.warn)('oneOfType - value type should be one of "' + typesStr + '"');
return valid;

@@ -432,4 +422,3 @@ });

arrayOf: function arrayOf(type) {
return (0, _utils.toType)({
name: 'arrayOf',
return (0, _utils.toType)('arrayOf', {
type: Array,

@@ -440,3 +429,3 @@ validator: function validator(values) {

});
if (!valid) (0, _utils.warn)('value must be an array of \'' + (0, _utils.getType)(type) + '\'');
if (!valid) (0, _utils.warn)('arrayOf - value must be an array of "' + (0, _utils.getType)(type) + '"');
return valid;

@@ -447,4 +436,3 @@ }

objectOf: function objectOf(type) {
return (0, _utils.toType)({
name: 'objectOf',
return (0, _utils.toType)('objectOf', {
type: Object,

@@ -455,3 +443,3 @@ validator: function validator(obj) {

});
if (!valid) (0, _utils.warn)('value must be an object of \'' + (0, _utils.getType)(type) + '\'');
if (!valid) (0, _utils.warn)('objectOf - value must be an object of "' + (0, _utils.getType)(type) + '"');
return valid;

@@ -467,4 +455,3 @@ }

var type = (0, _utils.toType)({
name: 'shape',
var type = (0, _utils.toType)('shape', {
type: Object,

@@ -483,3 +470,3 @@ validator: function validator(value) {

})) {
(0, _utils.warn)('at least one of required properties "' + requiredKeys.join('", "') + '" is not present');
(0, _utils.warn)('shape - at least one of required properties "' + requiredKeys.join('", "') + '" is not present');
return false;

@@ -491,3 +478,3 @@ }

if (_this._vueTypes_isLoose === true) return true;
(0, _utils.warn)('object is missing "' + key + '" property');
(0, _utils.warn)('shape - object is missing "' + key + '" property');
return false;

@@ -500,3 +487,2 @@ }

});
type.validator = type.validator.bind(type);

@@ -525,9 +511,9 @@ Object.defineProperty(type, '_vueTypes_isLoose', {

/***/ },
/***/ }),
/* 2 */
/***/ function(module, exports, __webpack_require__) {
/***/ (function(module, exports, __webpack_require__) {
"use strict";
'use strict';
exports.__esModule = true;

@@ -540,6 +526,2 @@ exports.warn = exports.validateType = exports.toType = exports.withRequired = exports.withDefault = exports.isFunction = exports.isArray = exports.isInteger = exports.has = exports.noop = exports.getNativeType = exports.getType = exports.hasOwn = undefined;

var _objectAssign = __webpack_require__(3);
var _objectAssign2 = _interopRequireDefault(_objectAssign);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -621,14 +603,9 @@

if (!validateType(this, def)) {
warn('invalid default value', def);
return type;
warn(this._vueTypes_name + ' - invalid default value: "' + def + '"', def);
return this;
}
var newType = (0, _objectAssign2.default)({}, this, {
default: isArray(def) || (0, _lodash2.default)(def) ? function () {
return def;
} : def
});
if (!hasOwn.call(newType, 'required')) {
withRequired(newType);
}
return newType;
this.default = isArray(def) || (0, _lodash2.default)(def) ? function () {
return def;
} : def;
return this;
},

@@ -649,5 +626,4 @@

get: function get() {
var newType = (0, _objectAssign2.default)({ required: true }, this);
withDefault(newType);
return newType;
this.required = true;
return this;
},

@@ -662,8 +638,18 @@

*
* @param {string} name - Type internal name
* @param {object} obj - Object to enhance
* @returns {object}
*/
var toType = exports.toType = function toType(obj) {
var toType = exports.toType = function toType(name, obj) {
Object.defineProperty(obj, '_vueTypes_name', {
enumerable: false,
writable: false,
value: name
});
withRequired(obj);
withDefault(obj);
if (isFunction(obj.validator)) {
obj.validator = obj.validator.bind(obj);
}
return obj;

@@ -673,3 +659,3 @@ };

/**
* Validates a given value agains a prop type object
* Validates a given value against a prop type object
*

@@ -690,2 +676,3 @@ * @param {Object|*} type - Type to use for validation. Either a type object or a constructor

}
var namePrefix = typeToCheck._vueTypes_name ? typeToCheck._vueTypes_name + ' - ' : '';

@@ -716,3 +703,3 @@ if (hasOwn.call(typeToCheck, 'type') && typeToCheck.type !== null) {

if (!valid) {
silent === false && warn('value "' + value + '" should be of type \'' + expectedType + '\'');
silent === false && warn(namePrefix + 'value "' + value + '" should be of type "' + expectedType + '"');
return false;

@@ -723,3 +710,3 @@ }

valid = typeToCheck.validator(value);
if (!valid && silent === false) warn('custom validation failed');
if (!valid && silent === false) warn(namePrefix + 'custom validation failed');
return valid;

@@ -743,102 +730,11 @@ }

/***/ },
/***/ }),
/* 3 */
/***/ function(module, exports) {
/***/ (function(module, exports, __webpack_require__) {
"use strict";
'use strict';
/* eslint-disable no-unused-vars */
var hasOwnProperty = Object.prototype.hasOwnProperty;
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
function toObject(val) {
if (val === null || val === undefined) {
throw new TypeError('Object.assign cannot be called with null or undefined');
}
return Object(val);
}
function shouldUseNative() {
try {
if (!Object.assign) {
return false;
}
// Detect buggy property enumeration order in older V8 versions.
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
var test1 = new String('abc'); // eslint-disable-line
test1[5] = 'de';
if (Object.getOwnPropertyNames(test1)[0] === '5') {
return false;
}
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
var test2 = {};
for (var i = 0; i < 10; i++) {
test2['_' + String.fromCharCode(i)] = i;
}
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
return test2[n];
});
if (order2.join('') !== '0123456789') {
return false;
}
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
var test3 = {};
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
test3[letter] = letter;
});
if (Object.keys(Object.assign({}, test3)).join('') !==
'abcdefghijklmnopqrst') {
return false;
}
return true;
} catch (e) {
// We don't expect any of the above to throw, but better to be safe.
return false;
}
}
module.exports = shouldUseNative() ? Object.assign : function (target, source) {
var from;
var to = toObject(target);
var symbols;
for (var s = 1; s < arguments.length; s++) {
from = Object(arguments[s]);
for (var key in from) {
if (hasOwnProperty.call(from, key)) {
to[key] = from[key];
}
}
if (Object.getOwnPropertySymbols) {
symbols = Object.getOwnPropertySymbols(from);
for (var i = 0; i < symbols.length; i++) {
if (propIsEnumerable.call(from, symbols[i])) {
to[symbols[i]] = from[symbols[i]];
}
}
}
}
return to;
};
/***/ },
/* 4 */
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(1);
/***/ }
/******/ ])
});
;
/***/ })
/******/ ]);
});

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.VueTypes=t():e.VueTypes=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,t,n){Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=4)}([function(e,t){function n(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function r(e,t){return function(n){return e(t(n))}}function o(e){return!!e&&"object"==typeof e}function u(e){if(!o(e)||y.call(e)!=i||n(e))return!1;var t=s(e);if(null===t)return!0;var r=p.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&f.call(r)==l}var i="[object Object]",a=Function.prototype,c=Object.prototype,f=a.toString,p=c.hasOwnProperty,l=f.call(Object),y=c.toString,s=r(Object.getPrototypeOf,Object);e.exports=u},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var o=n(0),u=r(o),i=n(2),a={get any(){return(0,i.toType)({type:null,name:"any"})},get func(){return(0,i.toType)({type:Function,name:"function",default:i.noop})},get bool(){return(0,i.toType)({type:Boolean,name:"boolean",default:!0})},get string(){return(0,i.toType)({type:String,name:"string",default:""})},get number(){return(0,i.toType)({type:Number,name:"number",default:0})},get array(){return(0,i.toType)({type:Array,name:"array",default:Array})},get object(){return(0,i.toType)({type:Object,name:"object",default:Object})},get integer(){return(0,i.toType)({type:Number,name:"integer",validator:function(e){return(0,i.isInteger)(e)},default:0})},custom:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"custom validation failed";if("function"!=typeof e)throw new TypeError("[VueTypes error]: You must provide a function as argument");return(0,i.toType)({name:e.name||"<<anonymous function>>",validator:function(){var n=e.apply(void 0,arguments);return n||(0,i.warn)(t),n}})},oneOf:function(e){if(!(0,i.isArray)(e))throw new TypeError("[VueTypes error]: You must provide an array as argument");var t='value should be one of "'+e.join('", "')+'"',n=e.reduce(function(e,t){return null!==t&&void 0!==t&&e.indexOf(t.constructor)===-1&&e.push(t.constructor),e},[]);return(0,i.toType)({name:"oneOf",type:n.length>0?n:null,validator:function(n){var r=e.indexOf(n)!==-1;return r||(0,i.warn)(t),r}})},instanceOf:function(e){return(0,i.toType)({name:"instanceOf",type:e})},oneOfType:function(e){if(!(0,i.isArray)(e))throw new TypeError("[VueTypes error]: You must provide an array as argument");var t=!1,n=e.reduce(function(e,n,r){if((0,u.default)(n)){if("oneOf"===n.name)return e.concat(n.type||[]);if(n.type&&!(0,i.isFunction)(n.validator)){if((0,i.isArray)(n.type))return e.concat(n.type);e.push(n.type)}else(0,i.isFunction)(n.validator)&&(t=!0);return e}return e.push(n),e},[]);if(!t)return(0,i.toType)({name:"oneOfType",type:n});var r=e.map(function(e){return e&&(0,i.isArray)(e.type)?e.type.map(i.getType):(0,i.getType)(e)}).reduce(function(e,t){return e.concat((0,i.isArray)(t)?t:[t])},[]).join('", "');return this.custom(function(t){var n=e.some(function(e){return"oneOf"===e.name?!e.type||(0,i.validateType)(e.type,t,!0):(0,i.validateType)(e,t,!0)});return n||(0,i.warn)('value type should be one of "'+r+'"'),n})},arrayOf:function(e){return(0,i.toType)({name:"arrayOf",type:Array,validator:function(t){var n=t.every(function(t){return(0,i.validateType)(e,t)});return n||(0,i.warn)("value must be an array of '"+(0,i.getType)(e)+"'"),n}})},objectOf:function(e){return(0,i.toType)({name:"objectOf",type:Object,validator:function(t){var n=Object.keys(t).every(function(n){return(0,i.validateType)(e,t[n])});return n||(0,i.warn)("value must be an object of '"+(0,i.getType)(e)+"'"),n}})},shape:function(e){var t=Object.keys(e),n=t.filter(function(t){return e[t]&&e[t].required===!0}),r=(0,i.toType)({name:"shape",type:Object,validator:function(r){var o=this;if(!(0,u.default)(r))return!1;var a=Object.keys(r);return n.length>0&&n.some(function(e){return a.indexOf(e)===-1})?((0,i.warn)('at least one of required properties "'+n.join('", "')+'" is not present'),!1):a.every(function(n){if(t.indexOf(n)===-1)return o._vueTypes_isLoose===!0||((0,i.warn)('object is missing "'+n+'" property'),!1);var u=e[n];return(0,i.validateType)(u,r[n])})}});return r.validator=r.validator.bind(r),Object.defineProperty(r,"_vueTypes_isLoose",{enumerable:!1,writable:!0,value:!1}),Object.defineProperty(r,"loose",{get:function(){return this._vueTypes_isLoose=!0,this},enumerable:!1}),r}};t.default=a,e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0,t.warn=t.validateType=t.toType=t.withRequired=t.withDefault=t.isFunction=t.isArray=t.isInteger=t.has=t.noop=t.getNativeType=t.getType=t.hasOwn=void 0;var o=n(0),u=r(o),i=n(3),a=r(i),c=Object.prototype,f=c.toString,p=t.hasOwn=c.hasOwnProperty,l=/^\s*function (\w+)/,y=t.getType=function(e){var t=null!==e&&void 0!==e?e.type?e.type:e:null,n=t&&t.toString().match(l);return n&&n[1]},s=t.getNativeType=function(e){if(null===e||void 0===e)return null;var t=e.constructor.toString().match(l);return t&&t[1]},d=t.noop=function(){},b=(t.has=function(e,t){return p.call(e,t)},t.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},t.isArray=Array.isArray||function(e){return"[object Array]"===f.call(e)}),v=t.isFunction=function(e){return"[object Function]"===f.call(e)},j=t.withDefault=function(e){Object.defineProperty(e,"def",{value:function(t){if(!m(this,t))return g("invalid default value",t),e;var n=(0,a.default)({},this,{default:b(t)||(0,u.default)(t)?function(){return t}:t});return p.call(n,"required")||O(n),n},enumerable:!1,writable:!1})},O=t.withRequired=function(e){Object.defineProperty(e,"isRequired",{get:function(){var e=(0,a.default)({required:!0},this);return j(e),e},enumerable:!1})},m=(t.toType=function(e){return O(e),j(e),e},t.validateType=function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=t,i=!0,a=void 0;return(0,u.default)(t)||(o={type:t}),p.call(o,"type")&&null!==o.type&&(b(o.type)?(i=o.type.some(function(t){return e(t,n,!0)}),a=o.type.map(function(e){return y(e)}).join(" or ")):(a=y(o),i="Array"===a?b(n):"Object"===a?(0,u.default)(n):"String"===a||"Number"===a||"Boolean"===a||"Function"===a?s(n)===a:n instanceof o.type)),i?p.call(o,"validator")&&v(o.validator)?(i=o.validator(n),i||r!==!1||g("custom validation failed"),i):i:(r===!1&&g('value "'+n+"\" should be of type '"+a+"'"),!1)}),g=d;t.warn=g},function(e,t){"use strict";function n(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function r(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;var r=Object.getOwnPropertyNames(t).map(function(e){return t[e]});if("0123456789"!==r.join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(e){o[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(e){return!1}}var o=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable;e.exports=r()?Object.assign:function(e,t){for(var r,i,a=n(e),c=1;c<arguments.length;c++){r=Object(arguments[c]);for(var f in r)o.call(r,f)&&(a[f]=r[f]);if(Object.getOwnPropertySymbols){i=Object.getOwnPropertySymbols(r);for(var p=0;p<i.length;p++)u.call(r,i[p])&&(a[i[p]]=r[i[p]])}}return a}},function(e,t,n){e.exports=n(1)}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.VueTypes=t():e.VueTypes=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=3)}([function(e,t){function n(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function r(e){return!!e&&"object"==typeof e}function o(e){if(!r(e)||y.call(e)!=u||n(e))return!1;var t=l(e);if(null===t)return!0;var o=f.call(t,"constructor")&&t.constructor;return"function"==typeof o&&o instanceof o&&c.call(o)==p}var u="[object Object]",i=Function.prototype,a=Object.prototype,c=i.toString,f=a.hasOwnProperty,p=c.call(Object),y=a.toString,l=function(e,t){return function(n){return e(t(n))}}(Object.getPrototypeOf,Object);e.exports=o},function(e,t,n){"use strict";t.__esModule=!0;var r=n(0),o=function(e){return e&&e.__esModule?e:{default:e}}(r),u=n(2),i={get any(){return(0,u.toType)("any",{type:null})},get func(){return(0,u.toType)("function",{type:Function,default:u.noop})},get bool(){return(0,u.toType)("boolean",{type:Boolean,default:!0})},get string(){return(0,u.toType)("string",{type:String,default:""})},get number(){return(0,u.toType)("number",{type:Number,default:0})},get array(){return(0,u.toType)("array",{type:Array,default:Array})},get object(){return(0,u.toType)("object",{type:Object,default:Object})},get integer(){return(0,u.toType)("integer",{type:Number,validator:function(e){return(0,u.isInteger)(e)},default:0})},custom:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"custom validation failed";if("function"!=typeof e)throw new TypeError("[VueTypes error]: You must provide a function as argument");return(0,u.toType)(e.name||"<<anonymous function>>",{validator:function(){var n=e.apply(void 0,arguments);return n||(0,u.warn)(this._vueTypes_name+" - "+t),n}})},oneOf:function(e){if(!(0,u.isArray)(e))throw new TypeError("[VueTypes error]: You must provide an array as argument");var t='oneOf - value should be one of "'+e.join('", "')+'"',n=e.reduce(function(e,t){return null!==t&&void 0!==t&&-1===e.indexOf(t.constructor)&&e.push(t.constructor),e},[]);return(0,u.toType)("oneOf",{type:n.length>0?n:null,validator:function(n){var r=-1!==e.indexOf(n);return r||(0,u.warn)(t),r}})},instanceOf:function(e){return(0,u.toType)("instanceOf",{type:e})},oneOfType:function(e){if(!(0,u.isArray)(e))throw new TypeError("[VueTypes error]: You must provide an array as argument");var t=!1,n=e.reduce(function(e,n,r){if((0,o.default)(n)){if("oneOf"===n._vueTypes_name)return e.concat(n.type||[]);if(n.type&&!(0,u.isFunction)(n.validator)){if((0,u.isArray)(n.type))return e.concat(n.type);e.push(n.type)}else(0,u.isFunction)(n.validator)&&(t=!0);return e}return e.push(n),e},[]);if(!t)return(0,u.toType)("oneOfType",{type:n});var r=e.map(function(e){return e&&(0,u.isArray)(e.type)?e.type.map(u.getType):(0,u.getType)(e)}).reduce(function(e,t){return e.concat((0,u.isArray)(t)?t:[t])},[]).join('", "');return this.custom(function(t){var n=e.some(function(e){return"oneOf"===e._vueTypes_name?!e.type||(0,u.validateType)(e.type,t,!0):(0,u.validateType)(e,t,!0)});return n||(0,u.warn)('oneOfType - value type should be one of "'+r+'"'),n})},arrayOf:function(e){return(0,u.toType)("arrayOf",{type:Array,validator:function(t){var n=t.every(function(t){return(0,u.validateType)(e,t)});return n||(0,u.warn)('arrayOf - value must be an array of "'+(0,u.getType)(e)+'"'),n}})},objectOf:function(e){return(0,u.toType)("objectOf",{type:Object,validator:function(t){var n=Object.keys(t).every(function(n){return(0,u.validateType)(e,t[n])});return n||(0,u.warn)('objectOf - value must be an object of "'+(0,u.getType)(e)+'"'),n}})},shape:function(e){var t=Object.keys(e),n=t.filter(function(t){return e[t]&&!0===e[t].required}),r=(0,u.toType)("shape",{type:Object,validator:function(r){var i=this;if(!(0,o.default)(r))return!1;var a=Object.keys(r);return n.length>0&&n.some(function(e){return-1===a.indexOf(e)})?((0,u.warn)('shape - at least one of required properties "'+n.join('", "')+'" is not present'),!1):a.every(function(n){if(-1===t.indexOf(n))return!0===i._vueTypes_isLoose||((0,u.warn)('shape - object is missing "'+n+'" property'),!1);var o=e[n];return(0,u.validateType)(o,r[n])})}});return Object.defineProperty(r,"_vueTypes_isLoose",{enumerable:!1,writable:!0,value:!1}),Object.defineProperty(r,"loose",{get:function(){return this._vueTypes_isLoose=!0,this},enumerable:!1}),r}};t.default=i,e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0,t.warn=t.validateType=t.toType=t.withRequired=t.withDefault=t.isFunction=t.isArray=t.isInteger=t.has=t.noop=t.getNativeType=t.getType=t.hasOwn=void 0;var r=n(0),o=function(e){return e&&e.__esModule?e:{default:e}}(r),u=Object.prototype,i=u.toString,a=t.hasOwn=u.hasOwnProperty,c=t.getType=function(e){var t=null!==e&&void 0!==e?e.type?e.type:e:null,n=t&&t.toString().match(/^\s*function (\w+)/);return n&&n[1]},f=t.getNativeType=function(e){if(null===e||void 0===e)return null;var t=e.constructor.toString().match(/^\s*function (\w+)/);return t&&t[1]},p=t.noop=function(){},y=(t.has=function(e,t){return a.call(e,t)},t.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},t.isArray=Array.isArray||function(e){return"[object Array]"===i.call(e)}),l=t.isFunction=function(e){return"[object Function]"===i.call(e)},s=t.withDefault=function(e){Object.defineProperty(e,"def",{value:function(e){return v(this,e)?(this.default=y(e)||(0,o.default)(e)?function(){return e}:e,this):(b(this._vueTypes_name+' - invalid default value: "'+e+'"',e),this)},enumerable:!1,writable:!1})},d=t.withRequired=function(e){Object.defineProperty(e,"isRequired",{get:function(){return this.required=!0,this},enumerable:!1})},v=(t.toType=function(e,t){return Object.defineProperty(t,"_vueTypes_name",{enumerable:!1,writable:!1,value:e}),d(t),s(t),l(t.validator)&&(t.validator=t.validator.bind(t)),t},t.validateType=function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],u=t,i=!0,p=void 0;(0,o.default)(t)||(u={type:t});var s=u._vueTypes_name?u._vueTypes_name+" - ":"";return a.call(u,"type")&&null!==u.type&&(y(u.type)?(i=u.type.some(function(t){return e(t,n,!0)}),p=u.type.map(function(e){return c(e)}).join(" or ")):(p=c(u),i="Array"===p?y(n):"Object"===p?(0,o.default)(n):"String"===p||"Number"===p||"Boolean"===p||"Function"===p?f(n)===p:n instanceof u.type)),i?a.call(u,"validator")&&l(u.validator)?(i=u.validator(n),i||!1!==r||b(s+"custom validation failed"),i):i:(!1===r&&b(s+'value "'+n+'" should be of type "'+p+'"'),!1)}),b=p;t.warn=b},function(e,t,n){e.exports=n(1)}])});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc