Added compiled JavaScript to repository for GitHub pages
This feels like a mistake...
This commit is contained in:
parent
3d5a2fb322
commit
dc226b1f25
468 changed files with 212152 additions and 2 deletions
|
|
@ -0,0 +1,73 @@
|
|||
(ns cljs-time.internal.core
|
||||
(:refer-clojure :exclude [=])
|
||||
(:require
|
||||
[clojure.string :as string]
|
||||
[goog.string :as gstring]
|
||||
[goog.string.format]))
|
||||
|
||||
(defn = [& args]
|
||||
(cond (every? #(instance? goog.date.Date %) args)
|
||||
(apply cljs.core/= (map #(.getTime %) args))
|
||||
:default (apply cljs.core/= args)))
|
||||
|
||||
(defn leap-year? [y]
|
||||
(cond (zero? (mod y 400)) true
|
||||
(zero? (mod y 100)) false
|
||||
(zero? (mod y 4)) true
|
||||
:else false))
|
||||
|
||||
(def days-in-month [31 28 31 30 31 30 31 31 30 31 30 31])
|
||||
|
||||
(defn year-corrected-dim [year month]
|
||||
(cond-> (days-in-month (if (= month 1) 11 (dec month)))
|
||||
(and (leap-year? year) (= month 2)) inc))
|
||||
|
||||
(defn valid-date?
|
||||
[{:keys [years months days hours minutes seconds millis] :as d}]
|
||||
(let [months (inc months)]
|
||||
(if (and years
|
||||
(<= 1 months 12)
|
||||
(<= 1 days (year-corrected-dim years months))
|
||||
(<= 0 hours 23)
|
||||
(<= 0 minutes 59)
|
||||
(<= 0 seconds 60)
|
||||
(<= 0 millis 999))
|
||||
d
|
||||
(throw (ex-info "Date is not valid" {:type :invalid-date :date d})))))
|
||||
|
||||
(defn index-of [coll x]
|
||||
(first (keep-indexed #(when (= %2 x) %1) coll)))
|
||||
|
||||
(defn format
|
||||
"Formats a string using goog.string.format."
|
||||
[fmt & args]
|
||||
(let [args (map (fn [x]
|
||||
(if (or (keyword? x) (symbol? x))
|
||||
(str x)
|
||||
x))
|
||||
args)]
|
||||
(apply gstring/format fmt args)))
|
||||
|
||||
(defn zero-pad
|
||||
"Remove the need to pull in gstring/format code in advanced compilation"
|
||||
([n] (if (<= 0 n 9) (str "0" n) (str n)))
|
||||
([n zeros]
|
||||
; No need to handle negative numbers
|
||||
(if (> 1 zeros)
|
||||
(str n)
|
||||
(str (string/join (take (- zeros (count (str n))) (repeat "0")))
|
||||
n))))
|
||||
|
||||
(defn multiplied-by [period scalar]
|
||||
(letfn [(scale-fn [field]
|
||||
(when field
|
||||
(* field scalar)))]
|
||||
(-> period
|
||||
(update-in [:millis] scale-fn)
|
||||
(update-in [:seconds] scale-fn)
|
||||
(update-in [:minutes] scale-fn)
|
||||
(update-in [:hours] scale-fn)
|
||||
(update-in [:days] scale-fn)
|
||||
(update-in [:weeks] scale-fn)
|
||||
(update-in [:months] scale-fn)
|
||||
(update-in [:years] scale-fn))))
|
||||
File diff suppressed because one or more lines are too long
216
resources/public/js/compiled/out/cljs_time/internal/core.js
Normal file
216
resources/public/js/compiled/out/cljs_time/internal/core.js
Normal file
|
|
@ -0,0 +1,216 @@
|
|||
// Compiled by ClojureScript 1.9.229 {}
|
||||
goog.provide('cljs_time.internal.core');
|
||||
goog.require('cljs.core');
|
||||
goog.require('clojure.string');
|
||||
goog.require('goog.string');
|
||||
goog.require('goog.string.format');
|
||||
cljs_time.internal.core._EQ_ = (function cljs_time$internal$core$_EQ_(var_args){
|
||||
var args__26212__auto__ = [];
|
||||
var len__26205__auto___31798 = arguments.length;
|
||||
var i__26206__auto___31799 = (0);
|
||||
while(true){
|
||||
if((i__26206__auto___31799 < len__26205__auto___31798)){
|
||||
args__26212__auto__.push((arguments[i__26206__auto___31799]));
|
||||
|
||||
var G__31800 = (i__26206__auto___31799 + (1));
|
||||
i__26206__auto___31799 = G__31800;
|
||||
continue;
|
||||
} else {
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
var argseq__26213__auto__ = ((((0) < args__26212__auto__.length))?(new cljs.core.IndexedSeq(args__26212__auto__.slice((0)),(0),null)):null);
|
||||
return cljs_time.internal.core._EQ_.cljs$core$IFn$_invoke$arity$variadic(argseq__26213__auto__);
|
||||
});
|
||||
|
||||
cljs_time.internal.core._EQ_.cljs$core$IFn$_invoke$arity$variadic = (function (args){
|
||||
if(cljs.core.every_QMARK_.call(null,(function (p1__31795_SHARP_){
|
||||
return (p1__31795_SHARP_ instanceof goog.date.Date);
|
||||
}),args)){
|
||||
return cljs.core.apply.call(null,cljs.core._EQ_,cljs.core.map.call(null,(function (p1__31796_SHARP_){
|
||||
return p1__31796_SHARP_.getTime();
|
||||
}),args));
|
||||
} else {
|
||||
return cljs.core.apply.call(null,cljs.core._EQ_,args);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
cljs_time.internal.core._EQ_.cljs$lang$maxFixedArity = (0);
|
||||
|
||||
cljs_time.internal.core._EQ_.cljs$lang$applyTo = (function (seq31797){
|
||||
return cljs_time.internal.core._EQ_.cljs$core$IFn$_invoke$arity$variadic(cljs.core.seq.call(null,seq31797));
|
||||
});
|
||||
|
||||
cljs_time.internal.core.leap_year_QMARK_ = (function cljs_time$internal$core$leap_year_QMARK_(y){
|
||||
if((cljs.core.mod.call(null,y,(400)) === (0))){
|
||||
return true;
|
||||
} else {
|
||||
if((cljs.core.mod.call(null,y,(100)) === (0))){
|
||||
return false;
|
||||
} else {
|
||||
if((cljs.core.mod.call(null,y,(4)) === (0))){
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
cljs_time.internal.core.days_in_month = new cljs.core.PersistentVector(null, 12, 5, cljs.core.PersistentVector.EMPTY_NODE, [(31),(28),(31),(30),(31),(30),(31),(31),(30),(31),(30),(31)], null);
|
||||
cljs_time.internal.core.year_corrected_dim = (function cljs_time$internal$core$year_corrected_dim(year,month){
|
||||
var G__31802 = cljs_time.internal.core.days_in_month.call(null,(cljs.core.truth_(cljs_time.internal.core._EQ_.call(null,month,(1)))?(11):(month - (1))));
|
||||
if(cljs.core.truth_((function (){var and__25118__auto__ = cljs_time.internal.core.leap_year_QMARK_.call(null,year);
|
||||
if(cljs.core.truth_(and__25118__auto__)){
|
||||
return cljs_time.internal.core._EQ_.call(null,month,(2));
|
||||
} else {
|
||||
return and__25118__auto__;
|
||||
}
|
||||
})())){
|
||||
return (G__31802 + (1));
|
||||
} else {
|
||||
return G__31802;
|
||||
}
|
||||
});
|
||||
cljs_time.internal.core.valid_date_QMARK_ = (function cljs_time$internal$core$valid_date_QMARK_(p__31803){
|
||||
var map__31806 = p__31803;
|
||||
var map__31806__$1 = ((((!((map__31806 == null)))?((((map__31806.cljs$lang$protocol_mask$partition0$ & (64))) || (map__31806.cljs$core$ISeq$))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__31806):map__31806);
|
||||
var d = map__31806__$1;
|
||||
var years = cljs.core.get.call(null,map__31806__$1,new cljs.core.Keyword(null,"years","years",-1298579689));
|
||||
var months = cljs.core.get.call(null,map__31806__$1,new cljs.core.Keyword(null,"months","months",-45571637));
|
||||
var days = cljs.core.get.call(null,map__31806__$1,new cljs.core.Keyword(null,"days","days",-1394072564));
|
||||
var hours = cljs.core.get.call(null,map__31806__$1,new cljs.core.Keyword(null,"hours","hours",58380855));
|
||||
var minutes = cljs.core.get.call(null,map__31806__$1,new cljs.core.Keyword(null,"minutes","minutes",1319166394));
|
||||
var seconds = cljs.core.get.call(null,map__31806__$1,new cljs.core.Keyword(null,"seconds","seconds",-445266194));
|
||||
var millis = cljs.core.get.call(null,map__31806__$1,new cljs.core.Keyword(null,"millis","millis",-1338288387));
|
||||
var months__$1 = (months + (1));
|
||||
if(cljs.core.truth_((function (){var and__25118__auto__ = years;
|
||||
if(cljs.core.truth_(and__25118__auto__)){
|
||||
return ((((1) <= months__$1)) && ((months__$1 <= (12)))) && ((((1) <= days)) && ((days <= cljs_time.internal.core.year_corrected_dim.call(null,years,months__$1)))) && ((((0) <= hours)) && ((hours <= (23)))) && ((((0) <= minutes)) && ((minutes <= (59)))) && ((((0) <= seconds)) && ((seconds <= (60)))) && ((((0) <= millis)) && ((millis <= (999))));
|
||||
} else {
|
||||
return and__25118__auto__;
|
||||
}
|
||||
})())){
|
||||
return d;
|
||||
} else {
|
||||
throw cljs.core.ex_info.call(null,"Date is not valid",new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"type","type",1174270348),new cljs.core.Keyword(null,"invalid-date","invalid-date",2030506573),new cljs.core.Keyword(null,"date","date",-1463434462),d], null));
|
||||
}
|
||||
});
|
||||
cljs_time.internal.core.index_of = (function cljs_time$internal$core$index_of(coll,x){
|
||||
return cljs.core.first.call(null,cljs.core.keep_indexed.call(null,(function (p1__31809_SHARP_,p2__31808_SHARP_){
|
||||
if(cljs.core.truth_(cljs_time.internal.core._EQ_.call(null,p2__31808_SHARP_,x))){
|
||||
return p1__31809_SHARP_;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}),coll));
|
||||
});
|
||||
/**
|
||||
* Formats a string using goog.string.format.
|
||||
*/
|
||||
cljs_time.internal.core.format = (function cljs_time$internal$core$format(var_args){
|
||||
var args__26212__auto__ = [];
|
||||
var len__26205__auto___31812 = arguments.length;
|
||||
var i__26206__auto___31813 = (0);
|
||||
while(true){
|
||||
if((i__26206__auto___31813 < len__26205__auto___31812)){
|
||||
args__26212__auto__.push((arguments[i__26206__auto___31813]));
|
||||
|
||||
var G__31814 = (i__26206__auto___31813 + (1));
|
||||
i__26206__auto___31813 = G__31814;
|
||||
continue;
|
||||
} else {
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
var argseq__26213__auto__ = ((((1) < args__26212__auto__.length))?(new cljs.core.IndexedSeq(args__26212__auto__.slice((1)),(0),null)):null);
|
||||
return cljs_time.internal.core.format.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),argseq__26213__auto__);
|
||||
});
|
||||
|
||||
cljs_time.internal.core.format.cljs$core$IFn$_invoke$arity$variadic = (function (fmt,args){
|
||||
var args__$1 = cljs.core.map.call(null,(function (x){
|
||||
if(((x instanceof cljs.core.Keyword)) || ((x instanceof cljs.core.Symbol))){
|
||||
return [cljs.core.str(x)].join('');
|
||||
} else {
|
||||
return x;
|
||||
}
|
||||
}),args);
|
||||
return cljs.core.apply.call(null,goog.string.format,fmt,args__$1);
|
||||
});
|
||||
|
||||
cljs_time.internal.core.format.cljs$lang$maxFixedArity = (1);
|
||||
|
||||
cljs_time.internal.core.format.cljs$lang$applyTo = (function (seq31810){
|
||||
var G__31811 = cljs.core.first.call(null,seq31810);
|
||||
var seq31810__$1 = cljs.core.next.call(null,seq31810);
|
||||
return cljs_time.internal.core.format.cljs$core$IFn$_invoke$arity$variadic(G__31811,seq31810__$1);
|
||||
});
|
||||
|
||||
/**
|
||||
* Remove the need to pull in gstring/format code in advanced compilation
|
||||
*/
|
||||
cljs_time.internal.core.zero_pad = (function cljs_time$internal$core$zero_pad(var_args){
|
||||
var args31815 = [];
|
||||
var len__26205__auto___31818 = arguments.length;
|
||||
var i__26206__auto___31819 = (0);
|
||||
while(true){
|
||||
if((i__26206__auto___31819 < len__26205__auto___31818)){
|
||||
args31815.push((arguments[i__26206__auto___31819]));
|
||||
|
||||
var G__31820 = (i__26206__auto___31819 + (1));
|
||||
i__26206__auto___31819 = G__31820;
|
||||
continue;
|
||||
} else {
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
var G__31817 = args31815.length;
|
||||
switch (G__31817) {
|
||||
case 1:
|
||||
return cljs_time.internal.core.zero_pad.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));
|
||||
|
||||
break;
|
||||
case 2:
|
||||
return cljs_time.internal.core.zero_pad.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
|
||||
|
||||
break;
|
||||
default:
|
||||
throw (new Error([cljs.core.str("Invalid arity: "),cljs.core.str(args31815.length)].join('')));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
cljs_time.internal.core.zero_pad.cljs$core$IFn$_invoke$arity$1 = (function (n){
|
||||
if((((0) <= n)) && ((n <= (9)))){
|
||||
return [cljs.core.str("0"),cljs.core.str(n)].join('');
|
||||
} else {
|
||||
return [cljs.core.str(n)].join('');
|
||||
}
|
||||
});
|
||||
|
||||
cljs_time.internal.core.zero_pad.cljs$core$IFn$_invoke$arity$2 = (function (n,zeros){
|
||||
if(((1) > zeros)){
|
||||
return [cljs.core.str(n)].join('');
|
||||
} else {
|
||||
return [cljs.core.str(clojure.string.join.call(null,cljs.core.take.call(null,(zeros - cljs.core.count.call(null,[cljs.core.str(n)].join(''))),cljs.core.repeat.call(null,"0")))),cljs.core.str(n)].join('');
|
||||
}
|
||||
});
|
||||
|
||||
cljs_time.internal.core.zero_pad.cljs$lang$maxFixedArity = 2;
|
||||
|
||||
cljs_time.internal.core.multiplied_by = (function cljs_time$internal$core$multiplied_by(period,scalar){
|
||||
var scale_fn = (function cljs_time$internal$core$multiplied_by_$_scale_fn(field){
|
||||
if(cljs.core.truth_(field)){
|
||||
return (field * scalar);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
return cljs.core.update_in.call(null,cljs.core.update_in.call(null,cljs.core.update_in.call(null,cljs.core.update_in.call(null,cljs.core.update_in.call(null,cljs.core.update_in.call(null,cljs.core.update_in.call(null,cljs.core.update_in.call(null,period,new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"millis","millis",-1338288387)], null),scale_fn),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"seconds","seconds",-445266194)], null),scale_fn),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"minutes","minutes",1319166394)], null),scale_fn),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"hours","hours",58380855)], null),scale_fn),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"days","days",-1394072564)], null),scale_fn),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"weeks","weeks",1844596125)], null),scale_fn),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"months","months",-45571637)], null),scale_fn),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"years","years",-1298579689)], null),scale_fn);
|
||||
});
|
||||
|
||||
//# sourceMappingURL=core.js.map?rel=1603199194749
|
||||
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue