vue-functions
Advanced tools
Comparing version 1.0.5 to 1.0.6
/*! | ||
* vue-functions v1.0.5 | ||
* (c) phphe <phphe@outlook.com> (https://github.com/phphe) | ||
* Released under the MIT License. | ||
*/ | ||
* vue-functions v1.0.6 | ||
* (c) phphe <phphe@outlook.com> (https://github.com/phphe) | ||
* Released under the MIT License. | ||
*/ | ||
'use strict'; | ||
@@ -10,4 +10,46 @@ | ||
var hp = require('helper-js'); | ||
function isArray(v) { | ||
return Object.prototype.toString.call(v) === '[object Array]'; | ||
} | ||
function isFunction(v) { | ||
return typeof v === 'function'; | ||
} | ||
function isPromise(v) { | ||
return Object.prototype.toString.call(v) === '[object Promise]'; | ||
} | ||
function onDOM(el, name, handler) { | ||
for (var _len6 = arguments.length, args = new Array(_len6 > 3 ? _len6 - 3 : 0), _key8 = 3; _key8 < _len6; _key8++) { | ||
args[_key8 - 3] = arguments[_key8]; | ||
} | ||
if (el.addEventListener) { | ||
// 所有主流浏览器,除了 IE 8 及更早 IE版本 | ||
el.addEventListener.apply(el, [name, handler].concat(args)); | ||
} else if (el.attachEvent) { | ||
// IE 8 及更早 IE 版本 | ||
el.attachEvent.apply(el, ["on".concat(name), handler].concat(args)); | ||
} | ||
} | ||
function offDOM(el, name, handler) { | ||
for (var _len7 = arguments.length, args = new Array(_len7 > 3 ? _len7 - 3 : 0), _key9 = 3; _key9 < _len7; _key9++) { | ||
args[_key9 - 3] = arguments[_key9]; | ||
} | ||
if (el.removeEventListener) { | ||
// 所有主流浏览器,除了 IE 8 及更早 IE版本 | ||
el.removeEventListener.apply(el, [name, handler].concat(args)); | ||
} else if (el.detachEvent) { | ||
// IE 8 及更早 IE 版本 | ||
el.detachEvent.apply(el, ["on".concat(name), handler].concat(args)); | ||
} | ||
} | ||
var _marked = | ||
/*#__PURE__*/ | ||
regeneratorRuntime.mark(iterateObjectWithoutDollarDash); | ||
/** | ||
@@ -24,5 +66,5 @@ * [updatablePropsEvenUnbound description] | ||
function updatablePropsEvenUnbound(props) { | ||
if (hp.isFunction(props)) { | ||
if (isFunction(props)) { | ||
props = props(); | ||
} else if (hp.isArray(props)) { | ||
} else if (isArray(props)) { | ||
props = props.slice(); | ||
@@ -42,3 +84,3 @@ } else { | ||
if (hp.isArray(props)) { | ||
if (isArray(props)) { | ||
propNames = props; | ||
@@ -201,3 +243,3 @@ } else { | ||
if (hp.isPromise(result)) { | ||
if (isPromise(result)) { | ||
result.then(getterExecuted); | ||
@@ -227,13 +269,40 @@ } else { | ||
} | ||
function* iterateObjectWithoutDollarDash(obj) { | ||
for (var key in obj) { | ||
var start = key.substr(0, 1); | ||
function iterateObjectWithoutDollarDash(obj) { | ||
var key, start; | ||
return regeneratorRuntime.wrap(function iterateObjectWithoutDollarDash$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
_context.t0 = regeneratorRuntime.keys(obj); | ||
if (start !== '$' && start !== '_') { | ||
yield { | ||
key: key, | ||
value: obj[key] | ||
}; | ||
case 1: | ||
if ((_context.t1 = _context.t0()).done) { | ||
_context.next = 9; | ||
break; | ||
} | ||
key = _context.t1.value; | ||
start = key.substr(0, 1); | ||
if (!(start !== '$' && start !== '_')) { | ||
_context.next = 7; | ||
break; | ||
} | ||
_context.next = 7; | ||
return { | ||
key: key, | ||
value: obj[key] | ||
}; | ||
case 7: | ||
_context.next = 1; | ||
break; | ||
case 9: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
} | ||
} | ||
}, _marked); | ||
} // add reactive `windowSize` | ||
@@ -271,6 +340,6 @@ | ||
hp.onDOM(window, 'resize', this._windowSize_onresize); | ||
onDOM(window, 'resize', this._windowSize_onresize); | ||
}, | ||
beforeDestroy: function beforeDestroy() { | ||
hp.offDOM(window, 'resize', this._windowSize_onresize); | ||
offDOM(window, 'resize', this._windowSize_onresize); | ||
} | ||
@@ -277,0 +346,0 @@ }; |
/*! | ||
* vue-functions v1.0.5 | ||
* (c) phphe <phphe@outlook.com> (https://github.com/phphe) | ||
* Released under the MIT License. | ||
*/ | ||
import { isFunction, isArray, isPromise, onDOM, offDOM } from 'helper-js'; | ||
* vue-functions v1.0.6 | ||
* (c) phphe <phphe@outlook.com> (https://github.com/phphe) | ||
* Released under the MIT License. | ||
*/ | ||
function isArray(v) { | ||
return Object.prototype.toString.call(v) === '[object Array]'; | ||
} | ||
function isFunction(v) { | ||
return typeof v === 'function'; | ||
} | ||
function isPromise(v) { | ||
return Object.prototype.toString.call(v) === '[object Promise]'; | ||
} | ||
function onDOM(el, name, handler) { | ||
for (var _len6 = arguments.length, args = new Array(_len6 > 3 ? _len6 - 3 : 0), _key8 = 3; _key8 < _len6; _key8++) { | ||
args[_key8 - 3] = arguments[_key8]; | ||
} | ||
if (el.addEventListener) { | ||
// 所有主流浏览器,除了 IE 8 及更早 IE版本 | ||
el.addEventListener.apply(el, [name, handler].concat(args)); | ||
} else if (el.attachEvent) { | ||
// IE 8 及更早 IE 版本 | ||
el.attachEvent.apply(el, ["on".concat(name), handler].concat(args)); | ||
} | ||
} | ||
function offDOM(el, name, handler) { | ||
for (var _len7 = arguments.length, args = new Array(_len7 > 3 ? _len7 - 3 : 0), _key9 = 3; _key9 < _len7; _key9++) { | ||
args[_key9 - 3] = arguments[_key9]; | ||
} | ||
if (el.removeEventListener) { | ||
// 所有主流浏览器,除了 IE 8 及更早 IE版本 | ||
el.removeEventListener.apply(el, [name, handler].concat(args)); | ||
} else if (el.detachEvent) { | ||
// IE 8 及更早 IE 版本 | ||
el.detachEvent.apply(el, ["on".concat(name), handler].concat(args)); | ||
} | ||
} | ||
var _marked = | ||
/*#__PURE__*/ | ||
regeneratorRuntime.mark(iterateObjectWithoutDollarDash); | ||
/** | ||
@@ -219,13 +261,40 @@ * [updatablePropsEvenUnbound description] | ||
} | ||
function* iterateObjectWithoutDollarDash(obj) { | ||
for (var key in obj) { | ||
var start = key.substr(0, 1); | ||
function iterateObjectWithoutDollarDash(obj) { | ||
var key, start; | ||
return regeneratorRuntime.wrap(function iterateObjectWithoutDollarDash$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
_context.t0 = regeneratorRuntime.keys(obj); | ||
if (start !== '$' && start !== '_') { | ||
yield { | ||
key: key, | ||
value: obj[key] | ||
}; | ||
case 1: | ||
if ((_context.t1 = _context.t0()).done) { | ||
_context.next = 9; | ||
break; | ||
} | ||
key = _context.t1.value; | ||
start = key.substr(0, 1); | ||
if (!(start !== '$' && start !== '_')) { | ||
_context.next = 7; | ||
break; | ||
} | ||
_context.next = 7; | ||
return { | ||
key: key, | ||
value: obj[key] | ||
}; | ||
case 7: | ||
_context.next = 1; | ||
break; | ||
case 9: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
} | ||
} | ||
}, _marked); | ||
} // add reactive `windowSize` | ||
@@ -232,0 +301,0 @@ |
/*! | ||
* vue-functions v1.0.5 | ||
* (c) phphe <phphe@outlook.com> (https://github.com/phphe) | ||
* Released under the MIT License. | ||
*/ | ||
* vue-functions v1.0.6 | ||
* (c) phphe <phphe@outlook.com> (https://github.com/phphe) | ||
* Released under the MIT License. | ||
*/ | ||
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
typeof define === 'function' && define.amd ? define(['exports'], factory) : | ||
(global = global || self, factory(global['vue-functions'] = {})); | ||
}(this, function (exports) { 'use strict'; | ||
(global = global || self, factory(global.vueFunctions = {})); | ||
}(this, (function (exports) { 'use strict'; | ||
/*! | ||
* helper-js v1.4.5 | ||
* (c) phphe <phphe@outlook.com> (https://github.com/phphe) | ||
* Released under the MIT License. | ||
*/ | ||
function isArray(v) { | ||
return Object.prototype.toString.call(v) === '[object Array]'; | ||
} | ||
function isFunction(v) { | ||
return typeof v === 'function'; | ||
} | ||
function isPromise(v) { | ||
@@ -27,5 +24,6 @@ return Object.prototype.toString.call(v) === '[object Promise]'; | ||
function onDOM(el, name, handler) { | ||
for (var _len5 = arguments.length, args = new Array(_len5 > 3 ? _len5 - 3 : 0), _key6 = 3; _key6 < _len5; _key6++) { | ||
args[_key6 - 3] = arguments[_key6]; | ||
for (var _len6 = arguments.length, args = new Array(_len6 > 3 ? _len6 - 3 : 0), _key8 = 3; _key8 < _len6; _key8++) { | ||
args[_key8 - 3] = arguments[_key8]; | ||
} | ||
@@ -41,5 +39,6 @@ | ||
} | ||
function offDOM(el, name, handler) { | ||
for (var _len6 = arguments.length, args = new Array(_len6 > 3 ? _len6 - 3 : 0), _key7 = 3; _key7 < _len6; _key7++) { | ||
args[_key7 - 3] = arguments[_key7]; | ||
for (var _len7 = arguments.length, args = new Array(_len7 > 3 ? _len7 - 3 : 0), _key9 = 3; _key9 < _len7; _key9++) { | ||
args[_key9 - 3] = arguments[_key9]; | ||
} | ||
@@ -56,2 +55,5 @@ | ||
var _marked = | ||
/*#__PURE__*/ | ||
regeneratorRuntime.mark(iterateObjectWithoutDollarDash); | ||
/** | ||
@@ -268,13 +270,40 @@ * [updatablePropsEvenUnbound description] | ||
} | ||
function* iterateObjectWithoutDollarDash(obj) { | ||
for (var key in obj) { | ||
var start = key.substr(0, 1); | ||
function iterateObjectWithoutDollarDash(obj) { | ||
var key, start; | ||
return regeneratorRuntime.wrap(function iterateObjectWithoutDollarDash$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
_context.t0 = regeneratorRuntime.keys(obj); | ||
if (start !== '$' && start !== '_') { | ||
yield { | ||
key: key, | ||
value: obj[key] | ||
}; | ||
case 1: | ||
if ((_context.t1 = _context.t0()).done) { | ||
_context.next = 9; | ||
break; | ||
} | ||
key = _context.t1.value; | ||
start = key.substr(0, 1); | ||
if (!(start !== '$' && start !== '_')) { | ||
_context.next = 7; | ||
break; | ||
} | ||
_context.next = 7; | ||
return { | ||
key: key, | ||
value: obj[key] | ||
}; | ||
case 7: | ||
_context.next = 1; | ||
break; | ||
case 9: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
} | ||
} | ||
}, _marked); | ||
} // add reactive `windowSize` | ||
@@ -368,2 +397,2 @@ | ||
})); | ||
}))); |
/*! | ||
* vue-functions v1.0.5 | ||
* (c) phphe <phphe@outlook.com> (https://github.com/phphe) | ||
* Released under the MIT License. | ||
*/ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self)["vue-functions"]={})}(this,function(e){"use strict";function t(e){return"[object Array]"===Object.prototype.toString.call(e)}var n={data:function(){return{windowSize:{innerWidth:window.innerWidth,innerHeight:window.innerHeight,outerWidth:window.outerWidth,outerHeight:window.outerHeight}}},methods:{updateWindowSize:function(){Object.assign(this.windowSize,{innerWidth:window.innerWidth,innerHeight:window.innerHeight,outerWidth:window.outerWidth,outerHeight:window.outerHeight})}},created:function(){var e=this;this._windowSize_onresize=function(){e.updateWindowSize(),e.$emit("window-resize")},function(e,t,n){for(var o=arguments.length,i=new Array(o>3?o-3:0),r=3;r<o;r++)i[r-3]=arguments[r];e.addEventListener?e.addEventListener.apply(e,[t,n].concat(i)):e.attachEvent&&e.attachEvent.apply(e,["on".concat(t),n].concat(i))}(window,"resize",this._windowSize_onresize)},beforeDestroy:function(){!function(e,t,n){for(var o=arguments.length,i=new Array(o>3?o-3:0),r=3;r<o;r++)i[r-3]=arguments[r];e.removeEventListener?e.removeEventListener.apply(e,[t,n].concat(i)):e.detachEvent&&e.detachEvent.apply(e,["on".concat(t),n].concat(i))}(window,"resize",this._windowSize_onresize)}};e.doWatch=function(e,t){var n,o;return function i(){var r=t.call(e,n);o=e.$watch(r,function(e){o(),n=e,i()})}(),function(){return o&&o()}},e.isPropTrue=function(e){return""===e||e},e.iterateObjectWithoutDollarDash=function*(e){for(var t in e){var n=t.substr(0,1);"$"!==n&&"_"!==n&&(yield{key:t,value:e[t]})}},e.registerPreventURLChange=function(e,t,n){var o=!1,i="It looks like you have been editing something.\nIf you leave before saving, your changes will be lost.";t.beforeEach(function(t,r,a){o?window.confirm(n||i)?(e.allowURLChange(),a()):a(!1):a()});var r=function(e){var t=n||i;return e.returnValue=t,t};e.preventURLChange=e.prototype.$preventURLChange=function(e){null!=e&&(n=e),o||(o=!0,window.addEventListener("beforeunload",r))},e.allowURLChange=e.prototype.$allowURLChange=function(){o=!1,window.removeEventListener("beforeunload",r)}},e.updatablePropsEvenUnbound=function(e){var n,o={props:e="function"==typeof e?e():t(e)?e.slice():Object.assign({},e),computed:{},watch:{}},i={};if(t(e))n=e;else for(var r in n=[],e)n.push(r),e[r].localName&&(i[r]=e[r].localName,delete e[r].localName);o.data=function(){var e={localValueOfUpdatableProps:{}},t=!0,o=!1,i=void 0;try{for(var r,a=n[Symbol.iterator]();!(t=(r=a.next()).done);t=!0){var c=r.value;e.localValueOfUpdatableProps[c]=this[c]}}catch(e){o=!0,i=e}finally{try{t||null==a.return||a.return()}finally{if(o)throw i}}return e};var a=!0,c=!1,u=void 0;try{for(var l,d=function(){var e=l.value;o.watch[e]=function(t){this.localValueOfUpdatableProps[e]=t};var t=i[e]||"localProps_".concat(e);o.computed[t]={get:function(){return this.localValueOfUpdatableProps[e]},set:function(t){"value"===e?this.$emit("input",t):this.$emit("update:".concat(e),t),this.localValueOfUpdatableProps[e]=t}}},f=n[Symbol.iterator]();!(a=(l=f.next()).done);a=!0)d()}catch(e){c=!0,u=e}finally{try{a||null==f.return||f.return()}finally{if(c)throw u}}return o},e.watchAsync=function(e,t,n,o){var i,r,a=[],c=-1;return d(),u;function u(){a.forEach(function(e){return e()}),a=[]}function l(t,n){var o,i=!0,r=e.$watch(function(){return t.call(e,l)},function(e){o=e,i?i=!1:d()},{immediate:!0,deep:n&&n.deep});return a.push(r),o}function d(){u();var a=t.call(e,l),d=++c;r=i;var f,s=function(t){d===c&&(0===d?o&&o.immediate&&n.call(e,t,r):n.call(e,t,r))};f=a,"[object Promise]"===Object.prototype.toString.call(f)?a.then(s):s(a)}},e.windowSize=n,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
* vue-functions v1.0.6 | ||
* (c) phphe <phphe@outlook.com> (https://github.com/phphe) | ||
* Released under the MIT License. | ||
*/ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).vueFunctions={})}(this,(function(e){"use strict";function t(e){return"[object Array]"===Object.prototype.toString.call(e)}var n=regeneratorRuntime.mark(o);function o(e){var t,o;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:n.t0=regeneratorRuntime.keys(e);case 1:if((n.t1=n.t0()).done){n.next=9;break}if(t=n.t1.value,"$"===(o=t.substr(0,1))||"_"===o){n.next=7;break}return n.next=7,{key:t,value:e[t]};case 7:n.next=1;break;case 9:case"end":return n.stop()}}),n)}var r={data:function(){return{windowSize:{innerWidth:window.innerWidth,innerHeight:window.innerHeight,outerWidth:window.outerWidth,outerHeight:window.outerHeight}}},methods:{updateWindowSize:function(){Object.assign(this.windowSize,{innerWidth:window.innerWidth,innerHeight:window.innerHeight,outerWidth:window.outerWidth,outerHeight:window.outerHeight})}},created:function(){var e=this;this._windowSize_onresize=function(){e.updateWindowSize(),e.$emit("window-resize")},function(e,t,n){for(var o=arguments.length,r=new Array(o>3?o-3:0),i=3;i<o;i++)r[i-3]=arguments[i];e.addEventListener?e.addEventListener.apply(e,[t,n].concat(r)):e.attachEvent&&e.attachEvent.apply(e,["on".concat(t),n].concat(r))}(window,"resize",this._windowSize_onresize)},beforeDestroy:function(){!function(e,t,n){for(var o=arguments.length,r=new Array(o>3?o-3:0),i=3;i<o;i++)r[i-3]=arguments[i];e.removeEventListener?e.removeEventListener.apply(e,[t,n].concat(r)):e.detachEvent&&e.detachEvent.apply(e,["on".concat(t),n].concat(r))}(window,"resize",this._windowSize_onresize)}};e.doWatch=function(e,t){var n,o;return function r(){var i=t.call(e,n);o=e.$watch(i,(function(e){o(),n=e,r()}))}(),function(){return o&&o()}},e.isPropTrue=function(e){return""===e||e},e.iterateObjectWithoutDollarDash=o,e.registerPreventURLChange=function(e,t,n){var o=!1,r="It looks like you have been editing something.\nIf you leave before saving, your changes will be lost.";t.beforeEach((function(t,i,a){o?window.confirm(n||r)?(e.allowURLChange(),a()):a(!1):a()}));var i=function(e){var t=n||r;return e.returnValue=t,t};e.preventURLChange=e.prototype.$preventURLChange=function(e){null!=e&&(n=e),o||(o=!0,window.addEventListener("beforeunload",i))},e.allowURLChange=e.prototype.$allowURLChange=function(){o=!1,window.removeEventListener("beforeunload",i)}},e.updatablePropsEvenUnbound=function(e){var n,o={props:e="function"==typeof e?e():t(e)?e.slice():Object.assign({},e),computed:{},watch:{}},r={};if(t(e))n=e;else for(var i in n=[],e)n.push(i),e[i].localName&&(r[i]=e[i].localName,delete e[i].localName);o.data=function(){var e={localValueOfUpdatableProps:{}},t=!0,o=!1,r=void 0;try{for(var i,a=n[Symbol.iterator]();!(t=(i=a.next()).done);t=!0){var c=i.value;e.localValueOfUpdatableProps[c]=this[c]}}catch(e){o=!0,r=e}finally{try{t||null==a.return||a.return()}finally{if(o)throw r}}return e};var a=!0,c=!1,u=void 0;try{for(var l,d=function(){var e=l.value;o.watch[e]=function(t){this.localValueOfUpdatableProps[e]=t};var t=r[e]||"localProps_".concat(e);o.computed[t]={get:function(){return this.localValueOfUpdatableProps[e]},set:function(t){"value"===e?this.$emit("input",t):this.$emit("update:".concat(e),t),this.localValueOfUpdatableProps[e]=t}}},f=n[Symbol.iterator]();!(a=(l=f.next()).done);a=!0)d()}catch(e){c=!0,u=e}finally{try{a||null==f.return||f.return()}finally{if(c)throw u}}return o},e.watchAsync=function(e,t,n,o){var r,i,a=[],c=-1;return d(),u;function u(){a.forEach((function(e){return e()})),a=[]}function l(t,n){var o,r=!0,i=e.$watch((function(){return t.call(e,l)}),(function(e){o=e,r?r=!1:d()}),{immediate:!0,deep:n&&n.deep});return a.push(i),o}function d(){u();var a=t.call(e,l),d=++c;i=r;var f,s=function(t){d===c&&(0===d?o&&o.immediate&&n.call(e,t,i):n.call(e,t,i))};f=a,"[object Promise]"===Object.prototype.toString.call(f)?a.then(s):s(a)}},e.windowSize=r,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=vue-functions.min.js.map |
{ | ||
"name": "vue-functions", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "", | ||
@@ -11,4 +11,5 @@ "main": "dist/vue-functions.cjs.js", | ||
"scripts": { | ||
"build": "bili --format cjs --format umd --format umd-min --format esm --banner", | ||
"dev": "bili --watch" | ||
"build": "node scripts/build.js", | ||
"dev": "node scripts/build.js --watch", | ||
"build-test": "rollup -c" | ||
}, | ||
@@ -25,14 +26,8 @@ "author": "phphe <phphe@outlook.com> (https://github.com/phphe)", | ||
"devDependencies": { | ||
"@babel/plugin-proposal-class-properties": "^7.5.5", | ||
"@babel/plugin-proposal-decorators": "^7.4.4", | ||
"@babel/plugin-proposal-export-namespace-from": "^7.5.2", | ||
"@babel/plugin-proposal-function-sent": "^7.5.0", | ||
"@babel/plugin-proposal-numeric-separator": "^7.2.0", | ||
"@babel/plugin-proposal-throw-expressions": "^7.2.0", | ||
"bili": "^4.8.1" | ||
"rollup-helper": "^2.0.1" | ||
}, | ||
"dependencies": { | ||
"helper-js": "^1.4.5" | ||
"helper-js": "^1.4.14" | ||
}, | ||
"license": "MIT" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
122286
1
1018
0
Updatedhelper-js@^1.4.14