strictduck

retroactive inheritance system for javascript

Very old and unmaintained
Last updated 4 years ago by micimize .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install strictduck 
SYNC missed versions from official npm registry.

StrictDuck

StrictDuck is a retroactive inheritance system for javascript. It aims to solve the problem of runtime object opacity and identity to allow for higher level abstractions, such as the "self aware" component composition in strictduck-control-inverted.

Overview

StrictDuck

The default export is the StrictDuck class, which all StrictDucks inherit from. StrictDuck does the following:
* assigns the first argument to the new instance
* leverages duckface to ensure the new instance implements the interfaces specified in the rest of the arguments
* assigns the object the key { [Symbol('strictduck.id')] : Symbol(strictDuckClassName) }, giving us a more dependable way to identify object inheritance

Another key export is extend, which is used for tersely specifying StrictDucks, such as the Main export:

export const Main = extend({ name: 'Main', methods: ['main'] })

identity and equality helpers

exports id, equals, and is are used for identifying strictducks (every StrictDuck class has id as a key) and comparing them.

import {Main, equals, is} from 'strictduck'
let instance = new Main(mainObj)
equals(instance.prototype, Main) == true
is({instance, Class: Main}) == true

implement and implementable

The implement export is used for specifying the implementation of a strictduck class, such as strictduck-domain-driven-fullstack/Domain#implementation.

The implementable export is a small function for creating overridable default options. An example usage looks like strictduck-domain-driven-fullstack/client.

I consider both implement and implementable clunky and possibly unnecessary, and hope to remove them eventually.

misc

StrictDuck and strictduck-control-inverted are the cornerstone of bufflehead and it's various components. The overarching goal of the strictduck project is to bring "runtime self awareness" to javascript, and then build higher level abstractions utilizing that.

StrictDuck is untested for projects that don't use polypacker as the build tool. In fact, it's only tested by it's usage elsewhere.

Current Tags

  • 0.1.4                                ...           latest (4 years ago)

6 Versions

  • 0.1.4 [deprecated]           ...           4 years ago
  • 0.1.3                                ...           4 years ago
  • 0.1.3-alpha                                ...           4 years ago
  • 0.1.2                                ...           4 years ago
  • 0.1.1                                ...           4 years ago
  • 0.0.1                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (3)
Dev Dependencies (1)

Copyright 2014 - 2016 © taobao.org |