package.dist.module-min.helper.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mikado Show documentation
Show all versions of mikado Show documentation
Web's fastest template library to build user interfaces.
The newest version!
import Mikado from"./mikado.js";Mikado.prototype.move=Mikado.prototype.moveTo=function(a,b){let c;return"number"==typeof a?(c=a,a=this.dom[c]):c=this.index(a),0>b&&(b=this.length+b-1),c!==b&&this.shift(a,b-c),this},Mikado.prototype.shift=Mikado.prototype.shiftBy=function(c,d){if(!d)return this;let e;"number"==typeof c?(e=c,c=this.dom[c]):e=this.index(c);const f=0>d;if(f&&e||!f&&ea;b--)this.dom[b]=c=this.dom[b-1];else for(let b=e;bb&&(b=this.length+b,0>a&&b--),0>a&&(a=this.length+a-1),this.shift(a,b-a-1)),this},Mikado.prototype.after=function(a,b){return"number"!=typeof a&&(a=this.index(a)),"number"!=typeof b&&(b=this.index(b)),b!==a-1&&(0>b&&(b=this.length+b-2,0>a&&b++),0>a&&(a=this.length+a-1),this.shift(a,b-a+1)),this},Mikado.prototype.swap=function(c,d){if(c!==d){let a,b;"number"==typeof c?(a=0>c?this.length+c:c,c=this.dom[a]):a=this.index(c),"number"==typeof d?(b=0>d?this.length+d:d,d=this.dom[b]):b=this.index(d);const e=a+1!==b;this.root.insertBefore(e?c:d,e?d:c),e&&b+1!==a&&this.root.insertBefore(d,this.dom[a+1]||null),this.dom[a]=d,this.dom[b]=c}return this};
© 2015 - 2025 Weber Informatics LLC | Privacy Policy