0.5.5 • Published 8 months ago

regstr v0.5.5

Weekly downloads
1
License
MIT
Repository
-
Last release
8 months ago

regStr module

introduction

regStr is a node.js module definining
The handler to JSON.stringify objects with RegExp properties and then JSON.parse json string resulted back.

usage in codes

var h = require('./regstr').regStr;
// or 
h = require('regstr').regStr;

Suppose the `o is a variable of some entity containing RegExp elements.

option 1

var jsonStr, clone, oj;

jsonStr = JSON.stringify(h.streger(o));
clone = h.reger(JSON.parse(jsonStr));

// Or

h.streger(o);
jsonStr = JSON.stringify(o);
oj = JSON.parse(jsonStr);
clone = h.reger(oj);

option 2

var replacer = h.replacer.bind(h);
var reviver = h.reviver.bind(h);

jsonStr = JSON.stringify(o, replacer);
clone = JSON.parse(jsonStr, reviver);

How

To download, to install and begin to use the package

  • go to the root of your project where you want to add regstr as dependent node.js module. Let's your project root dir is
    someDisk:\some-path-to\your-proj-dir. I will denote it as~/your-proj-dir/`

  • You need to have node.js and npm have been installed on your pc.

  • The explanaions following presume Windows Command Prompt environement.

source

The package Source repository front page

Install, Test, Usage

  1. Open cmd Command Prompt Shell

Ctl+R cmd {Enter}

  1. Go to the root directory of your package. Make it as the current one. This may be just new empty directory named as has been mentioned earlier. Download and install the module locally using npm package manager
cd /d ~\your-proj-dir
npm i regstr

After the completion of all npm-node staff you could note some new staff in your dir:

  • the subdirectory node_modules has been created in ~\your-proj-dir\ dir with subfolder regstr or if your project allready had any stuff this subfolder has been added to your node_modules folder :
~\your-proj-dir
    |-- node_modules  
          |-- regstr
          |-- ...
  1. To check the correctness of downloading an installation go to the appropriates regstr subpackage directories and run test commands:
    at first to the uncycle dir
cd .\node_modules\regstr\
npm run test

See the test output 5. Return to you package root folder and check if the package is accessible

cd ..\..\

in ~\your-proj-dir\ directory as current one. Type

node
require.resolve('regstr')

Look for the output being something like this: diskLetter:\\etc\\..\\your-proj-dir\\node_modules\\regstr\\regstr.js

Exit from node.js REPL using command .exit and in Command Prompt type

npm run test

If you would have seen everything is as described then in any place of your .js files inside your project directory you could have access to regstr using the command

/* @type {Object} */
var r = require('regstr').regStr;  // ! in .regStr S - uppercase

// or alternatively
var rr = require('./node_modules\regstr\regstr.js').regStr;

Of course let or const could be used for assignement.

Explanation and details

The package has it's own explanation of usage, algorithm's details and is commented in details in script files. To get explanation in command propmt go into appropiate root folder of the package and run any of cmd commands

npm run explain
npm run explain-ciph
npm run explain-deciph

You are welcome!

Vladimir Uralov
v.url.node@gmail.com

0.5.4

10 months ago

0.5.5

8 months ago

0.5.2

6 years ago

0.5.1

6 years ago

0.5.0

6 years ago