Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
variety
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fact-gitdep
variety
Commits
98eb5224
Commit
98eb5224
authored
Oct 30, 2014
by
Tomas Dvorak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jshint validation fixes
parent
757550aa
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
variety.js
variety.js
+7
-7
No files found.
variety.js
View file @
98eb5224
...
@@ -62,7 +62,7 @@ print('Using maxDepth of ' + maxDepth);
...
@@ -62,7 +62,7 @@ print('Using maxDepth of ' + maxDepth);
if
(
typeof
sort
===
'undefined'
)
{
var
sort
=
{
_id
:
-
1
};
}
if
(
typeof
sort
===
'undefined'
)
{
var
sort
=
{
_id
:
-
1
};
}
print
(
'Using sort of '
+
tojson
(
sort
));
print
(
'Using sort of '
+
tojson
(
sort
));
if
(
typeof
outputFormat
===
'undefined'
)
{
var
outputFormat
=
"ascii"
}
if
(
typeof
outputFormat
===
'undefined'
)
{
var
outputFormat
=
"ascii"
;
}
print
(
'Using outputFormat of '
+
outputFormat
);
print
(
'Using outputFormat of '
+
outputFormat
);
...
@@ -226,16 +226,16 @@ if(outputFormat === 'json') {
...
@@ -226,16 +226,16 @@ if(outputFormat === 'json') {
}
else
{
// output nice ascii table with results
}
else
{
// output nice ascii table with results
var
table
=
[[
"key"
,
"types"
,
"occurrences"
,
"percents"
],
[
""
,
""
,
""
,
""
]];
// header + delimiter rows
var
table
=
[[
"key"
,
"types"
,
"occurrences"
,
"percents"
],
[
""
,
""
,
""
,
""
]];
// header + delimiter rows
sortedKeys
.
forEach
(
function
(
key
)
{
sortedKeys
.
forEach
(
function
(
key
)
{
table
.
push
([
key
.
_id
.
key
,
key
.
value
.
types
.
toString
(),
key
.
totalOccurrences
,
key
.
percentContaining
])
table
.
push
([
key
.
_id
.
key
,
key
.
value
.
types
.
toString
(),
key
.
totalOccurrences
,
key
.
percentContaining
])
;
});
});
function
colMaxWidth
(
arr
,
index
)
{
var
colMaxWidth
=
function
(
arr
,
index
)
{
return
Math
.
max
.
apply
(
null
,
arr
.
map
(
function
(
row
){
return
row
[
index
].
toString
().
length
}));
return
Math
.
max
.
apply
(
null
,
arr
.
map
(
function
(
row
){
return
row
[
index
].
toString
().
length
;
}));
}
}
;
function
pad
(
width
,
string
,
symbol
)
{
return
(
width
<=
string
.
length
)
?
string
:
pad
(
width
,
string
+
symbol
,
symbol
);
}
var
pad
=
function
(
width
,
string
,
symbol
)
{
return
(
width
<=
string
.
length
)
?
string
:
pad
(
width
,
string
+
symbol
,
symbol
);
};
table
.
forEach
(
function
(
row
,
ri
){
table
.
forEach
(
function
(
row
,
ri
){
print
(
"| "
+
row
.
map
(
function
(
cell
,
i
)
{
return
pad
(
colMaxWidth
(
table
,
i
),
cell
,
ri
==
1
?
"-"
:
" "
)}).
join
(
" | "
)
+
" |"
);
print
(
"| "
+
row
.
map
(
function
(
cell
,
i
)
{
return
pad
(
colMaxWidth
(
table
,
i
),
cell
,
ri
==
1
?
"-"
:
" "
)
;
}).
join
(
" | "
)
+
" |"
);
});
});
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment