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

vue-async-computed

Package Overview
Dependencies
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-async-computed - npm Package Compare versions

Comparing version 3.6.0 to 3.6.1

4

CHANGELOG.md

@@ -5,2 +5,3 @@ <!-- START doctoc generated TOC please keep comment here to allow auto update -->

- [v3.6.1](#v361)
- [v3.6.0](#v360)

@@ -29,2 +30,5 @@ - [v3.5.2](#v352)

### v3.6.1
* Fix for browsers that don't support `Symbol.iterator`.
### v3.6.0

@@ -31,0 +35,0 @@ * Fix bug in handling the argument to the generated `data` function.

14

dist/vue-async-computed.esm.esnext.js

@@ -38,3 +38,3 @@ function isComputedLazy (item) {

function getter () {
for (const key of computedAsyncProperty.watch) {
computedAsyncProperty.watch.forEach(key => {
// Check if nested key is watched.

@@ -45,3 +45,3 @@ const splittedByDot = key.split('.');

// eslint-disable-next-line no-unused-expressions
void this[key];
this[key];
} else {

@@ -51,5 +51,5 @@ // Access the nested propety.

let start = this;
for (const part of splittedByDot) {
splittedByDot.forEach(part => {
start = start[part];
}
});
} catch (error) {

@@ -60,3 +60,3 @@ console.error('AsyncComputed: bad path: ', key);

}
}
});
return computedAsyncProperty.get.call(this)

@@ -75,7 +75,7 @@ };

} else if (Array.isArray(computedAsyncProperty.watch)) {
for (const key of computedAsyncProperty.watch) {
computedAsyncProperty.watch.forEach(key => {
if (typeof key !== 'string') {
throw new Error('AsyncComputed: watch elemnts must be strings')
}
}
});
return getGetterWatchedByArray(computedAsyncProperty)

@@ -82,0 +82,0 @@ } else {

@@ -38,65 +38,24 @@ function isComputedLazy(item) {

return function getter() {
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
var _this = this;
try {
for (var _iterator = computedAsyncProperty.watch[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var key = _step.value;
// Check if nested key is watched.
var splittedByDot = key.split('.');
if (splittedByDot.length === 1) {
// If not, just access it.
// eslint-disable-next-line no-unused-expressions
void this[key];
} else {
// Access the nested propety.
try {
var start = this;
var _iteratorNormalCompletion2 = true;
var _didIteratorError2 = false;
var _iteratorError2 = undefined;
try {
for (var _iterator2 = splittedByDot[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
var part = _step2.value;
start = start[part];
}
} catch (err) {
_didIteratorError2 = true;
_iteratorError2 = err;
} finally {
try {
if (!_iteratorNormalCompletion2 && _iterator2.return) {
_iterator2.return();
}
} finally {
if (_didIteratorError2) {
throw _iteratorError2;
}
}
}
} catch (error) {
console.error('AsyncComputed: bad path: ', key);
throw error;
}
computedAsyncProperty.watch.forEach(function (key) {
// Check if nested key is watched.
var splittedByDot = key.split('.');
if (splittedByDot.length === 1) {
// If not, just access it.
// eslint-disable-next-line no-unused-expressions
_this[key];
} else {
// Access the nested propety.
try {
var start = _this;
splittedByDot.forEach(function (part) {
start = start[part];
});
} catch (error) {
console.error('AsyncComputed: bad path: ', key);
throw error;
}
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
});
return computedAsyncProperty.get.call(this);

@@ -117,29 +76,7 @@ };

} else if (Array.isArray(computedAsyncProperty.watch)) {
var _iteratorNormalCompletion3 = true;
var _didIteratorError3 = false;
var _iteratorError3 = undefined;
try {
for (var _iterator3 = computedAsyncProperty.watch[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
var key = _step3.value;
if (typeof key !== 'string') {
throw new Error('AsyncComputed: watch elemnts must be strings');
}
computedAsyncProperty.watch.forEach(function (key) {
if (typeof key !== 'string') {
throw new Error('AsyncComputed: watch elemnts must be strings');
}
} catch (err) {
_didIteratorError3 = true;
_iteratorError3 = err;
} finally {
try {
if (!_iteratorNormalCompletion3 && _iterator3.return) {
_iterator3.return();
}
} finally {
if (_didIteratorError3) {
throw _iteratorError3;
}
}
}
});
return getGetterWatchedByArray(computedAsyncProperty);

@@ -167,3 +104,3 @@ } else {

beforeCreate: function beforeCreate() {
var _this = this;
var _this2 = this;

@@ -176,3 +113,3 @@ var optionData = this.$options.data;

this.$options.computed.$asyncComputed = function () {
return _this.$data._asyncComputed;
return _this2.$data._asyncComputed;
};

@@ -202,3 +139,3 @@

created: function created() {
var _this2 = this;
var _this3 = this;

@@ -227,13 +164,13 @@ for (var key in this.$options.asyncComputed || {}) {

}
setAsyncState(_this2, _key2, 'updating');
setAsyncState(_this3, _key2, 'updating');
newPromise.then(function (value) {
if (thisPromise !== promiseId) return;
setAsyncState(_this2, _key2, 'success');
_this2[_key2] = value;
setAsyncState(_this3, _key2, 'success');
_this3[_key2] = value;
}).catch(function (err) {
if (thisPromise !== promiseId) return;
setAsyncState(_this2, _key2, 'error');
Vue.set(_this2.$data._asyncComputed[_key2], 'exception', err);
setAsyncState(_this3, _key2, 'error');
Vue.set(_this3.$data._asyncComputed[_key2], 'exception', err);
if (pluginOptions.errorHandler === false) return;

@@ -250,10 +187,10 @@

};
Vue.set(_this2.$data._asyncComputed, _key2, {
Vue.set(_this3.$data._asyncComputed, _key2, {
exception: null,
update: function update() {
watcher(getterOnly(_this2.$options.asyncComputed[_key2]).apply(_this2));
watcher(getterOnly(_this3.$options.asyncComputed[_key2]).apply(_this3));
}
});
setAsyncState(_this2, _key2, 'updating');
_this2.$watch(prefix + _key2, watcher, { immediate: true });
setAsyncState(_this3, _key2, 'updating');
_this3.$watch(prefix + _key2, watcher, { immediate: true });
};

@@ -260,0 +197,0 @@

@@ -44,3 +44,3 @@ (function (global, factory) {

function getter () {
for (const key of computedAsyncProperty.watch) {
computedAsyncProperty.watch.forEach(key => {
// Check if nested key is watched.

@@ -51,3 +51,3 @@ const splittedByDot = key.split('.');

// eslint-disable-next-line no-unused-expressions
void this[key];
this[key];
} else {

@@ -57,5 +57,5 @@ // Access the nested propety.

let start = this;
for (const part of splittedByDot) {
splittedByDot.forEach(part => {
start = start[part];
}
});
} catch (error) {

@@ -66,3 +66,3 @@ console.error('AsyncComputed: bad path: ', key);

}
}
});
return computedAsyncProperty.get.call(this)

@@ -81,7 +81,7 @@ };

} else if (Array.isArray(computedAsyncProperty.watch)) {
for (const key of computedAsyncProperty.watch) {
computedAsyncProperty.watch.forEach(key => {
if (typeof key !== 'string') {
throw new Error('AsyncComputed: watch elemnts must be strings')
}
}
});
return getGetterWatchedByArray(computedAsyncProperty)

@@ -88,0 +88,0 @@ } else {

@@ -45,65 +45,24 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

return function getter() {
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
var _this = this;
try {
for (var _iterator = computedAsyncProperty.watch[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var key = _step.value;
// Check if nested key is watched.
var splittedByDot = key.split('.');
if (splittedByDot.length === 1) {
// If not, just access it.
// eslint-disable-next-line no-unused-expressions
void this[key];
} else {
// Access the nested propety.
try {
var start = this;
var _iteratorNormalCompletion2 = true;
var _didIteratorError2 = false;
var _iteratorError2 = undefined;
try {
for (var _iterator2 = splittedByDot[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
var part = _step2.value;
start = start[part];
}
} catch (err) {
_didIteratorError2 = true;
_iteratorError2 = err;
} finally {
try {
if (!_iteratorNormalCompletion2 && _iterator2.return) {
_iterator2.return();
}
} finally {
if (_didIteratorError2) {
throw _iteratorError2;
}
}
}
} catch (error) {
console.error('AsyncComputed: bad path: ', key);
throw error;
}
computedAsyncProperty.watch.forEach(function (key) {
// Check if nested key is watched.
var splittedByDot = key.split('.');
if (splittedByDot.length === 1) {
// If not, just access it.
// eslint-disable-next-line no-unused-expressions
_this[key];
} else {
// Access the nested propety.
try {
var start = _this;
splittedByDot.forEach(function (part) {
start = start[part];
});
} catch (error) {
console.error('AsyncComputed: bad path: ', key);
throw error;
}
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
});
return computedAsyncProperty.get.call(this);

@@ -124,29 +83,7 @@ };

} else if (Array.isArray(computedAsyncProperty.watch)) {
var _iteratorNormalCompletion3 = true;
var _didIteratorError3 = false;
var _iteratorError3 = undefined;
try {
for (var _iterator3 = computedAsyncProperty.watch[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
var key = _step3.value;
if (typeof key !== 'string') {
throw new Error('AsyncComputed: watch elemnts must be strings');
}
computedAsyncProperty.watch.forEach(function (key) {
if (typeof key !== 'string') {
throw new Error('AsyncComputed: watch elemnts must be strings');
}
} catch (err) {
_didIteratorError3 = true;
_iteratorError3 = err;
} finally {
try {
if (!_iteratorNormalCompletion3 && _iterator3.return) {
_iterator3.return();
}
} finally {
if (_didIteratorError3) {
throw _iteratorError3;
}
}
}
});
return getGetterWatchedByArray(computedAsyncProperty);

@@ -174,3 +111,3 @@ } else {

beforeCreate: function beforeCreate() {
var _this = this;
var _this2 = this;

@@ -183,3 +120,3 @@ var optionData = this.$options.data;

this.$options.computed.$asyncComputed = function () {
return _this.$data._asyncComputed;
return _this2.$data._asyncComputed;
};

@@ -209,3 +146,3 @@

created: function created() {
var _this2 = this;
var _this3 = this;

@@ -234,13 +171,13 @@ for (var key in this.$options.asyncComputed || {}) {

}
setAsyncState(_this2, _key2, 'updating');
setAsyncState(_this3, _key2, 'updating');
newPromise.then(function (value) {
if (thisPromise !== promiseId) return;
setAsyncState(_this2, _key2, 'success');
_this2[_key2] = value;
setAsyncState(_this3, _key2, 'success');
_this3[_key2] = value;
}).catch(function (err) {
if (thisPromise !== promiseId) return;
setAsyncState(_this2, _key2, 'error');
Vue.set(_this2.$data._asyncComputed[_key2], 'exception', err);
setAsyncState(_this3, _key2, 'error');
Vue.set(_this3.$data._asyncComputed[_key2], 'exception', err);
if (pluginOptions.errorHandler === false) return;

@@ -257,10 +194,10 @@

};
Vue.set(_this2.$data._asyncComputed, _key2, {
Vue.set(_this3.$data._asyncComputed, _key2, {
exception: null,
update: function update() {
watcher(getterOnly(_this2.$options.asyncComputed[_key2]).apply(_this2));
watcher(getterOnly(_this3.$options.asyncComputed[_key2]).apply(_this3));
}
});
setAsyncState(_this2, _key2, 'updating');
_this2.$watch(prefix + _key2, watcher, { immediate: true });
setAsyncState(_this3, _key2, 'updating');
_this3.$watch(prefix + _key2, watcher, { immediate: true });
};

@@ -267,0 +204,0 @@

{
"name": "vue-async-computed",
"version": "3.6.0",
"version": "3.6.1",
"description": "Async computed properties for Vue",

@@ -5,0 +5,0 @@ "main": "dist/vue-async-computed.js",

@@ -105,3 +105,3 @@ <big><h1 align="center">vue-async-computed</h1></big>

-->
<script src="https://unpkg.com/vue-async-computed@3.6.0"></script>
<script src="https://unpkg.com/vue-async-computed@3.6.1"></script>
```

@@ -108,0 +108,0 @@

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