Socket
Socket
Sign inDemoInstall

abitbol-serializable

Package Overview
Dependencies
3
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    abitbol-serializable

Serializable classes based on Abitbol classes


Version published
Maintainers
2
Install size
1.50 MB
Created

Readme

Source

abitbol-serializable

Lint and test NPM Version License Discord

Abitbol Serializable is an abitbol class that can serialize its properties.

Features:

  • Serialize / Unserialize all computed properties that have a getter and a setter,
  • Skip properties annotated with "@serializable false".
  • Use custom serialization function for specific properties.

Example Class:

var SerializableClass = require("abitbol-serializable");

var Person = SerializableClass.$extend({

    __name__: "Person",  // The class name

    __init__: function(params) {
        this.$data.firstName = "John";
        this.$data.lastName = "DOE";
        this.$data.age = 0;
        this.$super(params);
    },

    getFirstName: function() {
        return this.$data.firstName;
    },

    setFirstName: function(firstName) {
        this.$data.firstName = firstName;
    },

    getLastName: function() {
        return this.$data.lastName;
    },

    setLastName: function(lastName) {
        this.$data.lastName = lastName;
    },

    getAge: function() {
        "@serializable false";
        return this.$data.age;
    },

    setAge: function(age) {
        this.$data.age = age;
    }

});

Example Serialization:

var john = new Person({
    lastName: "Wayne",
    age: 72
});

john.serialize();

// -> {
//        __name__: "Person",
//        id: "<an autogenerated uuid>",
//        firstName: "John",
//        lastName: "Wayne"
//    }

Install

To install Abitbol Serializable run the following command:

npm install abitbol-serializable

Documentation

Contributing

Questions

If you have any question, you can:

Bugs

If you found a bug, please open an issue on Github with as much information as possible.

Pull Requests

Please consider filing a bug before starting to work on a new feature. This will allow us to discuss the best way to do it. This is of course not necessary if you just want to fix some typo or small errors in the code.

Coding Style / Lint

To check coding style, run the follwoing command:

npm run lint

Tests

Tu run tests, use the following command:

npm run test

Changelog

  • [NEXT] (changes on master that have not been released yet):

    • Nothing yet ;)
  • v2.0.1:

    • Updated dependencies (@jbghoul, #12)
  • v2.0.0:

    • Updates abitbol dependency to 2.0.0
  • v1.0.2:

    • Documentation site
  • v1.0.1:

    • Updates uuid dependency to 3.0.0
  • v1.0.0:

    • Initial release

Keywords

FAQs

Last updated on 03 May 2023

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