npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

abitbol-serializable

v2.1.0

Published

Serializable classes based on Abitbol classes

Downloads

1,762

Readme

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

  • https://wanadev.github.io/abitbol-serializable/

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.1.0:

    • feat: Removed dependency to the uuid library. Use browser/Node's secure implementation if available, or a fallback one else (@flozz)
    • feat: Only include used parts of lodash instead of the whole library (@flozz)
  • v2.0.2:

    • feat: Added TypeScript type declaration for SerializableClass and serializer (@Pduhard, #26)
    • misc: Updated dev dependencies (@dependabot)
  • 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