New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

jsmoves

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsmoves

Move JS from one live system to another

  • 0.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-75%
Maintainers
1
Weekly downloads
 
Created
Source

jsmoves Build Status

Move JS from one live system to another.

engines: node >= 8.x

Example

const {encode, decode} = require('jsmoves');
const obj = {
  a: 1,
  b() {
    return 1;
  }
};
const str = encode(obj);
const obj1 = decode(str);

Installation

npm i jsmoves --save

API

.encode(obj, throwOnInvalidType = false)

.decode(str throwOnInvalidSyntax = false)

By default, without throwing errors, .encode() returns false given an invalid type. By default, without throwing errors, .decode() returns undefined given a invalid syntax.

Supported data types

  • String
  • Boolean
  • Number
  • Array
  • Object
  • Date
  • Function (all combinations of: regular, async, generator, arrow)
  • NaN
  • null
  • undefined

All types are supported when wrapped in a function.

Caveats

Function behavior is normalized and consistent; however, the parsed function may contain slight formatting differences from the original; its functionality however, will remain consistent.

Perf

As fast as native JSON.parse() JSON.stringify():

// 1M iterations. Each iteration calls both encode and decode.

// jsmoves:
// milliseconds: 6833.45
// ops/sec: 146,338.965
// ---
// control (native):
// milliseconds: 7033.58
// ops/sec: 142,175.109

License

MIT

FAQs

Package last updated on 07 Dec 2017

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc