Comparing version 1.1.2 to 1.2.0
@@ -68,3 +68,2 @@ 'use strict'; | ||
this.easy.state = exports.State.Review; | ||
this.again.lapses += 1; | ||
} else if (state === exports.State.Learning || state === exports.State.Relearning) { | ||
@@ -164,9 +163,9 @@ this.again.state = state; | ||
s.again.difficulty = this.next_difficulty(last_d, exports.Rating.Again); | ||
s.again.stability = this.next_forget_stability(s.again.difficulty, last_s, retrievability); | ||
s.again.stability = this.next_forget_stability(last_d, last_s, retrievability); | ||
s.hard.difficulty = this.next_difficulty(last_d, exports.Rating.Hard); | ||
s.hard.stability = this.next_recall_stability(s.hard.difficulty, last_s, retrievability, exports.Rating.Hard); | ||
s.hard.stability = this.next_recall_stability(last_d, last_s, retrievability, exports.Rating.Hard); | ||
s.good.difficulty = this.next_difficulty(last_d, exports.Rating.Good); | ||
s.good.stability = this.next_recall_stability(s.good.difficulty, last_s, retrievability, exports.Rating.Good); | ||
s.good.stability = this.next_recall_stability(last_d, last_s, retrievability, exports.Rating.Good); | ||
s.easy.difficulty = this.next_difficulty(last_d, exports.Rating.Easy); | ||
s.easy.stability = this.next_recall_stability(s.easy.difficulty, last_s, retrievability, exports.Rating.Easy); | ||
s.easy.stability = this.next_recall_stability(last_d, last_s, retrievability, exports.Rating.Easy); | ||
}; | ||
@@ -173,0 +172,0 @@ _proto2.init_stability = function init_stability(r) { |
@@ -1,2 +0,2 @@ | ||
"use strict";function t(){return(t=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(t[a]=i[a])}return t}).apply(this,arguments)}var e,i;Object.defineProperty(exports,"__esModule",{value:!0}),(e=exports.State||(exports.State={}))[e.New=0]="New",e[e.Learning=1]="Learning",e[e.Review=2]="Review",e[e.Relearning=3]="Relearning",(i=exports.Rating||(exports.Rating={}))[i.Again=1]="Again",i[i.Hard=2]="Hard",i[i.Good=3]="Good",i[i.Easy=4]="Easy";var a=function(t,e,i,a,s){this.rating=t,this.elapsed_days=i,this.scheduled_days=e,this.review=a,this.state=s},s=function(t,e){this.card=t,this.review_log=e},n=function(){function e(e){this.again=t({},e),this.hard=t({},e),this.good=t({},e),this.easy=t({},e)}var i=e.prototype;return i.update_state=function(t){t===exports.State.New?(this.again.state=exports.State.Learning,this.hard.state=exports.State.Learning,this.good.state=exports.State.Learning,this.easy.state=exports.State.Review,this.again.lapses+=1):t===exports.State.Learning||t===exports.State.Relearning?(this.again.state=t,this.hard.state=t,this.good.state=exports.State.Review,this.easy.state=exports.State.Review):t===exports.State.Review&&(this.again.state=exports.State.Relearning,this.hard.state=exports.State.Review,this.good.state=exports.State.Review,this.easy.state=exports.State.Review,this.again.lapses+=1)},i.schedule=function(t,e,i,a){this.again.scheduled_days=0,this.hard.scheduled_days=e,this.good.scheduled_days=i,this.easy.scheduled_days=a,this.again.due=new Date(t.getTime()+3e5),this.hard.due=e>0?new Date(t.getTime()+24*e*60*60*1e3):new Date(t.getTime()+6e5),this.good.due=new Date(t.getTime()+24*i*60*60*1e3),this.easy.due=new Date(t.getTime()+24*a*60*60*1e3)},i.record_log=function(t,e){var i;return(i={})[exports.Rating.Again]=new s(this.again,new a(exports.Rating.Again,this.again.scheduled_days,t.elapsed_days,e,t.state)),i[exports.Rating.Hard]=new s(this.hard,new a(exports.Rating.Hard,this.hard.scheduled_days,t.elapsed_days,e,t.state)),i[exports.Rating.Good]=new s(this.good,new a(exports.Rating.Good,this.good.scheduled_days,t.elapsed_days,e,t.state)),i[exports.Rating.Easy]=new s(this.easy,new a(exports.Rating.Easy,this.easy.scheduled_days,t.elapsed_days,e,t.state)),i},e}(),r=function(){this.request_retention=.9,this.maximum_interval=36500,this.w=[.4,.6,2.4,5.8,4.93,.94,.86,.01,1.49,.14,.94,2.18,.05,.34,1.26,.29,2.61]},o=function(){function e(){this.p=new r}var i=e.prototype;return i.repeat=function(e,i){(e=t({},e)).elapsed_days=e.state===exports.State.New?0:(i.getTime()-e.last_review.getTime())/864e5,e.last_review=i,e.reps+=1;var a=new n(e);if(a.update_state(e.state),e.state===exports.State.New){this.init_ds(a),a.again.due=new Date(i.getTime()+6e4),a.hard.due=new Date(i.getTime()+3e5),a.good.due=new Date(i.getTime()+6e5);var s=this.next_interval(a.easy.stability);a.easy.scheduled_days=s,a.easy.due=new Date(i.getTime()+24*s*60*60*1e3)}else if(e.state===exports.State.Learning||e.state===exports.State.Relearning){var r=this.next_interval(a.good.stability),o=Math.max(this.next_interval(a.easy.stability),r+1);a.schedule(i,0,r,o)}else if(e.state===exports.State.Review){var h=e.difficulty,d=e.stability,l=Math.pow(1+e.elapsed_days/(9*d),-1);this.next_ds(a,h,d,l);var p=this.next_interval(a.hard.stability),y=this.next_interval(a.good.stability);p=Math.min(p,y),y=Math.max(y,p+1);var g=Math.max(this.next_interval(a.easy.stability),y+1);a.schedule(i,p,y,g)}return a.record_log(e,i)},i.init_ds=function(t){t.again.difficulty=this.init_difficulty(exports.Rating.Again),t.again.stability=this.init_stability(exports.Rating.Again),t.hard.difficulty=this.init_difficulty(exports.Rating.Hard),t.hard.stability=this.init_stability(exports.Rating.Hard),t.good.difficulty=this.init_difficulty(exports.Rating.Good),t.good.stability=this.init_stability(exports.Rating.Good),t.easy.difficulty=this.init_difficulty(exports.Rating.Easy),t.easy.stability=this.init_stability(exports.Rating.Easy)},i.next_ds=function(t,e,i,a){t.again.difficulty=this.next_difficulty(e,exports.Rating.Again),t.again.stability=this.next_forget_stability(t.again.difficulty,i,a),t.hard.difficulty=this.next_difficulty(e,exports.Rating.Hard),t.hard.stability=this.next_recall_stability(t.hard.difficulty,i,a,exports.Rating.Hard),t.good.difficulty=this.next_difficulty(e,exports.Rating.Good),t.good.stability=this.next_recall_stability(t.good.difficulty,i,a,exports.Rating.Good),t.easy.difficulty=this.next_difficulty(e,exports.Rating.Easy),t.easy.stability=this.next_recall_stability(t.easy.difficulty,i,a,exports.Rating.Easy)},i.init_stability=function(t){return Math.max(this.p.w[t-1],.1)},i.init_difficulty=function(t){return Math.min(Math.max(this.p.w[4]-this.p.w[5]*(t-3),1),10)},i.next_interval=function(t){return Math.min(Math.max(Math.round(9*t*(1/this.p.request_retention-1)),1),this.p.maximum_interval)},i.next_difficulty=function(t,e){return Math.min(Math.max(this.mean_reversion(this.p.w[4],t-this.p.w[6]*(e-3)),1),10)},i.mean_reversion=function(t,e){return this.p.w[7]*t+(1-this.p.w[7])*e},i.next_recall_stability=function(t,e,i,a){var s=a===exports.Rating.Hard?this.p.w[15]:1,n=a===exports.Rating.Easy?this.p.w[16]:1;return e*(1+Math.exp(this.p.w[8])*(11-t)*Math.pow(e,-this.p.w[9])*(Math.exp((1-i)*this.p.w[10])-1)*s*n)},i.next_forget_stability=function(t,e,i){return this.p.w[11]*Math.pow(t,-this.p.w[12])*(Math.pow(e+1,this.p.w[13])-1)*Math.exp((1-i)*this.p.w[14])},e}();exports.Card=function(){this.due=new Date,this.stability=0,this.difficulty=0,this.elapsed_days=0,this.scheduled_days=0,this.reps=0,this.lapses=0,this.state=exports.State.New,this.last_review=new Date},exports.FSRS=o; | ||
"use strict";function t(){return(t=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(t[a]=i[a])}return t}).apply(this,arguments)}var e,i;Object.defineProperty(exports,"__esModule",{value:!0}),(e=exports.State||(exports.State={}))[e.New=0]="New",e[e.Learning=1]="Learning",e[e.Review=2]="Review",e[e.Relearning=3]="Relearning",(i=exports.Rating||(exports.Rating={}))[i.Again=1]="Again",i[i.Hard=2]="Hard",i[i.Good=3]="Good",i[i.Easy=4]="Easy";var a=function(t,e,i,a,s){this.rating=t,this.elapsed_days=i,this.scheduled_days=e,this.review=a,this.state=s},s=function(t,e){this.card=t,this.review_log=e},n=function(){function e(e){this.again=t({},e),this.hard=t({},e),this.good=t({},e),this.easy=t({},e)}var i=e.prototype;return i.update_state=function(t){t===exports.State.New?(this.again.state=exports.State.Learning,this.hard.state=exports.State.Learning,this.good.state=exports.State.Learning,this.easy.state=exports.State.Review):t===exports.State.Learning||t===exports.State.Relearning?(this.again.state=t,this.hard.state=t,this.good.state=exports.State.Review,this.easy.state=exports.State.Review):t===exports.State.Review&&(this.again.state=exports.State.Relearning,this.hard.state=exports.State.Review,this.good.state=exports.State.Review,this.easy.state=exports.State.Review,this.again.lapses+=1)},i.schedule=function(t,e,i,a){this.again.scheduled_days=0,this.hard.scheduled_days=e,this.good.scheduled_days=i,this.easy.scheduled_days=a,this.again.due=new Date(t.getTime()+3e5),this.hard.due=e>0?new Date(t.getTime()+24*e*60*60*1e3):new Date(t.getTime()+6e5),this.good.due=new Date(t.getTime()+24*i*60*60*1e3),this.easy.due=new Date(t.getTime()+24*a*60*60*1e3)},i.record_log=function(t,e){var i;return(i={})[exports.Rating.Again]=new s(this.again,new a(exports.Rating.Again,this.again.scheduled_days,t.elapsed_days,e,t.state)),i[exports.Rating.Hard]=new s(this.hard,new a(exports.Rating.Hard,this.hard.scheduled_days,t.elapsed_days,e,t.state)),i[exports.Rating.Good]=new s(this.good,new a(exports.Rating.Good,this.good.scheduled_days,t.elapsed_days,e,t.state)),i[exports.Rating.Easy]=new s(this.easy,new a(exports.Rating.Easy,this.easy.scheduled_days,t.elapsed_days,e,t.state)),i},e}(),r=function(){this.request_retention=.9,this.maximum_interval=36500,this.w=[.4,.6,2.4,5.8,4.93,.94,.86,.01,1.49,.14,.94,2.18,.05,.34,1.26,.29,2.61]},o=function(){function e(){this.p=new r}var i=e.prototype;return i.repeat=function(e,i){(e=t({},e)).elapsed_days=e.state===exports.State.New?0:(i.getTime()-e.last_review.getTime())/864e5,e.last_review=i,e.reps+=1;var a=new n(e);if(a.update_state(e.state),e.state===exports.State.New){this.init_ds(a),a.again.due=new Date(i.getTime()+6e4),a.hard.due=new Date(i.getTime()+3e5),a.good.due=new Date(i.getTime()+6e5);var s=this.next_interval(a.easy.stability);a.easy.scheduled_days=s,a.easy.due=new Date(i.getTime()+24*s*60*60*1e3)}else if(e.state===exports.State.Learning||e.state===exports.State.Relearning){var r=this.next_interval(a.good.stability),o=Math.max(this.next_interval(a.easy.stability),r+1);a.schedule(i,0,r,o)}else if(e.state===exports.State.Review){var h=e.difficulty,d=e.stability,l=Math.pow(1+e.elapsed_days/(9*d),-1);this.next_ds(a,h,d,l);var p=this.next_interval(a.hard.stability),y=this.next_interval(a.good.stability);p=Math.min(p,y),y=Math.max(y,p+1);var g=Math.max(this.next_interval(a.easy.stability),y+1);a.schedule(i,p,y,g)}return a.record_log(e,i)},i.init_ds=function(t){t.again.difficulty=this.init_difficulty(exports.Rating.Again),t.again.stability=this.init_stability(exports.Rating.Again),t.hard.difficulty=this.init_difficulty(exports.Rating.Hard),t.hard.stability=this.init_stability(exports.Rating.Hard),t.good.difficulty=this.init_difficulty(exports.Rating.Good),t.good.stability=this.init_stability(exports.Rating.Good),t.easy.difficulty=this.init_difficulty(exports.Rating.Easy),t.easy.stability=this.init_stability(exports.Rating.Easy)},i.next_ds=function(t,e,i,a){t.again.difficulty=this.next_difficulty(e,exports.Rating.Again),t.again.stability=this.next_forget_stability(e,i,a),t.hard.difficulty=this.next_difficulty(e,exports.Rating.Hard),t.hard.stability=this.next_recall_stability(e,i,a,exports.Rating.Hard),t.good.difficulty=this.next_difficulty(e,exports.Rating.Good),t.good.stability=this.next_recall_stability(e,i,a,exports.Rating.Good),t.easy.difficulty=this.next_difficulty(e,exports.Rating.Easy),t.easy.stability=this.next_recall_stability(e,i,a,exports.Rating.Easy)},i.init_stability=function(t){return Math.max(this.p.w[t-1],.1)},i.init_difficulty=function(t){return Math.min(Math.max(this.p.w[4]-this.p.w[5]*(t-3),1),10)},i.next_interval=function(t){return Math.min(Math.max(Math.round(9*t*(1/this.p.request_retention-1)),1),this.p.maximum_interval)},i.next_difficulty=function(t,e){return Math.min(Math.max(this.mean_reversion(this.p.w[4],t-this.p.w[6]*(e-3)),1),10)},i.mean_reversion=function(t,e){return this.p.w[7]*t+(1-this.p.w[7])*e},i.next_recall_stability=function(t,e,i,a){var s=a===exports.Rating.Hard?this.p.w[15]:1,n=a===exports.Rating.Easy?this.p.w[16]:1;return e*(1+Math.exp(this.p.w[8])*(11-t)*Math.pow(e,-this.p.w[9])*(Math.exp((1-i)*this.p.w[10])-1)*s*n)},i.next_forget_stability=function(t,e,i){return this.p.w[11]*Math.pow(t,-this.p.w[12])*(Math.pow(e+1,this.p.w[13])-1)*Math.exp((1-i)*this.p.w[14])},e}();exports.Card=function(){this.due=new Date,this.stability=0,this.difficulty=0,this.elapsed_days=0,this.scheduled_days=0,this.reps=0,this.lapses=0,this.state=exports.State.New,this.last_review=new Date},exports.FSRS=o; | ||
//# sourceMappingURL=fsrs.js.cjs.production.min.js.map |
@@ -66,3 +66,2 @@ function _extends() { | ||
this.easy.state = State.Review; | ||
this.again.lapses += 1; | ||
} else if (state === State.Learning || state === State.Relearning) { | ||
@@ -162,9 +161,9 @@ this.again.state = state; | ||
s.again.difficulty = this.next_difficulty(last_d, Rating.Again); | ||
s.again.stability = this.next_forget_stability(s.again.difficulty, last_s, retrievability); | ||
s.again.stability = this.next_forget_stability(last_d, last_s, retrievability); | ||
s.hard.difficulty = this.next_difficulty(last_d, Rating.Hard); | ||
s.hard.stability = this.next_recall_stability(s.hard.difficulty, last_s, retrievability, Rating.Hard); | ||
s.hard.stability = this.next_recall_stability(last_d, last_s, retrievability, Rating.Hard); | ||
s.good.difficulty = this.next_difficulty(last_d, Rating.Good); | ||
s.good.stability = this.next_recall_stability(s.good.difficulty, last_s, retrievability, Rating.Good); | ||
s.good.stability = this.next_recall_stability(last_d, last_s, retrievability, Rating.Good); | ||
s.easy.difficulty = this.next_difficulty(last_d, Rating.Easy); | ||
s.easy.stability = this.next_recall_stability(s.easy.difficulty, last_s, retrievability, Rating.Easy); | ||
s.easy.stability = this.next_recall_stability(last_d, last_s, retrievability, Rating.Easy); | ||
}; | ||
@@ -171,0 +170,0 @@ _proto2.init_stability = function init_stability(r) { |
{ | ||
"version": "1.1.2", | ||
"version": "1.2.0", | ||
"license": "MIT", | ||
@@ -4,0 +4,0 @@ "main": "dist/index.js", |
@@ -88,3 +88,2 @@ export enum State { | ||
this.easy.state = State.Review; | ||
this.again.lapses += 1; | ||
} else if (state === State.Learning || state === State.Relearning) { | ||
@@ -281,3 +280,3 @@ this.again.state = state; | ||
s.again.stability = this.next_forget_stability( | ||
s.again.difficulty, | ||
last_d, | ||
last_s, | ||
@@ -288,3 +287,3 @@ retrievability | ||
s.hard.stability = this.next_recall_stability( | ||
s.hard.difficulty, | ||
last_d, | ||
last_s, | ||
@@ -296,3 +295,3 @@ retrievability, | ||
s.good.stability = this.next_recall_stability( | ||
s.good.difficulty, | ||
last_d, | ||
last_s, | ||
@@ -304,3 +303,3 @@ retrievability, | ||
s.easy.stability = this.next_recall_stability( | ||
s.easy.difficulty, | ||
last_d, | ||
last_s, | ||
@@ -307,0 +306,0 @@ retrievability, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
98619
827