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

Method pull

src/values_store.ts:196–201  ·  view source on GitHub ↗

* Pulls value from the store. Same as calling store.get then store.unset. * * @param key - The key or key path to pull * @param defaultValue - Default value if key doesn't exist * * @example * const message = store.pull('notification', 'No messages') * const data = store.pull(['

(key: string | string[], defaultValue?: any)

Source from the content-addressed store, hash-verified

194 * const data = store.pull(['temp', 'data'])
195 */
196 pull(key: string | string[], defaultValue?: any): any {
197 return ((value): any => {
198 this.unset(key)
199 return value
200 })(this.get(key, defaultValue))
201 }
202
203 /**
204 * Increments a numeric value. Raises an error when underlying value is not a number.

Callers 1

loadMethod · 0.95

Calls 2

unsetMethod · 0.95
getMethod · 0.45

Tested by

no test coverage detected