JSPM

extendable-record

0.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 6
  • Score
    100M100P100Q23446F
  • License MIT

Extendable (Inheritable) Immutable Records for Immutable Object Oriented Patterns

Package Exports

  • extendable-record

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (extendable-record) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Version MIT license dependencies devDependency Status airbnb code style


Dependencies

Getting Started

npm install extendable-record --save

Usage

import { ExtendableRecord } from  'extendable-record';

export class BaseModel extends ExtendableRecord {}
BaseModel.defaultProperties = {
  isRequired: false,
  name: '',
  id: null
};

export class PrimitiveModel extends BaseModel {
  getValue() {
    return this.value;
  }
  setVaule(newValue) {
    return this.set('value', newValue);
  }
}
PrimitiveModel.defaultProperties = {
  value: null
};

var myModel = PrimitiveModel({value: 2, id: 'myModelId'});

var myNewModel = myModel.setValue(4)

Credits

  • ImmutableJS for underlying data structures
  • Hexbridge for sponsoring my open-source work.
  • npm-starter
  • Airbnb for the work they've put into the javascript style guide and into the ESlint package.

License

MIT @ Joe Delgado