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.1.1 to 0.1.2

16

Data.d.ts

@@ -72,2 +72,18 @@ /**

}>(tag: A["_tag"]) => Case.Constructor<A, "_tag">;
/**
* Provides a Tagged constructor for a Case Class.
*
* @since 1.0.0
* @category constructors
*/
export declare const TaggedClass: <Key extends string>(tag: Key) => <A extends Record<string, any>>() => new (args: Omit<A, keyof Equal.Equal | "_tag">) => Readonly<A> & Equal.Equal & {
readonly _tag: Key;
};
/**
* Provides a constructor for a Case Class.
*
* @since 1.0.0
* @category constructors
*/
export declare const Class: <A extends Record<string, any>>() => new (args: Omit<A, keyof Equal.Equal>) => Data<A>;
//# sourceMappingURL=Data.d.ts.map

35

Data.js

@@ -6,3 +6,3 @@ "use strict";

});
exports.unsafeStruct = exports.unsafeArray = exports.tuple = exports.tagged = exports.struct = exports.case = exports.array = void 0;
exports.unsafeStruct = exports.unsafeArray = exports.tuple = exports.tagged = exports.struct = exports.case = exports.array = exports.TaggedClass = exports.Class = void 0;
var Equal = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/data/Equal"));

@@ -96,3 +96,36 @@ var Hash = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/data/Hash"));

});
/**
* Provides a Tagged constructor for a Case Class.
*
* @since 1.0.0
* @category constructors
*/
exports.tagged = tagged;
const TaggedClass = tag => () => {
class Base {
constructor(args) {
this._tag = tag;
Object.assign(this, args);
unsafeStruct(this);
}
}
return Base;
};
/**
* Provides a constructor for a Case Class.
*
* @since 1.0.0
* @category constructors
*/
exports.TaggedClass = TaggedClass;
const Class = () => {
class Base {
constructor(args) {
Object.assign(this, args);
unsafeStruct(this);
}
}
return Base;
};
exports.Class = Class;
//# sourceMappingURL=Data.js.map

2

package.json
{
"name": "@effect/data",
"version": "0.1.1",
"version": "0.1.2",
"license": "MIT",

@@ -5,0 +5,0 @@ "repository": {

@@ -128,1 +128,37 @@ /**

(args) => struct({ _tag: tag, ...args })
/**
* Provides a Tagged constructor for a Case Class.
*
* @since 1.0.0
* @category constructors
*/
export const TaggedClass = <Key extends string>(
tag: Key
) =>
<A extends Record<string, any>>() => {
class Base {
readonly _tag = tag
constructor(args: Omit<A, "_tag" | keyof Equal.Equal>) {
Object.assign(this, args)
unsafeStruct(this)
}
}
return Base as unknown as { new(args: Omit<A, "_tag" | keyof Equal.Equal>): Data<A> & { readonly _tag: Key } }
}
/**
* Provides a constructor for a Case Class.
*
* @since 1.0.0
* @category constructors
*/
export const Class = <A extends Record<string, any>>() => {
class Base {
constructor(args: Omit<A, keyof Equal.Equal>) {
Object.assign(this, args)
unsafeStruct(this)
}
}
return Base as unknown as { new(args: Omit<A, keyof Equal.Equal>): Data<A> }
}

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

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