MCPcopy Create free account
hub / github.com/adonisjs/session / cleanupFlashData

Method cleanupFlashData

src/session.ts:195–206  ·  view source on GitHub ↗

* Filters flash data to only include values that should be flashed. * Removes values that have opted out of flash storage. * * @param data - Flash data to filter

(data: T)

Source from the content-addressed store, hash-verified

193 * @param data - Flash data to filter
194 */
195 protected cleanupFlashData<T>(data: T): T | Record<string, any> {
196 if (is.plainObject(data)) {
197 return Object.keys(data).reduce<Record<string, any>>((result, key) => {
198 const value = data[key]
199 if (this.shouldFlashValue(value)) {
200 result[key] = value
201 }
202 return result
203 }, {})
204 }
205 return data
206 }
207
208 /**
209 * Returns the store instance for a given mode

Callers 2

flashMethod · 0.95
flashAllMethod · 0.95

Calls 1

shouldFlashValueMethod · 0.95

Tested by

no test coverage detected