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

think-instance

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

think-instance - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

2

package.json
{
"name": "think-instance",
"description": "add .getInstance method for class",
"version": "1.0.0",
"version": "1.0.1",
"author": {

@@ -6,0 +6,0 @@ "name": "welefen",

# think-instance
[![Build Status](https://travis-ci.org/thinkjs/think-instance.svg?branch=master)](https://travis-ci.org/thinkjs/think-instance)
[![Coverage Status](https://coveralls.io/repos/github/thinkjs/think-instance/badge.svg)](https://coveralls.io/github/thinkjs/think-instance)
[![npm](https://img.shields.io/npm/v/think-instance.svg)](https://www.npmjs.com/package/think-instance)
## Install

@@ -4,0 +8,0 @@

@@ -109,3 +109,21 @@ import test from 'ava';

test('get instance, set max & close 3', t => {
let close = 0;
let cls = class {
constructor(index){
this.index = index;
}
close(){
close += this.index;
}
}
cls = thinkInstance(cls, 1, 'close');
const instance1 = cls.getInstance(2);
const instance2 = cls.getInstance(3);
const instance3 = cls.getInstance(4);
t.is(close, 5);
});
test('get instance with multi args', t => {

@@ -112,0 +130,0 @@ let cls = class {

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