-
Notifications
You must be signed in to change notification settings - Fork 698
Expand file tree
/
Copy pathcredential.js
More file actions
34 lines (30 loc) · 984 Bytes
/
credential.js
File metadata and controls
34 lines (30 loc) · 984 Bytes
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
var util = require("util");
var NodeGit = require("../");
var Credential = NodeGit.Credential;
var deprecatedFn = (method) =>
util.deprecate(
Credential[method].bind(Credential),
`Use NodeGit.Credential.${method} instead of NodeGit.Cred.${method}`
);
var createCredTypeDeprecationMessage = type =>
`Use NodeGit.Credential.TYPE.${type} instead of NodeGit.Cred.TYPE.${type}`;
NodeGit.Cred = {
defaultNew: deprecatedFn("defaultNew"),
sshKeyFromAgent: deprecatedFn("sshKeyFromAgent"),
sshKeyNew: deprecatedFn("sshKeyNew"),
sshKeyMemoryNew: deprecatedFn("sshKeyMemoryNew"),
usernameNew: deprecatedFn("usernameNew"),
userpassPlaintextNew: deprecatedFn("userpassPlaintextNew"),
TYPE: Object.keys(Credential.TYPE).reduce(
(type, key) => {
Object.defineProperty(type, key, {
get: util.deprecate(
() => Credential.TYPE[key],
createCredTypeDeprecationMessage(type)
)
});
return type;
},
{}
)
};