intelliwaketssveltekitv25 0.1.174 → 0.1.176

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/Cookie.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export declare function CookieCreate(name: string, value: string | null, days?: number): void;
2
2
  export declare function CookieReadOld(name: string, defaultValue?: string | null): string | null;
3
- export declare function CookieRead<T extends string>(name: string, defaultValue?: T | null): T | null;
3
+ export declare function CookieRead<T extends string, D extends T | null = null>(name: string, defaultValue?: D): D extends null ? T | null : T;
4
4
  export declare function CookieErase(name: string): void;
package/dist/Cookie.js CHANGED
@@ -2,7 +2,7 @@
2
2
  // Cookie Manager
3
3
  // ----------------------------
4
4
  import { env } from '$env/dynamic/public';
5
- import { IsOn } from "@solidbasisventures/intelliwaketsfoundation";
5
+ import { IsOn } from '@solidbasisventures/intelliwaketsfoundation';
6
6
  export function CookieCreate(name, value, days) {
7
7
  name = name.replace(/=/g, '');
8
8
  let expires = '';
@@ -28,11 +28,14 @@ export function CookieReadOld(name, defaultValue = null) {
28
28
  }
29
29
  return defaultValue;
30
30
  }
31
- export function CookieRead(name, defaultValue = null) {
32
- return (IsOn(env.SSR) ? null : document.cookie
33
- .split(';')
34
- .find((row) => row.trim()
35
- .startsWith(`${name}=`))?.split('=')[1]?.trim() ?? defaultValue);
31
+ export function CookieRead(name, defaultValue) {
32
+ return (IsOn(env.SSR)
33
+ ? null
34
+ : (document.cookie
35
+ .split(';')
36
+ .find((row) => row.trim().startsWith(`${name}=`))
37
+ ?.split('=')[1]
38
+ ?.trim() ?? defaultValue));
36
39
  }
37
40
  export function CookieErase(name) {
38
41
  CookieCreate(name, '', -1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intelliwaketssveltekitv25",
3
- "version": "0.1.174",
3
+ "version": "0.1.176",
4
4
  "exports": {
5
5
  ".": {
6
6
  "types": "./dist/index.d.ts",