Commit f41d445b authored by Barnabas Kendall's avatar Barnabas Kendall

fix attribute value parsing

parent 123cd520
Pipeline #158395235 passed with stage
in 0 seconds
......@@ -43,15 +43,12 @@
</div>
</template>
<script>
// keep it an integer if possible
import { mapMutations } from 'vuex'
// keep it an number if possible
function tryParse (value) {
if (typeof value === 'number') return value
if (typeof value === 'string') {
const int = parseInt(value, 10)
return isNaN(int) ? value : int
if (/^\s*[.\d]+\s*$/.test(value)) return parseFloat(value)
}
return value
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment