(value)
| 89480 | var _typeofDefault = parcelHelpers.interopDefault(_typeof); |
| 89481 | var PERCENT_OR_PIXELS_REGEX = /([0-9]+\.?[0-9]*)(%|px)/; |
| 89482 | function parsePosition(value) { |
| 89483 | switch((0, _typeofDefault.default)(value)){ |
| 89484 | case "number": |
| 89485 | return { |
| 89486 | position: value, |
| 89487 | relative: false |
| 89488 | }; |
| 89489 | case "string": |
| 89490 | var match = value.match(PERCENT_OR_PIXELS_REGEX); |
| 89491 | if (match && match.length >= 3) { |
| 89492 | var relative = match[2] === "%"; |
| 89493 | var position = parseFloat(match[1]); |
| 89494 | return { |
| 89495 | position: relative ? position / 100 : position, |
| 89496 | relative: relative |
| 89497 | }; |
| 89498 | } |
| 89499 | default: |
| 89500 | throw new Error("Could not parse position string ".concat(value)); |
| 89501 | } |
| 89502 | } |
| 89503 | function getPosition(position, extent) { |
| 89504 | return position.relative ? Math.round(position.position * extent) : position.position; |
| 89505 | } |
nothing calls this directly
no outgoing calls
no test coverage detected