Socket
Socket
Sign inDemoInstall

@effect/data

Package Overview
Dependencies
Maintainers
3
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@effect/data - npm Package Compare versions

Comparing version 0.17.3 to 0.17.4

39

internal/Context.js

@@ -40,2 +40,6 @@ "use strict";

this[_a] = _Effect.effectVariance;
const limit = Error.stackTraceLimit;
Error.stackTraceLimit = 3;
this.creationError = new Error();
Error.stackTraceLimit = limit;
if (typeof identifier !== "undefined") {

@@ -46,2 +50,5 @@ this.i0 = identifier;

}
get stack() {
return this.creationError.stack;
}
toString() {

@@ -53,3 +60,4 @@ return JSON.stringify(this);

_tag: "Tag",
identifier: this.i0
identifier: this.i0,
stack: this.stack
};

@@ -103,4 +111,18 @@ }

const serviceNotFoundError = tag => {
const impl = tag;
return new Error(`Service not found${impl.i0 ? `: ${impl.i0}` : ""}`);
const error = new Error(`Service not found${tag.i0 ? `: ${tag.i0}` : ""}`);
if (tag.stack) {
const lines = tag.stack.split("\n");
if (lines.length > 2) {
const afterAt = lines[3].match(/at (.*)/);
if (afterAt) {
error.message = error.message + ` (defined at ${afterAt[1]})`;
}
}
}
if (error.stack) {
const lines = error.stack.split("\n");
lines.splice(1, 3);
error.stack = lines.join("\n");
}
return error;
};

@@ -127,10 +149,2 @@ /** @internal */

exports.add = add;
const get = /*#__PURE__*/(0, _Function.dual)(2, (self, tag) => {
if (!self.unsafeMap.has(tag)) {
throw serviceNotFoundError(tag);
}
return self.unsafeMap.get(tag);
});
/** @internal */
exports.get = get;
const unsafeGet = /*#__PURE__*/(0, _Function.dual)(2, (self, tag) => {

@@ -144,2 +158,5 @@ if (!self.unsafeMap.has(tag)) {

exports.unsafeGet = unsafeGet;
const get = unsafeGet;
/** @internal */
exports.get = get;
const getOption = /*#__PURE__*/(0, _Function.dual)(2, (self, tag) => {

@@ -146,0 +163,0 @@ if (!self.unsafeMap.has(tag)) {

{
"name": "@effect/data",
"version": "0.17.3",
"version": "0.17.4",
"description": "Functional programming in TypeScript",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -19,3 +19,4 @@ import type * as C from "@effect/data/Context"

public i1 = undefined
public i2 = undefined;
public i2 = undefined
private creationError: Error;
[EffectTypeId] = effectVariance;

@@ -35,2 +36,6 @@ [Equal.symbol](this: {}, that: unknown) {

constructor(identifier?: unknown) {
const limit = Error.stackTraceLimit
Error.stackTraceLimit = 3
this.creationError = new Error()
Error.stackTraceLimit = limit
if (typeof identifier !== "undefined") {

@@ -41,2 +46,5 @@ this.i0 = identifier

}
get stack() {
return this.creationError.stack
}
toString() {

@@ -48,3 +56,4 @@ return JSON.stringify(this)

_tag: "Tag",
identifier: this.i0
identifier: this.i0,
stack: this.stack
}

@@ -99,5 +108,19 @@ }

const serviceNotFoundError = (tag: C.Tag<any, any>) => {
const impl = tag as TagImpl<any, any>
return new Error(`Service not found${impl.i0 ? `: ${impl.i0}` : ""}`)
const serviceNotFoundError = (tag: TagImpl<any, any>) => {
const error = new Error(`Service not found${tag.i0 ? `: ${tag.i0}` : ""}`)
if (tag.stack) {
const lines = tag.stack.split("\n")
if (lines.length > 2) {
const afterAt = lines[3].match(/at (.*)/)
if (afterAt) {
error.message = error.message + ` (defined at ${afterAt[1]})`
}
}
}
if (error.stack) {
const lines = error.stack.split("\n")
lines.splice(1, 3)
error.stack = lines.join("\n")
}
return error
}

@@ -141,13 +164,2 @@

/** @internal */
export const get = dual<
<Services, T extends C.ValidTagsById<Services>>(tag: T) => (self: C.Context<Services>) => C.Tag.Service<T>,
<Services, T extends C.ValidTagsById<Services>>(self: C.Context<Services>, tag: T) => C.Tag.Service<T>
>(2, (self, tag) => {
if (!self.unsafeMap.has(tag)) {
throw serviceNotFoundError(tag)
}
return self.unsafeMap.get(tag)! as any
})
/** @internal */
export const unsafeGet = dual<

@@ -158,3 +170,3 @@ <S, I>(tag: C.Tag<I, S>) => <Services>(self: C.Context<Services>) => S,

if (!self.unsafeMap.has(tag)) {
throw serviceNotFoundError(tag)
throw serviceNotFoundError(tag as any)
}

@@ -165,2 +177,8 @@ return self.unsafeMap.get(tag)! as any

/** @internal */
export const get: {
<Services, T extends C.ValidTagsById<Services>>(tag: T): (self: C.Context<Services>) => C.Tag.Service<T>
<Services, T extends C.ValidTagsById<Services>>(self: C.Context<Services>, tag: T): C.Tag.Service<T>
} = unsafeGet
/** @internal */
export const getOption = dual<

@@ -167,0 +185,0 @@ <S, I>(tag: C.Tag<I, S>) => <Services>(self: C.Context<Services>) => O.Option<S>,

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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