Socket
Socket
Sign inDemoInstall

backbone.namedconstructor

Package Overview
Dependencies
2
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    backbone.namedconstructor

Names Backbone object constructors.


Version published
Weekly downloads
10
increased by233.33%
Maintainers
1
Install size
1.09 MB
Created
Weekly downloads
 

Changelog

Source

v1.0.6 / 2015-08-24

  • (7f5115c) Add license info to README

Readme

Source

backbone.namedconstructor

Build Status NPM version

Give your Backbone object a named constructor, so you can make sense of it in the dev tools console.

Works with AMD, CommonJS and browser globals.

Installation

$ npm install backbone.namedconstructor

Example

If you set a constructorName property, this will be used to name the constructor:

var Backbone = require('backbone');
require('backbone.namedconstructor');

var Model = Backbone.Model.extend({ constructorName: 'Foo' });
console.log(new Model().constructor.name);
// 'Foo'

So, instead of:

You'll see:

Tests

$ npm test

Credit

The basis for this module was this great Stack Overflow answer given by Dan Malcolm. Cheers!

License

MIT

Keywords

FAQs

Last updated on 24 Aug 2015

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc