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

internal

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

internal - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

5

History.md
1.0.5 / 2016-02-02
==================
* shared context across internal action calls
1.0.4 / 2016-02-02

@@ -3,0 +8,0 @@ ==================

25

index.js

@@ -23,3 +23,3 @@ /**

if (!(this instanceof internal)) return new internal(state)
this.state = assign(actions || {}, state || {})
this.state = bind(actions, state || {})
this.queue = []

@@ -82,3 +82,4 @@ }

internal.prototype.__defineGetter__(name, function () {
var child = Child(this.state)
var child = Child()
child.state = this.state
child.queue = this.queue

@@ -122,2 +123,22 @@ return child

function bind (actions, state) {
var obj = walk(actions, function(fn) {
return fn.bind(state)
})
Object.keys(obj).forEach(function(key) {
state[key] = state[key] || obj[key]
})
return state
}
function walk (obj, fn) {
Object.keys(obj).forEach(function (key) {
if (typeof obj[key] === 'function') obj[key] = fn(obj[key])
else walk(obj[key], fn)
})
return obj
}
/**

@@ -124,0 +145,0 @@ * Prettify a function

2

package.json
{
"name": "internal",
"version": "1.0.4",
"version": "1.0.5",
"description": "internal queue for your public libraries and APIs",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -5,7 +5,16 @@ var Internal = require('../')

echo(msg, fn) {
this.redis.message(msg, fn)
this.test = 'test'
this.hi(msg, fn)
},
hi(msg, fn) {
this.test2 = 'whatever!!'
fn()
},
redis: {
message(msg, fn) {
fn(null, 'hi')
var self = this
this.echo(msg, function() {
console.log('here...')
fn(null, msg + ':' + self.test + ':' + self.test2)
})
}

@@ -17,4 +26,4 @@ }

api.echo('hi')
api.redis.message('hi')
.then(v => console.log(v))
.catch(e => console.log(e.stack))
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