FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
nodegit/generate/scripts/utils.js at v0.3.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
/
generate
/
scripts
/
utils.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
67 lines (54 loc) · 1.45 KB
Breadcrumbs
nodegit
/
generate
/
scripts
/
utils.js
Copy path
File metadata and controls
67 lines (54 loc) · 1.45 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
const
promisify
=
require
(
"promisify-node"
)
;
const
fse
=
require
(
"fs-extra"
)
;
const
fs
=
require
(
"fs"
)
;
const
path
=
require
(
"path"
)
;
// Make a locally bound path joiner, (bound to generate).
var
local
=
path
.
join
.
bind
(
null
,
__dirname
,
"../"
)
;
var
util
=
{
pointerRegex
:
/
\s
*
\*
\s
*
/
,
doublePointerRegex
:
/
\s
*
\*
\*
\s
*
/
,
readFile
:
function
(
file
)
{
try
{
return
fs
.
readFileSync
(
local
(
file
)
)
.
toString
(
)
;
}
catch
(
unhandledException
)
{
return
""
;
}
}
,
writeFile
:
function
(
file
,
content
)
{
try
{
var
file
=
local
(
file
)
;
if
(
typeof
content
==
"object"
)
{
content
=
JSON
.
stringify
(
content
,
null
,
2
)
}
fse
.
ensureFileSync
(
file
)
;
fse
.
writeFileSync
(
file
,
content
)
;
return
true
;
}
catch
(
exception
)
{
return
false
;
}
}
,
titleCase
:
function
(
str
)
{
return
str
.
split
(
/
_
|
\/
/
)
.
map
(
function
(
val
,
index
)
{
if
(
val
.
length
)
{
return
val
[
0
]
.
toUpperCase
(
)
+
val
.
slice
(
1
)
;
}
return
val
;
}
)
.
join
(
""
)
;
}
,
camelCase
:
function
(
str
)
{
return
str
.
split
(
/
_
|
\/
/
)
.
map
(
function
(
val
,
index
)
{
return
(
index
>=
1
?
val
[
0
]
.
toUpperCase
(
)
+
val
.
slice
(
1
)
:
val
[
0
]
.
toLowerCase
(
)
+
val
.
slice
(
1
)
)
;
}
)
.
join
(
""
)
;
}
,
isPointer
:
function
(
type
)
{
return
util
.
pointerRegex
.
test
(
type
)
||
util
.
doublePointerRegex
.
test
(
type
)
;
}
,
isDoublePointer
:
function
(
type
)
{
return
util
.
doublePointerRegex
.
test
(
type
)
;
}
}
;
module
.
exports
=
util
;
Back
|
FazBrowse Home
|
New Git URL