BLUE
PHP 7.4.33
Path:
/var/www/sitesecurity.bitkit.dk/httpdocs/node_modules/reselect/src/devModeChecks
Run
Logout
Edit File
Size: 1.93 KB
Close
/var/www/sitesecurity.bitkit.dk/httpdocs/node_modules/reselect/src/devModeChecks/identityFunctionCheck.ts
Text
Base64
import type { AnyFunction } from '../types' /** * Runs a check to determine if the given result function behaves as an * identity function. An identity function is one that returns its * input unchanged, for example, `x => x`. This check helps ensure * efficient memoization and prevent unnecessary re-renders by encouraging * proper use of transformation logic in result functions and * extraction logic in input selectors. * * @param resultFunc - The result function to be checked. * @param inputSelectorsResults - The results of the input selectors. * @param outputSelectorResult - The result of the output selector. * * @see {@link https://reselect.js.org/api/development-only-stability-checks#identityfunctioncheck `identityFunctionCheck`} * * @since 5.0.0 * @internal */ export const runIdentityFunctionCheck = ( resultFunc: AnyFunction, inputSelectorsResults: unknown[], outputSelectorResult: unknown ) => { if ( inputSelectorsResults.length === 1 && inputSelectorsResults[0] === outputSelectorResult ) { let isInputSameAsOutput = false try { const emptyObject = {} if (resultFunc(emptyObject) === emptyObject) isInputSameAsOutput = true } catch { // Do nothing } if (isInputSameAsOutput) { let stack: string | undefined = undefined try { throw new Error() } catch (e) { // eslint-disable-next-line @typescript-eslint/no-extra-semi, no-extra-semi ;({ stack } = e as Error) } console.warn( 'The result function returned its own inputs without modification. e.g' + '\n`createSelector([state => state.todos], todos => todos)`' + '\nThis could lead to inefficient memoization and unnecessary re-renders.' + '\nEnsure transformation logic is in the result function, and extraction logic is in the input selectors.', { stack } ) } } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 3
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
identityFunctionCheck.ts
1.93 KB
lrw-r--r--
2026-04-28 09:11:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
inputStabilityCheck.ts
2.47 KB
lrw-r--r--
2026-04-28 09:11:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
setGlobalDevModeChecks.ts
2.56 KB
lrw-r--r--
2026-04-28 09:11:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).