
Security News
Socket Security Analysis Is Now One Click Away on npm
npm now links to Socket's security analysis on every package page. Here's what you'll find when you click through.
stash-object
Advanced tools
Stash the current state of an object and restore at a later time.
Install with npm:
$ npm install --save stash-object
var stash = require('stash-object');
Create a new stash for an object. This will return an object with .stash and .restore methods used for stashing and restoring states of the original object.
Params
obj {Object}: Object to use for original state.returns {Object}: New instance used for stashing and restoring object state.Example
var options = {};
var optionStash = stash(options);
Stash the current object state on a named stack. Pass a property path as the second argument to only stash part of the object.
Params
name {String}: Name of the stack to push the object state onto.prop {String|Array}: Optional property path to stashreturns {Object} this: for chainingExample
optionStash.stash('foo');
optionStash.stash('foo', 'bar.baz');
Restore a stashed object from the stack. Pass a property path as the second argument to only restore part of the object.
Params
name {String}: Name of the stack to retore the object state from.prop {String|Array}: Optional property path to restorereturns {Object}: Restored object. This is returned in case the original object reference needs to be reset.Example
var obj = optionsStash.restore('foo');
var obj = optionsStash.restore('foo', 'bar.baz');
a.b.c) to get a nested value from an object. | homepage'a.b.c') paths. | homepagePull requests and stars are always welcome. For bugs and feature requests, please create an issue.
(This document was generated by verb-generate-readme (a verb generator), please don't edit the readme directly. Any changes to the readme must be made in .verb.md.)
To generate the readme and API documentation with verb:
$ npm install -g verb verb-generate-readme && verb
Install dev dependencies:
$ npm install -d && npm test
Brian Woodward
Copyright © 2016, Brian Woodward. Released under the MIT license.
This file was generated by verb, v0.9.0, on July 27, 2016.
FAQs
Stash the current state of an object and restore at a later time.
We found that stash-object demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
npm now links to Socket's security analysis on every package page. Here's what you'll find when you click through.

Security News
A compromised npm publish token was used to push a malicious postinstall script in cline@2.3.0, affecting the popular AI coding agent CLI with 90k weekly downloads.

Product
Socket is now scanning AI agent skills across multiple languages and ecosystems, detecting malicious behavior before developers install, starting with skills.sh's 60,000+ skills.