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

@rx-signals/store

Package Overview
Dependencies
Maintainers
1
Versions
94
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rx-signals/store - npm Package Compare versions

Comparing version 3.0.0-rc41 to 3.0.0-rc42

39

dist/cjs/type-utils.js

@@ -123,5 +123,6 @@ "use strict";

const newGet = (v) => (0, exports.pick)(get(v), key);
const result = ((k) => _toLens(newGet, k));
result.get = newGet;
return result;
return {
get: newGet,
k: (k) => _toLens(newGet, k),
};
};

@@ -154,3 +155,3 @@ /**

* ```ts
* const lensA = getLens<Test>()('a');
* const lensA = getLens<Test>().k('a');
* const a1 = lensA.get(t1); // => undefined (inferred as undefined | string | Array<boolean | { x: number | Array<number>}>)

@@ -160,3 +161,3 @@ * const a2 = lensA.get(t2); // => 'Test3' (inferred as undefined | string | Array<boolean | { x: number | Array<number>}>)

*
* const lensA2X1 = getLens<Test>()('a')(2)('x')(1);
* const lensA2X1 = lensA.k(2).k('x').k(1);
* const n1 = lensA2X1.get(t1); // => undefined (inferred as number | undefined)

@@ -169,12 +170,12 @@ * const n2 = lensA2X1.get(t2); // => undefined (inferred as number | undefined)

const get = (value) => value;
const result = ((key) => _toLens(get, key));
result.get = get;
return result;
return {
get,
k: (key) => _toLens(get, key),
};
};
exports.getLens = getLens;
const _toGetter = (g) => {
const result = ((key) => _toGetter(() => (0, exports.pick)(g(), key)));
result.get = () => g();
return result;
};
const _toGetter = (g) => ({
get: () => g(),
k: (key) => _toGetter(() => (0, exports.pick)(g(), key)),
});
/**

@@ -208,8 +209,8 @@ * Wraps the given value of type T in a `Getter<T>`.

* ```ts
* const b1 = toGetter(t1)('a')('b').get(); // => undefined (inferred as number | string | undefined)
* const b2 = toGetter(t2)('a')('b').get(); // => undefined (inferred as number | string | undefined)
* const b3 = toGetter(t3)('a')('b').get(); // => 'Test' (inferred as number | string | undefined)
* const x1 = toGetter(t1)('x')(1).get(); // => undefined (inferred as number | undefined)
* const x2 = toGetter(t2)('x')(1).get(); // => 2 (inferred as number | undefined)
* const x3 = toGetter(t3)('x')(1).get(); // => undefined (inferred as number | undefined)
* const b1 = toGetter(t1).k('a').k('b').get(); // => undefined (inferred as number | string | undefined)
* const b2 = toGetter(t2).k('a').k('b').get(); // => undefined (inferred as number | string | undefined)
* const b3 = toGetter(t3).k('a').k('b').get(); // => 'Test' (inferred as number | string | undefined)
* const x1 = toGetter(t1).k('x').k(1).get(); // => undefined (inferred as number | undefined)
* const x2 = toGetter(t2).k('x').k(1).get(); // => 2 (inferred as number | undefined)
* const x3 = toGetter(t3).k('x').k(1).get(); // => undefined (inferred as number | undefined)
* ```

@@ -216,0 +217,0 @@ */

@@ -243,3 +243,3 @@ import { NoValueType } from './store-utils';

* ```ts
* const lensA = getLens<Test>()('a');
* const lensA = getLens<Test>().k('a');
* const a1 = lensA.get(t1); // => undefined (inferred as undefined | string | Array<boolean | { x: number | Array<number>}>)

@@ -249,3 +249,3 @@ * const a2 = lensA.get(t2); // => 'Test3' (inferred as undefined | string | Array<boolean | { x: number | Array<number>}>)

*
* const lensA2X1 = getLens<Test>()('a')(2)('x')(1);
* const lensA2X1 = lensA.k(2).k('x').k(1);
* const n1 = lensA2X1.get(t1); // => undefined (inferred as number | undefined)

@@ -258,3 +258,4 @@ * const n2 = lensA2X1.get(t2); // => undefined (inferred as number | undefined)

get: (value: T) => P | undefined;
} & (<K extends ToKeys<P>>(key: K) => OptionalLens<T, PickReturn<P, K>>);
k: <K extends ToKeys<P>>(key: K) => OptionalLens<T, PickReturn<P, K>>;
};
/**

@@ -286,3 +287,3 @@ * Get an `OptionalLens<T, T>` for type-safe access on arbitrarily nested properties of type `T`,

* ```ts
* const lensA = getLens<Test>()('a');
* const lensA = getLens<Test>().k('a');
* const a1 = lensA.get(t1); // => undefined (inferred as undefined | string | Array<boolean | { x: number | Array<number>}>)

@@ -292,3 +293,3 @@ * const a2 = lensA.get(t2); // => 'Test3' (inferred as undefined | string | Array<boolean | { x: number | Array<number>}>)

*
* const lensA2X1 = getLens<Test>()('a')(2)('x')(1);
* const lensA2X1 = lensA.k(2).k('x').k(1);
* const n1 = lensA2X1.get(t1); // => undefined (inferred as number | undefined)

@@ -311,3 +312,4 @@ * const n2 = lensA2X1.get(t2); // => undefined (inferred as number | undefined)

get: () => T;
} & (<K extends ToKeys<T>>(key: K) => Getter<PickReturn<T, K>>);
k: <K extends ToKeys<T>>(key: K) => Getter<PickReturn<T, K>>;
};
/**

@@ -345,10 +347,10 @@ * Helper type to infer the concrete value type `T` wrapped by a `Getter<T>`

* ```ts
* const b1 = toGetter(t1)('a')('b').get(); // => undefined (inferred as number | string | undefined)
* const b2 = toGetter(t2)('a')('b').get(); // => undefined (inferred as number | string | undefined)
* const b3 = toGetter(t3)('a')('b').get(); // => 'Test' (inferred as number | string | undefined)
* const x1 = toGetter(t1)('x')(1).get(); // => undefined (inferred as number | undefined)
* const x2 = toGetter(t2)('x')(1).get(); // => 2 (inferred as number | undefined)
* const x3 = toGetter(t3)('x')(1).get(); // => undefined (inferred as number | undefined)
* const b1 = toGetter(t1).k('a').k('b').get(); // => undefined (inferred as number | string | undefined)
* const b2 = toGetter(t2).k('a').k('b').get(); // => undefined (inferred as number | string | undefined)
* const b3 = toGetter(t3).k('a').k('b').get(); // => 'Test' (inferred as number | string | undefined)
* const x1 = toGetter(t1).k('x').k(1).get(); // => undefined (inferred as number | undefined)
* const x2 = toGetter(t2).k('x').k(1).get(); // => 2 (inferred as number | undefined)
* const x3 = toGetter(t3).k('x').k(1).get(); // => undefined (inferred as number | undefined)
* ```
*/
export declare const toGetter: <T>(value: T) => Getter<T>;

@@ -115,5 +115,6 @@ /* eslint-disable @typescript-eslint/naming-convention */

const newGet = (v) => pick(get(v), key);
const result = ((k) => _toLens(newGet, k));
result.get = newGet;
return result;
return {
get: newGet,
k: (k) => _toLens(newGet, k),
};
};

@@ -146,3 +147,3 @@ /**

* ```ts
* const lensA = getLens<Test>()('a');
* const lensA = getLens<Test>().k('a');
* const a1 = lensA.get(t1); // => undefined (inferred as undefined | string | Array<boolean | { x: number | Array<number>}>)

@@ -152,3 +153,3 @@ * const a2 = lensA.get(t2); // => 'Test3' (inferred as undefined | string | Array<boolean | { x: number | Array<number>}>)

*
* const lensA2X1 = getLens<Test>()('a')(2)('x')(1);
* const lensA2X1 = lensA.k(2).k('x').k(1);
* const n1 = lensA2X1.get(t1); // => undefined (inferred as number | undefined)

@@ -161,11 +162,11 @@ * const n2 = lensA2X1.get(t2); // => undefined (inferred as number | undefined)

const get = (value) => value;
const result = ((key) => _toLens(get, key));
result.get = get;
return result;
return {
get,
k: (key) => _toLens(get, key),
};
};
const _toGetter = (g) => {
const result = ((key) => _toGetter(() => pick(g(), key)));
result.get = () => g();
return result;
};
const _toGetter = (g) => ({
get: () => g(),
k: (key) => _toGetter(() => pick(g(), key)),
});
/**

@@ -199,8 +200,8 @@ * Wraps the given value of type T in a `Getter<T>`.

* ```ts
* const b1 = toGetter(t1)('a')('b').get(); // => undefined (inferred as number | string | undefined)
* const b2 = toGetter(t2)('a')('b').get(); // => undefined (inferred as number | string | undefined)
* const b3 = toGetter(t3)('a')('b').get(); // => 'Test' (inferred as number | string | undefined)
* const x1 = toGetter(t1)('x')(1).get(); // => undefined (inferred as number | undefined)
* const x2 = toGetter(t2)('x')(1).get(); // => 2 (inferred as number | undefined)
* const x3 = toGetter(t3)('x')(1).get(); // => undefined (inferred as number | undefined)
* const b1 = toGetter(t1).k('a').k('b').get(); // => undefined (inferred as number | string | undefined)
* const b2 = toGetter(t2).k('a').k('b').get(); // => undefined (inferred as number | string | undefined)
* const b3 = toGetter(t3).k('a').k('b').get(); // => 'Test' (inferred as number | string | undefined)
* const x1 = toGetter(t1).k('x').k(1).get(); // => undefined (inferred as number | undefined)
* const x2 = toGetter(t2).k('x').k(1).get(); // => 2 (inferred as number | undefined)
* const x3 = toGetter(t3).k('x').k(1).get(); // => undefined (inferred as number | undefined)
* ```

@@ -207,0 +208,0 @@ */

{
"name": "@rx-signals/store",
"version": "3.0.0-rc41",
"version": "3.0.0-rc42",
"description": "Reactive state- and effects-management with behaviors and event streams",

@@ -5,0 +5,0 @@ "author": "Gerd Neudert",

@@ -6,3 +6,3 @@ # _@rx-signals/store_

:warning: This documentation is work in progress for the upcoming 3.0.0 version.
There is however NO good reason to use 2.x over 3.0.0-rc41, so please start with the rc-version (3.0.0 will be the first version I'm going to advertise publicly, so it's more like a 1.0 in reality.).
There is however NO good reason to use 2.x over 3.0.0-rc42, so please start with the rc-version (3.0.0 will be the first version I'm going to advertise publicly, so it's more like a 1.0 in reality.).
2.x is deprecated and will NOT be maintained in any way.

@@ -15,3 +15,3 @@

**`npm install --save @rx-signals/store@3.0.0-rc41`**
**`npm install --save @rx-signals/store@3.0.0-rc42`**

@@ -18,0 +18,0 @@ ## Dependencies

@@ -398,3 +398,3 @@ /* eslint-disable @typescript-eslint/naming-convention */

* ```ts
* const lensA = getLens<Test>()('a');
* const lensA = getLens<Test>().k('a');
* const a1 = lensA.get(t1); // => undefined (inferred as undefined | string | Array<boolean | { x: number | Array<number>}>)

@@ -404,3 +404,3 @@ * const a2 = lensA.get(t2); // => 'Test3' (inferred as undefined | string | Array<boolean | { x: number | Array<number>}>)

*
* const lensA2X1 = getLens<Test>()('a')(2)('x')(1);
* const lensA2X1 = lensA.k(2).k('x').k(1);
* const n1 = lensA2X1.get(t1); // => undefined (inferred as number | undefined)

@@ -413,3 +413,4 @@ * const n2 = lensA2X1.get(t2); // => undefined (inferred as number | undefined)

get: (value: T) => P | undefined;
} & (<K extends ToKeys<P>>(key: K) => OptionalLens<T, PickReturn<P, K>>);
k: <K extends ToKeys<P>>(key: K) => OptionalLens<T, PickReturn<P, K>>;
};

@@ -421,8 +422,9 @@ const _toLens = <T, P, K extends ToKeys<P>>(

const newGet = (v: T): PickReturn<P, K> => pick(get(v), key);
const result = (<NK extends ToKeys<PickReturn<P, K>>>(
k: NK,
): OptionalLens<T, PickReturn<PickReturn<P, K>, NK>> =>
_toLens<T, PickReturn<P, K>, NK>(newGet, k)) as OptionalLens<T, PickReturn<P, K>>;
result.get = newGet;
return result;
return {
get: newGet,
k: <NK extends ToKeys<PickReturn<P, K>>>(
k: NK,
): OptionalLens<T, PickReturn<PickReturn<P, K>, NK>> =>
_toLens<T, PickReturn<P, K>, NK>(newGet, k),
};
};

@@ -456,3 +458,3 @@

* ```ts
* const lensA = getLens<Test>()('a');
* const lensA = getLens<Test>().k('a');
* const a1 = lensA.get(t1); // => undefined (inferred as undefined | string | Array<boolean | { x: number | Array<number>}>)

@@ -462,3 +464,3 @@ * const a2 = lensA.get(t2); // => 'Test3' (inferred as undefined | string | Array<boolean | { x: number | Array<number>}>)

*
* const lensA2X1 = getLens<Test>()('a')(2)('x')(1);
* const lensA2X1 = lensA.k(2).k('x').k(1);
* const n1 = lensA2X1.get(t1); // => undefined (inferred as number | undefined)

@@ -471,6 +473,7 @@ * const n2 = lensA2X1.get(t2); // => undefined (inferred as number | undefined)

const get = (value: T) => value;
const result = (<K extends ToKeys<T>>(key: K): OptionalLens<T, PickReturn<T, K>> =>
_toLens<T, T, K>(get, key)) as OptionalLens<T, T>;
result.get = get;
return result;
return {
get,
k: <K extends ToKeys<T>>(key: K): OptionalLens<T, PickReturn<T, K>> =>
_toLens<T, T, K>(get, key),
};
};

@@ -489,3 +492,4 @@

get: () => T;
} & (<K extends ToKeys<T>>(key: K) => Getter<PickReturn<T, K>>);
k: <K extends ToKeys<T>>(key: K) => Getter<PickReturn<T, K>>;
};

@@ -497,8 +501,6 @@ /**

const _toGetter = <T>(g: () => T): Getter<T> => {
const result = (<K extends ToKeys<T>>(key: K): Getter<PickReturn<T, K>> =>
_toGetter(() => pick(g(), key))) as Getter<T>;
result.get = () => g();
return result;
};
const _toGetter = <T>(g: () => T): Getter<T> => ({
get: () => g(),
k: <K extends ToKeys<T>>(key: K): Getter<PickReturn<T, K>> => _toGetter(() => pick(g(), key)),
});

@@ -533,10 +535,10 @@ /**

* ```ts
* const b1 = toGetter(t1)('a')('b').get(); // => undefined (inferred as number | string | undefined)
* const b2 = toGetter(t2)('a')('b').get(); // => undefined (inferred as number | string | undefined)
* const b3 = toGetter(t3)('a')('b').get(); // => 'Test' (inferred as number | string | undefined)
* const x1 = toGetter(t1)('x')(1).get(); // => undefined (inferred as number | undefined)
* const x2 = toGetter(t2)('x')(1).get(); // => 2 (inferred as number | undefined)
* const x3 = toGetter(t3)('x')(1).get(); // => undefined (inferred as number | undefined)
* const b1 = toGetter(t1).k('a').k('b').get(); // => undefined (inferred as number | string | undefined)
* const b2 = toGetter(t2).k('a').k('b').get(); // => undefined (inferred as number | string | undefined)
* const b3 = toGetter(t3).k('a').k('b').get(); // => 'Test' (inferred as number | string | undefined)
* const x1 = toGetter(t1).k('x').k(1).get(); // => undefined (inferred as number | undefined)
* const x2 = toGetter(t2).k('x').k(1).get(); // => 2 (inferred as number | undefined)
* const x3 = toGetter(t3).k('x').k(1).get(); // => undefined (inferred as number | undefined)
* ```
*/
export const toGetter = <T>(value: T): Getter<T> => _toGetter<T>(() => value);

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