Socket
Socket
Sign inDemoInstall

npm-profile

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

npm-profile - npm Package Compare versions

Comparing version 2.0.2 to 2.0.3

32

index.js
'use strict'
const fetch = require('make-fetch-happen')
const fetch = require('make-fetch-happen').defaults({retry: false})
const validate = require('aproba')

@@ -54,6 +54,24 @@ const url = require('url')

const target = url.resolve(conf.registry, '-/user/org.couchdb.user:' + encodeURIComponent(username))
return fetchJSON(Object.assign({method: 'PUT', target: target, body: userobj}, conf)).catch(err => {
if (err.code === 'E400') err.message = `There is no user with the username "${username}".`
throw err
if (err.code !== 'E409') throw err
return fetchJSON(Object.assign({method: 'GET', target: target + '?write=true'}, conf)).then(result => {
Object.keys(result).forEach(function (k) {
if (!userobj[k] || k === 'roles') {
userobj[k] = result[k]
}
})
const req = {
method: 'PUT',
target: target + '/-rev/' + userobj._rev,
body: useroby,
auth: {
basic: {
username: username,
password: password
}
}
}
return fetchJSON(Object.assign({}, conf, req))
})
})

@@ -165,3 +183,9 @@ }

} else {
return res.buffer().then(content => [res, content])
return res.buffer().then(content => {
try {
return [res, JSON.parse(content)]
} catch (_) {
return [res, content]
}
})
}

@@ -168,0 +192,0 @@ }).then(result => {

2

package.json
{
"name": "npm-profile",
"version": "2.0.2",
"version": "2.0.3",
"description": "Library for updating an npmjs.com profile",

@@ -5,0 +5,0 @@ "keywords": [],

# npm-profile
Updating an npmjs.com profile
Provides functions for fetching and updating an npmjs.com profile.

@@ -12,2 +12,7 @@ ```js

The API that this implements is documented here:
* [authentication](https://github.com/npm/registry/blob/master/docs/user/authentication.md)
* [profile editing](https://github.com/npm/registry/blob/master/docs/user/profile.md) (and two-factor authentication)
## Functions

@@ -14,0 +19,0 @@

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