Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@boost/decorators

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@boost/decorators - npm Package Compare versions

Comparing version 2.1.0 to 2.1.1

lib/browser/index.js

12

CHANGELOG.md

@@ -6,2 +6,14 @@ # Change Log

### 2.1.1 - 2021-02-08
#### 📦 Dependencies
- **[packemon]** Update to v0.11. ([20a54dc](https://github.com/milesj/boost/commit/20a54dc))
**Note:** Version bump only for package @boost/decorators
## 2.1.0 - 2021-01-16

@@ -8,0 +20,0 @@

58

esm/index.js
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
// Generated with Packemon: https://packemon.dev
// Platform: browser, Support: stable, Format: esm
function isMethod(target, property, descriptor) {

@@ -19,3 +21,4 @@ return Boolean(property && descriptor && typeof descriptor === 'object' && !('initializer' in descriptor) && ('value' in descriptor || 'get' in descriptor));

get: function get() {
var bound = func.bind(this);
var bound = func.bind(this); // Only cache the bound function when in the deepest sub-class,
// otherwise any `super` calls will overwrite each other.

@@ -42,7 +45,10 @@ if (target.constructor.name === this.constructor.name) {

}
}
} // We must use a map as all class instances would share the
// same timer value otherwise.
var timers = new WeakMap();
var func = descriptor.value;
var timers = new WeakMap(); // Overwrite the value function with a new debounced function
var func = descriptor.value; // @ts-expect-error
descriptor.value = function debounce() {

@@ -80,3 +86,5 @@ var _this = this;

}
/* eslint-disable no-console */
function Deprecate(message) {

@@ -86,16 +94,20 @@ return function (target, property, descriptor) {

var className = isProtoOrStatic ? target.name : target.constructor.name;
var accessSymbol = isProtoOrStatic ? "." + String(property) : "#" + String(property);
var accessSymbol = isProtoOrStatic ? "." + String(property) : "#" + String(property); // Class
if (isClass(target, property, descriptor)) {
console.debug(message || "Class `" + className + "` has been deprecated.");
console.debug(message || "Class `" + className + "` has been deprecated."); // Method
} else if (isMethod(target, property, descriptor)) {
console.debug(message || "Method `" + (className + accessSymbol) + "()` has been deprecated.");
console.debug(message || "Method `" + (className + accessSymbol) + "()` has been deprecated."); // Property
} else if (isProperty(target, property, descriptor)) {
console.debug(message || "Property `" + (className + accessSymbol) + "` has been deprecated.");
} else if (isParam(target, property, descriptor)) {
console.debug(message || "Parameter " + descriptor + " for `" + (className + accessSymbol) + "()` has been deprecated.");
console.debug(message || "Property `" + (className + accessSymbol) + "` has been deprecated."); // Param (Babel/Jest doesnt support them)
}
/* istanbul ignore next */
else if (isParam(target, property, descriptor)) {
console.debug(message || "Parameter " + descriptor + " for `" + (className + accessSymbol) + "()` has been deprecated.");
}
};
}
/* eslint-disable babel/no-invalid-this */
function hasher() {

@@ -110,3 +122,5 @@ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {

function createMemoizer(method, rootCache, options) {
// Must be a normal function as we require `this`
return function memoizer() {
// Extract the cache for this specific instance
var cache = rootCache.get(this);

@@ -117,4 +131,5 @@

rootCache.set(this, cache);
}
} // Hash the key and check the cache
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {

@@ -129,4 +144,5 @@ args[_key3] = arguments[_key3];

return item.value;
}
} // No cache so execute and cache the result
var value = method.apply(this, args);

@@ -137,3 +153,3 @@ var time = options.expires > 0 ? Date.now() + options.expires : null;

value: value
});
}); // Only cache if successful

@@ -157,2 +173,3 @@ if (value instanceof Promise) {

// eslint-disable-next-line complexity
return function (target, property, descriptor) {

@@ -185,9 +202,13 @@ if (process.env.NODE_ENV !== "production") {

}
}
} // We must use a map as all class instances would share the
// same cache otherwise. Probability of collision is high.
var rootCache = new WeakMap();
if (descriptor.get) {
// @ts-expect-error
descriptor.get = createMemoizer(descriptor.get, rootCache, config);
} else if (descriptor.value) {
// @ts-expect-error
descriptor.value = createMemoizer(descriptor.value, rootCache, config);

@@ -204,7 +225,10 @@ }

}
}
} // We must use a map as all class instances would share the
// same boolean value otherwise.
var throttling = new WeakMap();
var func = descriptor.value;
var throttling = new WeakMap(); // Overwrite the value function with a new throttled function
var func = descriptor.value; // @ts-expect-error
descriptor.value = function throttle() {

@@ -211,0 +235,0 @@ var _this2 = this;

{
"name": "@boost/decorators",
"version": "2.1.0",
"version": "2.1.1",
"description": "Experimental decorators for common patterns.",

@@ -9,7 +9,8 @@ "keywords": [

],
"main": "./lib/index.js",
"main": "./lib/node/index.js",
"module": "./esm/index.js",
"types": "./dts/index.d.ts",
"engines": {
"node": ">=10.3.0"
"node": ">=10.3.0",
"npm": ">=6.1.0"
},

@@ -36,3 +37,3 @@ "repository": {

},
"gitHead": "e2c452ee0c15aa7db91d1945e23ac6951028e672"
"gitHead": "3aa9bda270786e931a90e927375c33dddffed14d"
}

Sorry, the diff of this file is not supported yet

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