FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
nodegit/lib/nodegit.js at v0.2.2 · nodegit/nodegit · GitHub
nodegit
nodegit
Repository navigation
Code
Issues
344
(344)
Pull requests
21
(21)
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
nodegit
/
lib
/
nodegit.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
82 lines (71 loc) · 2.04 KB
Breadcrumbs
nodegit
/
lib
/
nodegit.js
Copy path
File metadata and controls
82 lines (71 loc) · 2.04 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
var
Promise
=
require
(
"nodegit-promise"
)
;
var
promisify
=
require
(
"promisify-node"
)
;
var
descriptors
=
require
(
"../generate/idefs.json"
)
;
var
rawApi
;
// Attempt to load the production release first, if it fails fall back to the
// debug release.
try
{
rawApi
=
require
(
"../build/Release/nodegit"
)
;
}
catch
(
e
)
{
/* istanbul ignore next */
rawApi
=
require
(
"../build/Debug/nodegit"
)
;
}
// Native methods do not return an identifiable function, so this function will
// filter down the function identity to match the libgit2 descriptor.
descriptors
.
forEach
(
function
(
descriptor
)
{
if
(
descriptor
.
type
==
"enum"
)
{
return
;
}
var
Ctor
=
rawApi
[
descriptor
.
jsClassName
]
;
// Iterate over each function in the file.
descriptor
.
functions
.
filter
(
function
(
func
)
{
return
func
.
isAsync
;
}
)
.
forEach
(
function
(
asyncFunc
)
{
var
original
=
null
;
// Special case when you have a prototype method.
if
(
asyncFunc
.
isPrototypeMethod
&&
Ctor
.
prototype
)
{
original
=
Ctor
.
prototype
[
asyncFunc
.
jsFunctionName
]
;
Ctor
.
prototype
[
asyncFunc
.
jsFunctionName
]
=
promisify
(
original
)
;
}
else
{
original
=
Ctor
[
asyncFunc
.
jsFunctionName
]
;
Ctor
[
asyncFunc
.
jsFunctionName
]
=
promisify
(
original
)
;
}
}
)
;
}
)
;
// Set the exports prototype to the raw API.
exports
.
__proto__
=
rawApi
;
// Import extensions
require
(
"./attr"
)
;
require
(
"./blob"
)
;
require
(
"./clone"
)
;
require
(
"./checkout"
)
;
require
(
"./commit"
)
;
require
(
"./diff"
)
;
require
(
"./index"
)
;
require
(
"./merge"
)
;
require
(
"./object"
)
;
require
(
"./odb"
)
;
require
(
"./odb_object"
)
;
require
(
"./oid"
)
;
require
(
"./patch"
)
;
require
(
"./reference"
)
;
require
(
"./remote"
)
;
require
(
"./revwalk"
)
;
require
(
"./repository"
)
;
require
(
"./revwalk"
)
;
require
(
"./signature"
)
;
require
(
"./status"
)
;
require
(
"./tree"
)
;
require
(
"./tree_entry"
)
;
//must go last!
require
(
"./enums"
)
;
// Wrap asynchronous methods to return promises.
promisify
(
exports
)
;
// Set version.
exports
.
version
=
require
(
"../package"
)
.
version
;
// Expose Promise implementation.
exports
.
Promise
=
Promise
;
// Initialize threads.
exports
.
Threads
.
init
(
)
;
Back
|
FazBrowse Home
|
New Git URL