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

bodyguard

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bodyguard

Bodyguard =========

  • 0.1.2
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

Bodyguard

Build Status Dependency Status devDependency Status

Because sometimes you want something like interfaces in JavaScript

Installation

If you are using Node.js: npm install bodyguard
If you are using Bower: bower install bodyguard (If you also want to save the configuration in your package.json or bower.json add --save to the command.)

Don't use npm or bower? Just grab bodyguard.js from the dist folder and embed it in your application.

Example

JavaScript:

var MyClass = (function() {
  var MyClass = function() {};
  
  MyClass.prototype.a = function() {
    return 5;
  };
  
  MyClass.prototype.b = function() {
    return 6;
  };
  
  MyClass.prototype.c = function() {
    return 7;
  };
})();

var NewClass = bodyguard('NewClass', ['a', 'b'], new MyClass());
// NewClass can now be instantiated and returns an object with a and b bound
// to its prototype

CoffeeScript:

class MyClass
  constructor: ->
  
  a: -> 5
  b: -> 6
  c: -> 7
  
NewClass = bodyguard 'NewClass', ['a', 'b'], new MyClass()
# NewClass can now be instantiated and returns an object with a and b bound
# to its prototype

(Yes, we all know, technically we shouldn't be calling it classes in JavaScript. :) )

FAQs

Package last updated on 10 Nov 2013

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