MCPcopy Create free account
hub / github.com/JKPotato-Computer/SignMaker / shiftLeft

Method shiftLeft

js/Post.js:78–85  ·  view source on GitHub ↗

* Shift the requested panel to the left one position swapping it with that panel to the left. * @param {number} panelIndex - Position of the panel in the array of panels on this post to shift left. * @return {number} The new index of the shifted panel.

(panelIndex)

Source from the content-addressed store, hash-verified

76 * @return {number} The new index of the shifted panel.
77 */
78 shiftLeft(panelIndex) {
79 // If already at the far left end, return.
80 if (panelIndex <= 0) {
81 return panelIndex;
82 }
83 this.panels.splice(panelIndex - 1, 2, this.panels[panelIndex], this.panels[panelIndex - 1]);
84 return panelIndex - 1;
85 }
86
87 /**
88 * Shift the requested panel to the right one position swaping it with that panel to the right.

Callers 2

shiftLeftFunction · 0.80
shiftLeftFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected