Comparing version 0.1.6 to 0.1.7
@@ -8,3 +8,3 @@ // Generated by CoffeeScript 1.3.3 | ||
} else { | ||
moment = window.moment; | ||
moment = this.moment; | ||
} | ||
@@ -11,0 +11,0 @@ |
// Generated by CoffeeScript 1.3.3 | ||
((function(){var a,b,c;typeof module!="undefined"?c=require("moment"):c=window.moment;if(typeof c=="undefined")throw"Can't find moment";a=function(){function a(a,b,d){this.start=c(a),this.end=c(b),this.allDay=d||!1}return a.prototype.sameDay=function(){return this.start.year()===this.end.year()&&this.start.month()===this.end.month()&&this.start.date()===this.end.date()},a.prototype.sameYear=function(){return this.start.year()===this.end.year()},a.prototype.countDays=function(){var a,b;return b=this.start.clone().startOf("day"),a=this.end.clone().startOf("day"),a.diff(b,"days")+1},a.prototype.daysIn=function(a){var b,c,d,e=this;return d=this.start.clone().startOf("day"),b=this.end.clone().startOf("day"),c=function(){return d<=b&&(!a||d.valueOf()!==b.valueOf()||e.end.hours()>a||e.allDay)},{next:function(){var a;return c()?(a=d.clone(),d.add("days",1),a):null},hasNext:c}},a.prototype.duration=function(){return this.allDay?this.sameDay()?"all day":this.start.from(this.end.clone().add("days",1),!0):this.start.from(this.end,!0)},a.prototype.past=function(){return this.allDay?this.end.clone().endOf("day")<c():this.end<c()},a.prototype.overlaps=function(a){return!(this._trueEnd()<a._trueStart()||this._trueStart()>a._trueEnd())},a.prototype.engulfs=function(a){return this._trueStart()<=a._trueStart()&&this._trueEnd()>=a._trueEnd()},a.prototype.merge=function(b){var c,d,e;return c=this.allDay&&b.allDay,c?(e=this.start<b.start?this.start:b.start,d=this.end>b.end?this.end:b.end):(e=this._trueStart()<b._trueStart()?this._trueStart():b._trueStart(),d=this._trueEnd()>b._trueEnd()?this._trueEnd():b._trueEnd()),new a(e,d,c)},a.prototype._trueStart=function(){return this.allDay?this.start.clone().startOf("day"):this.start},a.prototype._trueEnd=function(){return this.allDay?this.end.clone().endOf("day"):this.end},a.prototype.equals=function(b){return b instanceof a&&this.allDay===b.allDay&&this.start.valueOf()===b.start.valueOf()&&this.end.valueOf()===b.end.valueOf()},a.prototype.format=function(a){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r=this;l={groupMeridiems:!0,spaceBeforeMeridiem:!0,showDate:!0,showDayOfWeek:!1,twentyFourHour:!1,implicitMinutes:!0,yearFormat:"YYYY",monthFormat:"MMM",weekdayFormat:"ddd",dayFormat:"D",meridiemFormat:"A",hourFormat:"h",minuteFormat:"mm",allDay:"all day",explicitAllDay:!1,lastNightEndsAt:0},b(l,a||{}),h=[],l.twentyFourHour&&(l.hourFormat=l.hourFormat.replace("h","H")),j=l.lastNightEndsAt>0&&!this.allDay&&this.end.clone().startOf("day").valueOf()===this.start.clone().add("days",1).startOf("day").valueOf()&&this.start.hours()>12&&this.end.hours()<l.lastNightEndsAt,k=l.showDate||!this.sameDay()&&!j,this.allDay&&this.sameDay()&&(!l.showDate||l.explicitAllDay)&&h.push({name:"all day simple",fn:function(){return l.allDay},slot:0,pre:" "}),k&&(this.start.year()!==c().year()||!this.sameYear())&&h.push({name:"year",fn:function(a){return a.format(l.yearFormat)},pre:", ",slot:4}),!this.allDay&&k&&h.push({name:"all day month",fn:function(a){return a.format(""+l.monthFormat+" "+l.dayFormat)},ignoreEnd:function(){return j},slot:2,pre:" "}),this.allDay&&k&&h.push({name:"month",fn:function(a){return a.format("MMM")},slot:2,pre:" "}),this.allDay&&k&&h.push({name:"date",fn:function(a){return a.format(l.dayFormat)},slot:3,pre:" "}),k&&l.showDayOfWeek&&h.push({name:"day of week",fn:function(a){return a.format(l.weekdayFormat)},pre:" ",slot:1}),l.groupMeridiems&&!l.twentyFourHour&&!this.allDay&&h.push({name:"meridiem",fn:function(a){return a.format(l.meridiemFormat)},slot:6,pre:l.spaceBeforeMeridiem?" ":""}),this.allDay||h.push({name:"time",fn:function(a){var b;return b=a.minutes()===0&&l.implicitMinutes&&!l.twentyFourHour?a.format(l.hourFormat):a.format(""+l.hourFormat+":"+l.minuteFormat),!l.groupMeridiems&&!l.twentyFourHour&&(l.spaceBeforeMeridiem&&(b+=" "),b+=a.format(l.meridiemFormat)),b},pre:", ",slot:5}),n=[],e=[],d=[],o=!0,m=function(a){var b,c,g;return g=a.fn(r.start),b=a.ignoreEnd&&a.ignoreEnd()?g:a.fn(r.end),c={format:a,value:function(){return g}},b===g&&o?d.push(c):(o&&(o=!1,d.push({format:{slot:a.slot,pre:""},value:function(){return""+f(n)+" -"+f(e,!0)}})),n.push(c),e.push({format:a,value:function(){return b}}))};for(p=0,q=h.length;p<q;p++)g=h[p],m(g);return i=!0,f=function(a,b){var c,d,e,f,g,h;c=!0,e="",h=a.sort(function(a,b){return a.format.slot-b.format.slot});for(f=0,g=h.length;f<g;f++)d=h[f],i||(c&&b?e+=" ":e+=d.format.pre),e+=d.value(),i=!1,c=!1;return e},f(d)},a}(),b=function(a,b){var c,d;d=[];for(c in b)typeof b[c]!="undefined"?d.push(a[c]=b[c]):d.push(void 0);return d},typeof module!="undefined"?module.exports=a:window.Twix=a,c.twix=function(){return function(a,b,c){c.prototype=a.prototype;var d=new c,e=a.apply(d,b),f=typeof e;return f=="object"||f=="function"?e||d:d}(a,arguments,function(){})}})).call(this); | ||
((function(){var a,b,c;typeof module!="undefined"?c=require("moment"):c=this.moment;if(typeof c=="undefined")throw"Can't find moment";a=function(){function a(a,b,d){this.start=c(a),this.end=c(b),this.allDay=d||!1}return a.prototype.sameDay=function(){return this.start.year()===this.end.year()&&this.start.month()===this.end.month()&&this.start.date()===this.end.date()},a.prototype.sameYear=function(){return this.start.year()===this.end.year()},a.prototype.countDays=function(){var a,b;return b=this.start.clone().startOf("day"),a=this.end.clone().startOf("day"),a.diff(b,"days")+1},a.prototype.daysIn=function(a){var b,c,d,e=this;return d=this.start.clone().startOf("day"),b=this.end.clone().startOf("day"),c=function(){return d<=b&&(!a||d.valueOf()!==b.valueOf()||e.end.hours()>a||e.allDay)},{next:function(){var a;return c()?(a=d.clone(),d.add("days",1),a):null},hasNext:c}},a.prototype.duration=function(){return this.allDay?this.sameDay()?"all day":this.start.from(this.end.clone().add("days",1),!0):this.start.from(this.end,!0)},a.prototype.past=function(){return this.allDay?this.end.clone().endOf("day")<c():this.end<c()},a.prototype.overlaps=function(a){return!(this._trueEnd()<a._trueStart()||this._trueStart()>a._trueEnd())},a.prototype.engulfs=function(a){return this._trueStart()<=a._trueStart()&&this._trueEnd()>=a._trueEnd()},a.prototype.merge=function(b){var c,d,e;return c=this.allDay&&b.allDay,c?(e=this.start<b.start?this.start:b.start,d=this.end>b.end?this.end:b.end):(e=this._trueStart()<b._trueStart()?this._trueStart():b._trueStart(),d=this._trueEnd()>b._trueEnd()?this._trueEnd():b._trueEnd()),new a(e,d,c)},a.prototype._trueStart=function(){return this.allDay?this.start.clone().startOf("day"):this.start},a.prototype._trueEnd=function(){return this.allDay?this.end.clone().endOf("day"):this.end},a.prototype.equals=function(b){return b instanceof a&&this.allDay===b.allDay&&this.start.valueOf()===b.start.valueOf()&&this.end.valueOf()===b.end.valueOf()},a.prototype.format=function(a){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r=this;l={groupMeridiems:!0,spaceBeforeMeridiem:!0,showDate:!0,showDayOfWeek:!1,twentyFourHour:!1,implicitMinutes:!0,yearFormat:"YYYY",monthFormat:"MMM",weekdayFormat:"ddd",dayFormat:"D",meridiemFormat:"A",hourFormat:"h",minuteFormat:"mm",allDay:"all day",explicitAllDay:!1,lastNightEndsAt:0},b(l,a||{}),h=[],l.twentyFourHour&&(l.hourFormat=l.hourFormat.replace("h","H")),j=l.lastNightEndsAt>0&&!this.allDay&&this.end.clone().startOf("day").valueOf()===this.start.clone().add("days",1).startOf("day").valueOf()&&this.start.hours()>12&&this.end.hours()<l.lastNightEndsAt,k=l.showDate||!this.sameDay()&&!j,this.allDay&&this.sameDay()&&(!l.showDate||l.explicitAllDay)&&h.push({name:"all day simple",fn:function(){return l.allDay},slot:0,pre:" "}),k&&(this.start.year()!==c().year()||!this.sameYear())&&h.push({name:"year",fn:function(a){return a.format(l.yearFormat)},pre:", ",slot:4}),!this.allDay&&k&&h.push({name:"all day month",fn:function(a){return a.format(""+l.monthFormat+" "+l.dayFormat)},ignoreEnd:function(){return j},slot:2,pre:" "}),this.allDay&&k&&h.push({name:"month",fn:function(a){return a.format("MMM")},slot:2,pre:" "}),this.allDay&&k&&h.push({name:"date",fn:function(a){return a.format(l.dayFormat)},slot:3,pre:" "}),k&&l.showDayOfWeek&&h.push({name:"day of week",fn:function(a){return a.format(l.weekdayFormat)},pre:" ",slot:1}),l.groupMeridiems&&!l.twentyFourHour&&!this.allDay&&h.push({name:"meridiem",fn:function(a){return a.format(l.meridiemFormat)},slot:6,pre:l.spaceBeforeMeridiem?" ":""}),this.allDay||h.push({name:"time",fn:function(a){var b;return b=a.minutes()===0&&l.implicitMinutes&&!l.twentyFourHour?a.format(l.hourFormat):a.format(""+l.hourFormat+":"+l.minuteFormat),!l.groupMeridiems&&!l.twentyFourHour&&(l.spaceBeforeMeridiem&&(b+=" "),b+=a.format(l.meridiemFormat)),b},pre:", ",slot:5}),n=[],e=[],d=[],o=!0,m=function(a){var b,c,g;return g=a.fn(r.start),b=a.ignoreEnd&&a.ignoreEnd()?g:a.fn(r.end),c={format:a,value:function(){return g}},b===g&&o?d.push(c):(o&&(o=!1,d.push({format:{slot:a.slot,pre:""},value:function(){return""+f(n)+" -"+f(e,!0)}})),n.push(c),e.push({format:a,value:function(){return b}}))};for(p=0,q=h.length;p<q;p++)g=h[p],m(g);return i=!0,f=function(a,b){var c,d,e,f,g,h;c=!0,e="",h=a.sort(function(a,b){return a.format.slot-b.format.slot});for(f=0,g=h.length;f<g;f++)d=h[f],i||(c&&b?e+=" ":e+=d.format.pre),e+=d.value(),i=!1,c=!1;return e},f(d)},a}(),b=function(a,b){var c,d;d=[];for(c in b)typeof b[c]!="undefined"?d.push(a[c]=b[c]):d.push(void 0);return d},typeof module!="undefined"?module.exports=a:window.Twix=a,c.twix=function(){return function(a,b,c){c.prototype=a.prototype;var d=new c,e=a.apply(d,b),f=typeof e;return f=="object"||f=="function"?e||d:d}(a,arguments,function(){})}})).call(this); |
{ | ||
"name": "twix", | ||
"version": "0.1.6", | ||
"version": "0.1.7", | ||
"description": "Twix.js allows you to work with date ranges", | ||
@@ -15,3 +15,3 @@ "homepage": "https://github.com/icambron/twix.js", | ||
}, | ||
"main": "lib/twix", | ||
"main": "bin/twix", | ||
"test": "make test", | ||
@@ -18,0 +18,0 @@ "engines": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
0
165581