Socket
Socket
Sign inDemoInstall

simple-save

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    simple-save

A stupidly simple way to persist data.


Version published
Weekly downloads
7
increased by600%
Maintainers
1
Install size
3.08 kB
Created
Weekly downloads
 

Readme

Source

simple-save

A stupidly simple way of persisting values in nodejs. This will rewrite tagged literal values that are assigned to variables in your source code.

  • No config files!
  • No environment variables!
  • No databases!

Persist hardcoded data in your source files like you've always wanted!

Install

  npm install simple-save

Usage

save(variableName:string, newValue, [suffix:string])

Call the package with the name of the variable you want to persist, and the new value. This will replace the assignments of all tagged occurrences of this variable with the new value.

  var save = require("simple-save")();
  /*SS*/ var test = 3;

  test = 5
  save("test", test);

Advanced

If you want to set a custom tag instead of the default of "SS", pass in a string:

  var save = require("simple-save")("SAVE");

You can also set custom tag suffixes on a per-variable basis as follows. In the following example, only the value of the variable within the function is modified.

  var save = require("simple-save")();
  /*SS*/ var test = 3;

  function ttt(){
    /*SS:1*/ var test = 3;
  }

  test = 5
  save("test", test, "1");

Keywords

FAQs

Last updated on 10 Sep 2015

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc