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

bottlejs

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bottlejs - npm Package Compare versions

Comparing version 0.4.1 to 0.4.2

41

dist/bottle.js
;(function(undefined) {
'use strict';
/**
* BottleJS v0.4.1 - 2014-10-01
* BottleJS v0.4.2 - 2014-10-02
* A powerful, extensible dependency injection micro container

@@ -165,2 +165,30 @@ *

/**
* Named bottle instances
*
* @type Object
*/
var bottles = {};
/**
* Get an instance of bottle.
*
* If a name is provided the instance will be stored in a local hash. Calling Bottle.pop multiple
* times with the same name will return the same instance.
*
* @param String name
* @return Bottle
*/
var pop = function pop(name) {
var instance;
if (name) {
instance = bottles[name];
if (!instance) {
bottles[name] = instance = new Bottle();
}
return instance;
}
return new Bottle();
};
/**
* Map of provider constructors by index => name

@@ -298,7 +326,10 @@ *

* Bottle constructor
*
* @param String name Optional name for functional construction
*/
var Bottle = function Bottle() {
var Bottle = function Bottle(name) {
if (!(this instanceof Bottle)) {
return new Bottle();
return Bottle.pop(name);
}
this.id = id++;

@@ -324,5 +355,3 @@ this.container = {};

*/
Bottle.pop = function pop() {
return new Bottle();
};
Bottle.pop = pop;

@@ -329,0 +358,0 @@ /**

3

package.json
{
"name": "bottlejs",
"version": "0.4.1",
"version": "0.4.2",
"description": "A powerful, extensible dependency injection micro container",

@@ -34,2 +34,3 @@ "main": "dist/bottle.js",

"grunt-contrib-uglify": "^0.5.1",
"grunt-template-jasmine-istanbul": "^0.3.0",
"grunt-wrap": "^0.3.0",

@@ -36,0 +37,0 @@ "lodash": "^2.4.1"

![BottleJS](/bottle-logo.jpg)
# BottleJS [![Build Status](https://travis-ci.org/young-steveo/bottlejs.svg?branch=master)](https://travis-ci.org/young-steveo/bottlejs)
# BottleJS [![Build Status](https://travis-ci.org/young-steveo/bottlejs.svg?branch=master)](https://travis-ci.org/young-steveo/bottlejs) [![Coverage Status](https://img.shields.io/coveralls/young-steveo/bottlejs.svg)](https://coveralls.io/r/young-steveo/bottlejs)

@@ -177,4 +177,16 @@ > A powerful, extensible dependency injection micro container

### constant(name, value)
### Bottle
#### pop([name])
Used to get an instance of bottle. If a name is passed, bottle will return the same instance. Calling the Bottle constructor as a function will call and return return `Bottle.pop`, so `Bottle.pop('Soda') === Bottle('pop')`
Param | Type | Details
:--------------------------|:-----------|:--------
**name**<br />*(optional)* | The name of the bottle. If passed, bottle will store the instance internally and return the same instance if `Bottle.pop` is subsequently called with the same name.
### Bottle.prototype
#### constant(name, value)
Used to add a read only value to the container.

@@ -187,3 +199,3 @@

### decorator(name, func)
#### decorator(name, func)

@@ -197,3 +209,3 @@ Used to register a decorator function that the provider will use to modify your services at creation time.

### factory(name, Factory)
#### factory(name, Factory)

@@ -207,3 +219,3 @@ Used to register a service factory

### middleware(name, func)
#### middleware(name, func)

@@ -217,3 +229,3 @@ Used to register a middleware function. This function will be executed every time the service is accessed.

### provider(name, Provider)
#### provider(name, Provider)

@@ -227,3 +239,3 @@ Used to register a service provider

### service(name, Constructor [, dependency [, ...]])
#### service(name, Constructor [, dependency [, ...]])

@@ -238,3 +250,3 @@ Used to register a service constructor

### value(name, val)
#### value(name, val)

@@ -241,0 +253,0 @@ Used to add an arbitrary value to the container.

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