| Server IP : 159.203.156.69 / Your IP : 216.73.216.37 Web Server : nginx/1.24.0 System : Linux main-ubuntu 6.8.0-71-generic #71-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 22 16:52:38 UTC 2025 x86_64 User : root ( 0) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/tanviranik.com/node_modules/css-to-react-native/src/transforms/ |
Upload File : |
import {
regExpToken,
NONE,
COLOR,
LENGTH,
UNSUPPORTED_LENGTH_UNIT,
SPACE,
} from '../tokenTypes'
const BORDER_STYLE = regExpToken(/^(solid|dashed|dotted)$/)
const defaultBorderWidth = 1
const defaultBorderColor = 'black'
const defaultBorderStyle = 'solid'
export default tokenStream => {
let borderWidth
let borderColor
let borderStyle
if (tokenStream.matches(NONE)) {
tokenStream.expectEmpty()
return { borderWidth: 0, borderColor: 'black', borderStyle: 'solid' }
}
let partsParsed = 0
while (partsParsed < 3 && tokenStream.hasTokens()) {
if (partsParsed !== 0) tokenStream.expect(SPACE)
if (
borderWidth === undefined &&
tokenStream.matches(LENGTH, UNSUPPORTED_LENGTH_UNIT)
) {
borderWidth = tokenStream.lastValue
} else if (borderColor === undefined && tokenStream.matches(COLOR)) {
borderColor = tokenStream.lastValue
} else if (borderStyle === undefined && tokenStream.matches(BORDER_STYLE)) {
borderStyle = tokenStream.lastValue
} else {
tokenStream.throw()
}
partsParsed += 1
}
tokenStream.expectEmpty()
if (borderWidth === undefined) borderWidth = defaultBorderWidth
if (borderColor === undefined) borderColor = defaultBorderColor
if (borderStyle === undefined) borderStyle = defaultBorderStyle
return { borderWidth, borderColor, borderStyle }
}