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

Blueprint-Sugar

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Blueprint-Sugar

A simple Sugar for Prototypal Inheritance

  • 0.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
increased by100%
Maintainers
1
Weekly downloads
 
Created
Source

Blueprint - Sugar syntax for Prototypal Inheritance

Why another?

I wanted a small utility (858B bytes minified/413 bytes gzipped) that could easily be used in a cross-browser fashion and still be AMD and Node.js compatible.

yeahh… that's the only reason.

Beware

  • It's a sugar for Prototypal Inheritance, not a Class system…

TODO

  • A decent page for tests.
  • Finish testing.
  • Polyfill for the Object.getPrototypeOf and Object.isPrototypeOf methods

Installation

as a Node.js Package

$ npm install Blueprint-Sugar

Require package

var Blueprint = require('Blueprint-Sugar');

Example of Use

Create an Object

var Example = Blueprint.create({
    init    : function(){},
    method1 : function(){},
    method2 : fucntion(){}
});

Instanciate the object

var example = Example.create();

Instanciate and extend an object

var example = Example.create({
        anotherMethod : function () {}
    });

Add methods/properties to instance

// I find myself adding properties/methods to instances a lot,
// this is just a helper. Could ease some work while working
// with mixins…

example.implement({
    moreMethods : function () {},
    moreProperties : 2
});

Feel free to pull requests, open issues and so on… right now i'm quite open to ideas, improvements and suggestions.

Keywords

FAQs

Package last updated on 02 Mar 2012

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