0.2.0 • Published 8 years ago

typed-class v0.2.0

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

prop-it

Build Status

Instantiate classes with a string type

Installation

Install with npm

npm install typed-class

Example

Request: our Base Class

# lib/request/Request.coffee
TypedClass = require( 'typed-class' ) __dirname

module.exports = class Request extends TypedClass

Start: a Specialized Request

# lib/request/Start.coffee
Request = require './Request'

module.exports = class StartRequest extends Request

Instantiate Start

# elsewhere.coffee
Request = require './lib/request/Request'

start = Request.create type: 'start', {other: 'options'}
console.log start instanceOf Request # => true
console.log start instanceOf require './lib/request/Start' # => true