@coldsurf/shared-utils
Advanced tools
| const e=({maxAge:e,httpOnly:t=!0})=>({httpOnly:t,secure:process.env.NODE_ENV===`production`,maxAge:e,sameSite:`lax`,path:`/`,domain:void 0});exports.createCommonCookieOptions=e; |
| //#region src/next/index.d.ts | ||
| declare const createCommonCookieOptions: ({ | ||
| maxAge, | ||
| httpOnly | ||
| }: { | ||
| maxAge: number; | ||
| httpOnly?: boolean; | ||
| }) => { | ||
| readonly httpOnly: boolean; | ||
| readonly secure: boolean; | ||
| readonly maxAge: number; | ||
| readonly sameSite: "lax"; | ||
| readonly path: "/"; | ||
| readonly domain: undefined; | ||
| }; | ||
| //# sourceMappingURL=index.d.ts.map | ||
| //#endregion | ||
| export { createCommonCookieOptions }; | ||
| //# sourceMappingURL=index.d.cts.map |
| {"version":3,"file":"index.d.cts","names":[],"sources":["../../src/src/next/index.ts"],"sourcesContent":[],"mappings":";cAAa;;;;EAAA,MAAA,EAAA,MAAA;EAeZ,QAAA,CAAA,EAAA,OAAA;CAAA,EAAA,GAAA;EAfyC,SAAA,QAAA,EAAA,OAAA;EAAA,SAAA,MAAA,EAAA,OAAA"} |
| //#region src/next/index.d.ts | ||
| declare const createCommonCookieOptions: ({ | ||
| maxAge, | ||
| httpOnly | ||
| }: { | ||
| maxAge: number; | ||
| httpOnly?: boolean; | ||
| }) => { | ||
| readonly httpOnly: boolean; | ||
| readonly secure: boolean; | ||
| readonly maxAge: number; | ||
| readonly sameSite: "lax"; | ||
| readonly path: "/"; | ||
| readonly domain: undefined; | ||
| }; | ||
| //# sourceMappingURL=index.d.ts.map | ||
| //#endregion | ||
| export { createCommonCookieOptions }; | ||
| //# sourceMappingURL=index.d.ts.map |
| {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/src/next/index.ts"],"sourcesContent":[],"mappings":";cAAa;;;;EAAA,MAAA,EAAA,MAAA;EAeZ,QAAA,CAAA,EAAA,OAAA;CAAA,EAAA,GAAA;EAfyC,SAAA,QAAA,EAAA,OAAA;EAAA,SAAA,MAAA,EAAA,OAAA"} |
| const e=({maxAge:e,httpOnly:t=!0})=>({httpOnly:t,secure:process.env.NODE_ENV===`production`,maxAge:e,sameSite:`lax`,path:`/`,domain:void 0});export{e as createCommonCookieOptions}; | ||
| //# sourceMappingURL=index.js.map |
| {"version":3,"file":"index.js","names":[],"sources":["../../src/next/index.ts"],"sourcesContent":["export const createCommonCookieOptions = ({\n maxAge,\n httpOnly = true,\n}: {\n maxAge: number;\n httpOnly?: boolean;\n}) => {\n return {\n httpOnly,\n secure: process.env.NODE_ENV === 'production',\n maxAge,\n sameSite: 'lax',\n path: '/',\n domain: undefined,\n } as const;\n};\n"],"mappings":"AAAA,MAAa,EAA4B,CAAC,CACxC,SACA,YAAW,EAIZ,IACQ,CACL,WACA,OAAQ,QAAQ,IAAI,WAAa,aACjC,SACA,SAAU,MACV,KAAM,IACN,WAAA,EACD"} |
| var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));const c=s(require(`react`));function l(e,t){let n=(0,c.useRef)(e),r=(0,c.useRef)(null);return(0,c.useEffect)(()=>{n.current=e}),(0,c.useCallback)((...e)=>{r.current&&clearTimeout(r.current),r.current=setTimeout(()=>n.current(...e),t)},[t])}exports.useDebouncedCallback=l; |
| //#region src/react/index.d.ts | ||
| declare function useDebouncedCallback<T extends (...args: any[]) => void>(fn: T, delay: number): (...args: Parameters<T>) => void; | ||
| //# sourceMappingURL=index.d.ts.map | ||
| //#endregion | ||
| export { useDebouncedCallback }; | ||
| //# sourceMappingURL=index.d.cts.map |
| {"version":3,"file":"index.d.cts","names":[],"sources":["../../src/src/react/index.ts"],"sourcesContent":[],"mappings":";iBAGgB,6DACV,6BAEO,WAAW;AAHxB"} |
| //#region src/react/index.d.ts | ||
| declare function useDebouncedCallback<T extends (...args: any[]) => void>(fn: T, delay: number): (...args: Parameters<T>) => void; | ||
| //# sourceMappingURL=index.d.ts.map | ||
| //#endregion | ||
| export { useDebouncedCallback }; | ||
| //# sourceMappingURL=index.d.ts.map |
| {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/src/react/index.ts"],"sourcesContent":[],"mappings":";iBAGgB,6DACV,6BAEO,WAAW;AAHxB"} |
| import{useCallback as e,useEffect as t,useRef as n}from"react";function r(r,i){let a=n(r),o=n(null);return t(()=>{a.current=r}),e((...e)=>{o.current&&clearTimeout(o.current),o.current=setTimeout(()=>a.current(...e),i)},[i])}export{r as useDebouncedCallback}; | ||
| //# sourceMappingURL=index.js.map |
| {"version":3,"file":"index.js","names":["fn: T","delay: number"],"sources":["../../src/react/index.ts"],"sourcesContent":["import { useCallback, useEffect, useRef } from 'react';\n\n// biome-ignore lint/suspicious/noExplicitAny: generic callback signature\nexport function useDebouncedCallback<T extends (...args: any[]) => void>(\n fn: T,\n delay: number\n): (...args: Parameters<T>) => void {\n const fnRef = useRef(fn);\n const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n useEffect(() => {\n fnRef.current = fn;\n });\n\n return useCallback(\n (...args: Parameters<T>) => {\n if (timerRef.current) clearTimeout(timerRef.current);\n timerRef.current = setTimeout(() => fnRef.current(...args), delay);\n },\n [delay]\n );\n}\n"],"mappings":"+DAGA,SAAgB,EACdA,EACAC,EACkC,CAElC,IADM,EAAQ,EAAO,EAAG,CAClB,EAAW,EAA6C,KAAK,CAMnE,MAJA,GAAU,IAAM,CACd,EAAM,QAAU,CACjB,EAAC,CAEK,EACL,CAAC,GAAG,IAAwB,CAE1B,AADI,EAAS,SAAS,aAAa,EAAS,QAAQ,CACpD,EAAS,QAAU,WAAW,IAAM,EAAM,QAAQ,GAAG,EAAK,CAAE,EAAM,AACnE,EACD,CAAC,CAAM,EACR,AACF"} |
| // This file is needed for projects that have `moduleResolution` set to `node` | ||
| // in their tsconfig.json to be able to `import {} from '@coldsurf/shared-utils/next'`. | ||
| // Other module resolution strategies will look for the `exports` in `package.json`, | ||
| // but with `node`, TypeScript will look for a .d.ts file with that name at the | ||
| // root of the package. | ||
| export * from '../dist/next'; |
| // This file is needed for projects that have `moduleResolution` set to `node` | ||
| // in their tsconfig.json to be able to `import {} from '@coldsurf/shared-utils/react'`. | ||
| // Other module resolution strategies will look for the `exports` in `package.json`, | ||
| // but with `node`, TypeScript will look for a .d.ts file with that name at the | ||
| // root of the package. | ||
| export * from '../dist/react'; |
+31
-18
@@ -8,3 +8,3 @@ { | ||
| }, | ||
| "version": "1.1.16", | ||
| "version": "1.2.0-alpha.0", | ||
| "license": "MIT", | ||
@@ -24,2 +24,12 @@ "bugs": { | ||
| "types": "./dist/index.d.ts" | ||
| }, | ||
| "./next": { | ||
| "import": "./dist/next/index.js", | ||
| "require": "./dist/next/index.cjs", | ||
| "types": "./next/index.d.ts" | ||
| }, | ||
| "./react": { | ||
| "import": "./dist/react/index.js", | ||
| "require": "./dist/react/index.cjs", | ||
| "types": "./react/index.d.ts" | ||
| } | ||
@@ -31,6 +41,15 @@ }, | ||
| "types": "dist/index.d.ts", | ||
| "files": [ | ||
| "dist", | ||
| "package.json" | ||
| ], | ||
| "files": ["dist", "next", "react", "package.json"], | ||
| "scripts": { | ||
| "build": "pnpm build:core", | ||
| "build:core": "tsdown", | ||
| "check": "biome check .", | ||
| "check:fix": "biome check --write .", | ||
| "check:type": "tsc --noEmit", | ||
| "format": "biome format .", | ||
| "format:fix": "biome format --write .", | ||
| "lint": "biome lint .", | ||
| "lint:fix": "biome lint --write .", | ||
| "test": "vitest run" | ||
| }, | ||
| "dependencies": { | ||
@@ -42,4 +61,6 @@ "date-fns": "4.1.0", | ||
| "devDependencies": { | ||
| "@types/react": "^19.1.0", | ||
| "jwt-decode": "^4.0.0", | ||
| "prettier": "*", | ||
| "react": "^19.1.0", | ||
| "schema-dts": "1.1.2", | ||
@@ -52,2 +73,3 @@ "tsdown": "^0.11.9", | ||
| "jwt-decode": "^4.0.0", | ||
| "react": "^18.0.0 || ^19.0.0", | ||
| "schema-dts": "^1.1.2", | ||
@@ -60,2 +82,5 @@ "zod": "^3.23.8" | ||
| }, | ||
| "react": { | ||
| "optional": true | ||
| }, | ||
| "schema-dts": { | ||
@@ -68,15 +93,3 @@ "optional": true | ||
| "access": "public" | ||
| }, | ||
| "scripts": { | ||
| "build": "pnpm build:core", | ||
| "build:core": "tsdown", | ||
| "check": "biome check .", | ||
| "check:fix": "biome check --write .", | ||
| "check:type": "tsc --noEmit", | ||
| "format": "biome format .", | ||
| "format:fix": "biome format --write .", | ||
| "lint": "biome lint .", | ||
| "lint:fix": "biome lint --write .", | ||
| "test": "vitest run" | ||
| } | ||
| } | ||
| } |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 3 instances in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
87758
7.96%25
177.78%520
7.66%7
16.67%8
33.33%7
133.33%3
200%