@@ -459,34 +459,38 @@ GitStats.prototype.calendar = function (data, callback) {
459459 *
460460 * @name ansiCalendar
461461 * @function
462- * @param {Object } data The object passed to the `calendar` method.
462+ * @param {Object } options The object passed to the `calendar` method.
463463 * @param {Function } callback The callback function.
464464 * @return {GitStats } The `GitStats` instance.
465465 */
466- GitStats . prototype . ansiCalendar = function ( data , callback ) {
466+ GitStats . prototype . ansiCalendar = function ( options , callback ) {
467467
468- if ( typeof data === "function" ) {
469- callback = data ;
470- data = undefined ;
468+ if ( typeof options === "function" ) {
469+ callback = options ;
470+ options = undefined ;
471471 }
472472
473473 var self = this ;
474474
475- self . graph ( data , function ( err , graph ) {
476- var cal = [ ] ;
475+ self . graph ( options , function ( err , graph ) {
476+ var cal = [ ]
477+ , data = {
478+ theme : options . theme
479+ , start : options . start
480+ , end : options . end
481+ , firstDay : options . firstDay
482+ , cal : cal
483+ }
484+ ;
477485
478- self . iterateDays ( data , function ( cDay ) {
486+ self . iterateDays ( options , function ( cDay ) {
479487 cDayObj = graph [ cDay ] ;
480488 if ( ! cDayObj ) { return ; }
481489 cal . push ( [ cDay , cDayObj . c ] ) ;
482490 } ) ;
483491
484- callback ( null , CliGhCal ( cal , {
485- theme : data . theme
486- , start : data . start
487- , end : data . end
488- , firstDay : data . firstDay
489- } ) ) ;
492+
493+ callback ( null , options . raw ? data : CliGhCal ( cal , data ) ) ;
490494 } ) ;
491495
492496 return self ;
@@ -535,6 +539,7 @@ GitStats.prototype.authors = function (options, callback) {
535539 * - `repo` (String): The repository path.
536540 * - `radius` (Number): The pie radius.
537541 * - `no_ansi` (Boolean): If `true`, the pie will not contain ansi characters.
542+ * - `raw` (Boolean): If `true`, the raw JSON will be displayed.
538543 *
539544 * @param {Function } callback The callback function.
540545 * @return {GitStats } The `GitStats` instance.
@@ -574,13 +579,14 @@ GitStats.prototype.authorsPie = function (options, callback) {
574579 authors . push ( others ) ;
575580 }
576581
577- pie = new CliPie ( options . radius , authors , {
582+ var data = {
578583 legend : true
579584 , flat : true
580585 , no_ansi : options . no_ansi
581- } ) ;
586+ , authors : authors
587+ } ;
582588
583- callback ( null , pie . toString ( ) ) ;
589+ callback ( null , options . raw ? data : new CliPie ( options . radius , authors , data ) . toString ( ) ) ;
584590 } ) ;
585591
586592 return self ;
@@ -598,6 +604,7 @@ GitStats.prototype.authorsPie = function (options, callback) {
598604 * - `start` (String): The start date.
599605 * - `end` (String): The end date.
600606 * - `theme` (String|Object): The calendar theme.
607+ * - `raw` (Boolean): If `true`, the raw JSON will be displayed.
601608 *
602609 * @param {Function } callback The callback function.
603610 * @return {GitStats } The `GitStats` instance.
@@ -632,11 +639,13 @@ GitStats.prototype.globalActivity = function (options, callback) {
632639 Object . keys ( commits ) . forEach ( function ( c ) {
633640 cal . push ( [ c , commits [ c ] ] )
634641 } ) ;
635- callback ( null , CliGhCal ( cal , {
642+ var data = {
636643 theme : options . theme
637644 , start : options . start
638645 , end : options . end
639- } ) ) ;
646+ , cal : cal
647+ } ;
648+ callback ( null , options . raw ? data : CliGhCal ( cal , data ) ) ;
640649 } ) ;
641650
642651 return this ;
0 commit comments