Huge News!Announcing our $40M Series B led by Abstract Ventures.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.1 to 0.6.2

3

dist/utils.js

@@ -135,2 +135,5 @@ 'use strict';

withDefault(obj);
if (obj.validator && isFunction(obj.validator)) {
obj.validator = obj.validator.bind(obj);
}
return obj;

@@ -137,0 +140,0 @@ };

@@ -123,2 +123,5 @@ import isPlainObject from 'lodash.isplainobject';

withDefault(obj);
if (obj.validator && isFunction(obj.validator)) {
obj.validator = obj.validator.bind(obj);
}
return obj;

@@ -125,0 +128,0 @@ };

2

package.json
{
"name": "vue-types",
"version": "0.6.1",
"version": "0.6.2",
"description": "Prop types utility for Vue",

@@ -5,0 +5,0 @@ "author": "Marco Solazzi",

/**
* vue-types v0.5.2
* vue-types v0.6.2
* Copyright (c) 2016 Marco Solazzi

@@ -725,2 +725,5 @@ * MIT License

withDefault(obj);
if (obj.validator && isFunction(obj.validator)) {
obj.validator = obj.validator.bind(obj);
}
return obj;

@@ -727,0 +730,0 @@ };

@@ -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){"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){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var o=n(0),u=r(o),i=n(1),a=r(i),c=n(3),f={get any(){return(0,c.toType)({type:null,name:"any"})},get func(){return(0,c.toType)({type:Function,name:"function",default:c.noop})},get bool(){return(0,c.toType)({type:Boolean,name:"boolean",default:!0})},get string(){return(0,c.toType)({type:String,name:"string",default:""})},get number(){return(0,c.toType)({type:Number,name:"number",default:0})},get array(){return(0,c.toType)({type:Array,name:"array",default:Array})},get object(){return(0,c.toType)({type:Object,name:"object",default:Object})},get integer(){return(0,c.toType)({type:Number,name:"integer",validator:function(e){return(0,c.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,c.toType)({name:e.name||"<<anonymous function>>",validator:function(){var n=e.apply(void 0,arguments);return n||(0,c.warn)(t),n}})},oneOf:function(e){if(!(0,c.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,c.toType)({name:"oneOf",type:n.length>0?n:null,validator:function(n){var r=e.indexOf(n)!==-1;return r||(0,c.warn)(t),r}})},instanceOf:function(e){return(0,c.toType)({name:"instanceOf",type:e})},oneOfType:function(e){if(!(0,c.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,c.isFunction)(n.validator)){if((0,c.isArray)(n.type))return e.concat(n.type);e.push(n.type)}else(0,c.isFunction)(n.validator)&&(t=!0);return e}return e.push(n),e},[]);if(!t)return(0,c.toType)({name:"oneOfType",type:n});var r=e.map(function(e){return e&&(0,c.isArray)(e.type)?e.type.map(c.getType):(0,c.getType)(e)}).reduce(function(e,t){return e.concat((0,c.isArray)(t)?t:[t])},[]).join('", "');return this.custom(function(t){var n=e.some(function(e){return"oneOf"===e.name?!e.type||(0,c.validateType)(e.type,t,!0):(0,c.validateType)(e,t,!0)});return n||(0,c.warn)('value type should be one of "'+r+'"'),n})},arrayOf:function(e){return(0,c.toType)({name:"arrayOf",type:Array,validator:function(t){var n=t.every(function(t){return(0,c.validateType)(e,t)});return n||(0,c.warn)("value must be an array of '"+(0,c.getType)(e)+"'"),n}})},objectOf:function(e){return(0,c.toType)({name:"objectOf",type:Object,validator:function(t){var n=Object.keys(t).every(function(n){return(0,c.validateType)(e,t[n])});return n||(0,c.warn)("value must be an object of '"+(0,c.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,c.toType)({name:"shape",type:Object,validator:function(r){var o=this;if(!(0,u.default)(r))return!1;var i=Object.keys(r);return n.length>0&&n.some(function(e){return i.indexOf(e)===-1})?((0,c.warn)('at least one of required properties "'+n.join('", "')+'" is not present'),!1):i.every(function(n){if(t.indexOf(n)===-1)return o.isLoose===!0||((0,c.warn)('object is missing "'+n+'" property'),!1);var u=e[n];return(0,c.validateType)(u,r[n])})}});return Object.defineProperty(r,"loose",{get:function(){var e=(0,a.default)({isLoose:!0},this);return(0,c.withRequired)(e),(0,c.withDefault)(e),e},enumerable:!1}),r}};t.default=f,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(1),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,n){e.exports=n(2)}])});
!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=l.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&f.call(r)==p}var i="[object Object]",a=Function.prototype,c=Object.prototype,f=a.toString,l=c.hasOwnProperty,p=f.call(Object),y=c.toString,s=r(Object.getPrototypeOf,Object);e.exports=u},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 l=0;l<i.length;l++)u.call(r,i[l])&&(a[i[l]]=r[i[l]])}}return a}},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(1),a=r(i),c=n(3),f={get any(){return(0,c.toType)({type:null,name:"any"})},get func(){return(0,c.toType)({type:Function,name:"function",default:c.noop})},get bool(){return(0,c.toType)({type:Boolean,name:"boolean",default:!0})},get string(){return(0,c.toType)({type:String,name:"string",default:""})},get number(){return(0,c.toType)({type:Number,name:"number",default:0})},get array(){return(0,c.toType)({type:Array,name:"array",default:Array})},get object(){return(0,c.toType)({type:Object,name:"object",default:Object})},get integer(){return(0,c.toType)({type:Number,name:"integer",validator:function(e){return(0,c.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,c.toType)({name:e.name||"<<anonymous function>>",validator:function(){var n=e.apply(void 0,arguments);return n||(0,c.warn)(t),n}})},oneOf:function(e){if(!(0,c.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,c.toType)({name:"oneOf",type:n.length>0?n:null,validator:function(n){var r=e.indexOf(n)!==-1;return r||(0,c.warn)(t),r}})},instanceOf:function(e){return(0,c.toType)({name:"instanceOf",type:e})},oneOfType:function(e){if(!(0,c.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,c.isFunction)(n.validator)){if((0,c.isArray)(n.type))return e.concat(n.type);e.push(n.type)}else(0,c.isFunction)(n.validator)&&(t=!0);return e}return e.push(n),e},[]);if(!t)return(0,c.toType)({name:"oneOfType",type:n});var r=e.map(function(e){return e&&(0,c.isArray)(e.type)?e.type.map(c.getType):(0,c.getType)(e)}).reduce(function(e,t){return e.concat((0,c.isArray)(t)?t:[t])},[]).join('", "');return this.custom(function(t){var n=e.some(function(e){return"oneOf"===e.name?!e.type||(0,c.validateType)(e.type,t,!0):(0,c.validateType)(e,t,!0)});return n||(0,c.warn)('value type should be one of "'+r+'"'),n})},arrayOf:function(e){return(0,c.toType)({name:"arrayOf",type:Array,validator:function(t){var n=t.every(function(t){return(0,c.validateType)(e,t)});return n||(0,c.warn)("value must be an array of '"+(0,c.getType)(e)+"'"),n}})},objectOf:function(e){return(0,c.toType)({name:"objectOf",type:Object,validator:function(t){var n=Object.keys(t).every(function(n){return(0,c.validateType)(e,t[n])});return n||(0,c.warn)("value must be an object of '"+(0,c.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,c.toType)({name:"shape",type:Object,validator:function(r){var o=this;if(!(0,u.default)(r))return!1;var i=Object.keys(r);return n.length>0&&n.some(function(e){return i.indexOf(e)===-1})?((0,c.warn)('at least one of required properties "'+n.join('", "')+'" is not present'),!1):i.every(function(n){if(t.indexOf(n)===-1)return o.isLoose===!0||((0,c.warn)('object is missing "'+n+'" property'),!1);var u=e[n];return(0,c.validateType)(u,r[n])})}});return Object.defineProperty(r,"loose",{get:function(){var e=(0,a.default)({isLoose:!0},this);return(0,c.withRequired)(e),(0,c.withDefault)(e),e},enumerable:!1}),r}};t.default=f,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(1),a=r(i),c=Object.prototype,f=c.toString,l=t.hasOwn=c.hasOwnProperty,p=/^\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(p);return n&&n[1]},s=t.getNativeType=function(e){if(null===e||void 0===e)return null;var t=e.constructor.toString().match(p);return t&&t[1]},d=t.noop=function(){},b=(t.has=function(e,t){return l.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 l.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.validator&&v(e.validator)&&(e.validator=e.validator.bind(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}),l.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?l.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,n){e.exports=n(2)}])});
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