Skip to content
This repository has been archived by the owner on Nov 27, 2020. It is now read-only.

Commit

Permalink
rename a confusingly-named helper function
Browse files Browse the repository at this point in the history
  • Loading branch information
http://jneen.net/ committed Dec 9, 2019
1 parent 8f1de10 commit 8eb5f9e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions assets/js/repeater.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ export const Repeater = (() => {
}
}

const reindex = (str, index) => {
const reindexValue = (str, index) => {
// it's always going to be the first [0] or [1] or etc.
return str.replace(/\[\d+\]/, `[${index}]`)
}

const reindexProp = (el, prop, index) => {
const current = el.getAttribute(prop)
if (!current) return
el.setAttribute(prop, reindex(current, index))
el.setAttribute(prop, reindexValue(current, index))
}

const clearField = (control) => {
Expand Down

0 comments on commit 8eb5f9e

Please sign in to comment.