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

normalize-agent

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

normalize-agent - npm Package Compare versions

Comparing version 0.1.8 to 0.1.9

26

lib/shorthand.js

@@ -6,2 +6,4 @@

var slice = [].slice
Agent.prototype.shorthands =

@@ -13,1 +15,25 @@ Agent.prototype.shorthand = function* (str) {

}
Agent.prototype.shorten = function* (remote) {
var shorthand = this._shorthand
|| (this._shorthand = shorthands(yield* this.proxy()))
var args = slice.call(arguments)
if (typeof remote === 'string') {
var proxy = yield* this.proxy()
var remotes = proxy.remotes
for (var i = 0; i < remotes.length; i++) {
var _remote = remotes[i]
if (~_remote.aliases.indexOf(remote)) {
args[0] = remote = _remote
break
}
}
if (typeof remote === 'string') {
throw new Error('unknown remote: ' + remote)
}
}
return shorthand.js.apply(null, args)
}

2

package.json
{
"name": "normalize-agent",
"description": "SPDY client for normalize-proxy",
"version": "0.1.8",
"version": "0.1.9",
"author": {

@@ -6,0 +6,0 @@ "name": "Jonathan Ong",

@@ -17,1 +17,17 @@

})
describe('.shorten()', function () {
describe('npm', co(function* () {
it('/npm/-/emitter/1/index.js', co(function* () {
var shorthand = yield* agent.shorten('npm', '-', 'emitter', '1', 'index.js')
shorthand.should.equal('emitter@1')
}))
}))
describe('github', co(function* () {
it('/github/component/emitter/1/index.js', co(function* () {
var shorthand = yield* agent.shorten('github', 'component', 'emitter', '1', 'index.js')
shorthand.should.equal('component/emitter@1')
}))
}))
})
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