Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

serialijse

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

serialijse - npm Package Compare versions

Comparing version 0.0.17 to 0.0.18

lib/serialijse.d.ts

0

bower.json

@@ -0,0 +0,0 @@ {

7

package.json
{
"name": "serialijse",
"version": "0.0.17",
"version": "0.0.18",
"description": "serialize and deserialize your javascript objects, preserve your object model ",

@@ -8,3 +8,3 @@ "main": "index.js",

"pretest": "browserify index.js --standalone serialijse > dist/serialijse.bundle.js && uglifyjs2 dist/serialijse.bundle.js -o dist/serialijse.bundle.min.js",
"test": "mocha -R spec"
"test": "mocha -R spec && mocha-phantomjs -R spec test_html/demo.html"
},

@@ -42,3 +42,4 @@ "repository": {

"underscore": "^1.6.0"
}
},
"types": "./lib/serialijse.d.ts"
}

@@ -37,3 +37,29 @@ serialijse

Using serialijse in browser
----------------------------
* install serialijse component:
````sh
bower install serialijse
````
* in your html file:
```html
<script src="components/serialijse/dist/serialijse.bundle.js">
<script>
var serialize = serialijse.serialize;
var deserialize = serialijse.deserialize;
var declarePersistable = serialijse.declarePersistable;
var serializeZ = serialijse.serializeZ;
var deserializeZ = serialijse.deserializeZ;
var vehicule = new Vehicule();
...
var serializationString = serialize(vehicule);
...
var reconstructedObject = deserialize(serializationString);
</script>
```
Examples

@@ -154,1 +180,33 @@ ========

```
TypeScript example
------------------
```TypeScript
import * as serialijse from "serialijse";
class Greeter {
constructor(
private myName: string
) {}
greet(name: string): void {
console.log(`${this.myName} says: Hello ${name}`);
}
}
let greeter = new Greeter('Spock');
greeter.greet('Scotty');
// serialize
serialijse.declarePersistable(Greeter);
let greeterJson: string = serialijse.serialize(greeter);
// deserialize
serialijse.declarePersistable(Greeter); // not necessary in this example, but needed if deserializing in a new js context
let greeter1: Greeter = serialijse.deserialize<Greeter>(greeterJson);
greeter1.greet('Jean-Luc');
```
/*global describe, it*/
var Should;
if(typeof require !== "undefined") {
var should = require("should");
Should = require("should");
var serialijse = require("../");
} else {
var should = Should;
}
Should(true).eql(true);
var serialize = serialijse.serialize;

@@ -15,2 +18,6 @@ var deserialize = serialijse.deserialize;

(function () {
"use strict";

@@ -34,2 +41,4 @@

it("should persist a simple javascript object", function () {

@@ -102,3 +111,3 @@

should(the_vehicule.____index).eql(undefined);
Should(the_vehicule.____index).eql(undefined);

@@ -266,3 +275,3 @@ var expected = '[['+

should(function(){
Should(function(){
JSON.stringify(mark);

@@ -269,0 +278,0 @@ }).throwError(); // Circular

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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