Skip to content

snowyu/class-type.js

Repository files navigation

class-type npm

Build Status Code Climate Test Coverage downloads license

The class type info object. It holds all registered class types with LRU-cache. The value of the class type is the object.

  • Self-consistent class system

  • Dynamic attributes inheritance

  • Parent class type load on demand.

  • Streamable attributes and methods.

  • Additional

    • LRU-cache on classes.
    • eventable on class, attribute and method loading.

Usage

Class = require('class-type')

# create a new Test Class
TestClass = Class 'TestClass',
  Inherits: 'TheParentClassName'
  constructor: (age)->@age=age # It could be a function string.
  age: 0 # this is the default age.

# create an instance of TestClass.
test = TestClass.create(12)
assert.equal test.age, 12

API

See abstract-type.

  • Static Properties:

  • the attributes for class declaration:

    • Inherits (String|ClassType|Ctor)
    • constructor (Function|StringFunction)

TODO

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published