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

@aeroware/classify.js

Package Overview
Dependencies
Maintainers
2
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aeroware/classify.js

Turn a string into a class!

  • 1.0.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
2
Weekly downloads
 
Created
Source

classify.js

Turn a string into a class!

The syntax of the format classify.js takes is very easy to learn.

The format goes something like this:

ClassName [constructor parameters]
    javascript code for the constructor

property = value

method [method parameters]
    javascript code for the method

...

classify.js will ignore anything that it can't understand.

Want a static property or method? Simply prefix the property or method with +. What about asynchronous methods? Prefix the method with =.

The = must go AFTER the + for it to work.

Parameters are separated by spaces inside the square brackets.

Here is an example using everything that was mentioned:

classify`
Person [name age]
    this.name = name;
    this.age = age;

sayHi []
    console.log(this.name);

+people = [];

getOlder []
    this.age++;

+=fetchData []
    return fetch("a url");
`;

This will produce the following class:

class Person {
    constructor (name age) {
        this.name = name;
        this.age = age;
    }

    sayHi () {
        console.log(this.name);
    }

    static people = [];

    getOlder () {
       this.age++;
    }

    static async fetchData () {
        return fetch("a url");
    }
}

FAQs

Package last updated on 14 Mar 2021

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