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

@wry/context

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wry/context - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

2

lib/context.d.ts

@@ -5,3 +5,3 @@ /// <reference types="node" />

hasValue(): boolean;
getValue: () => TValue | undefined;
getValue(): TValue | undefined;
withValue<TResult, TArgs extends any[], TThis = any>(value: TValue, callback: (this: TThis, ...args: TArgs) => TResult, args?: TArgs, thisArg?: TThis): TResult;

@@ -8,0 +8,0 @@ }

@@ -6,17 +6,13 @@ var currentContext = null;

var idCounter = 1;
function makeUniqueId() {
return ["slot", idCounter++, Date.now(), Math.random().toString(36).slice(2)].join(":");
}
var Slot = /** @class */ (function () {
function Slot() {
var _this = this;
// If you have a Slot object, you can find out its slot.id by circumventing
// TypeScript's privacy restrictions, but you can't guess the slot.id of a
// Slot you don't have access to, thanks to the randomized suffix.
this.id = makeUniqueId();
this.getValue = function () {
if (_this.hasValue()) {
return currentContext.slots[_this.id];
}
};
this.id = [
"slot",
idCounter++,
Date.now(),
Math.random().toString(36).slice(2),
].join(":");
}

@@ -49,2 +45,7 @@ Slot.prototype.hasValue = function () {

};
Slot.prototype.getValue = function () {
if (this.hasValue()) {
return currentContext.slots[this.id];
}
};
Slot.prototype.withValue = function (value, callback,

@@ -51,0 +52,0 @@ // Given the prevalence of arrow functions, specifying arguments is likely

@@ -10,17 +10,13 @@ 'use strict';

var idCounter = 1;
function makeUniqueId() {
return ["slot", idCounter++, Date.now(), Math.random().toString(36).slice(2)].join(":");
}
var Slot = /** @class */ (function () {
function Slot() {
var _this = this;
// If you have a Slot object, you can find out its slot.id by circumventing
// TypeScript's privacy restrictions, but you can't guess the slot.id of a
// Slot you don't have access to, thanks to the randomized suffix.
this.id = makeUniqueId();
this.getValue = function () {
if (_this.hasValue()) {
return currentContext.slots[_this.id];
}
};
this.id = [
"slot",
idCounter++,
Date.now(),
Math.random().toString(36).slice(2),
].join(":");
}

@@ -53,2 +49,7 @@ Slot.prototype.hasValue = function () {

};
Slot.prototype.getValue = function () {
if (this.hasValue()) {
return currentContext.slots[this.id];
}
};
Slot.prototype.withValue = function (value, callback,

@@ -55,0 +56,0 @@ // Given the prevalence of arrow functions, specifying arguments is likely

{
"name": "@wry/context",
"version": "0.2.0",
"version": "0.2.1",
"author": "Ben Newman <ben@eloper.dev>",

@@ -31,3 +31,3 @@ "description": "Manage contextual information needed by (a)synchronous tasks without explicitly passing objects around",

},
"gitHead": "ac45fec8d46eedc1518265d9141266d352278fb1"
"gitHead": "df6235c13199ae5e212e58853126915a9ebf59c1"
}

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