New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

demolish

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

demolish

Generate a destruction method which clean's up and destroys all references on the instance

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
380
decreased by-0.26%
Maintainers
1
Weekly downloads
 
Created
Source

demolish

Made by unshiftVersion npmBuild StatusDependenciesCoverage StatusIRC channel

Demolish is a small module which helps you clean up, release and destroy your created instances.

Install

This module is intended for Node.js and browserify usage and can be installed using:

npm install --save demolish

Usage

The module is exported as function and be required as following:

'use strict';

var demolish = require('demolish');

The demolish function returns a function which will destroy the specified properties from your instance.

function Foo() {
  this.bar = 1;
  this.banana = new Banana();
}

Foo.prototype.destroy = demolish('foo banana');

In the example above we've created a new destroy method on our Foo class. Once the method is called it will set the bar property to null and check if banana also has a destroy method, if so, it will call that and set it to null after execution.

After everything is cleaned we will emit a destroy event if there is an emit method available.

The destroy method will automatically prevent double execution by checking if the first supplied property is still active on the prototype. So in the example above it will check if foo is not null.

License

MIT

Keywords

FAQs

Package last updated on 28 Dec 2014

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