-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
49 lines (34 loc) · 1.05 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
'use strict'
const { URL } = require('url')
// const pkgURI = new URL()
const registryUrl = require('registry-url');
// console.log(registryUrl());
class packageNotFound extends Error{
constructor(packageName){
super(`package \` ${packageName} \` could not be found`)
this.name = `packageNotFound`
}
}
class packageVersionNotFound extends Error {
constructor(packageName , version){
super(`version \`${version}\` for package \` ${packageName} \` could not be found `)
this.name = `packageVersionNotFound`
}
}
const name = '@Usamaliaquat123/45'
const scope = name.split('/')[0];
const regUrl = registryUrl(scope);
const pkgUrl = new URL(encodeURIComponent(name).replace(/^%40/, '@'), regUrl);
const headers = {
accept : 'application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*'
}
async () => {
await delete headers.accept
console.log(headers.accept)
}
// module.exports = async (name,options) => {
// options = {
// version = 'latest',
// ...options
// }
// }