403Webshell
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 :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/tanviranik.com/node_modules/css-to-react-native/src/transforms/font.js
import parseFontFamily from './fontFamily'
import {
  regExpToken,
  SPACE,
  LENGTH,
  UNSUPPORTED_LENGTH_UNIT,
  SLASH,
} from '../tokenTypes'

const NORMAL = regExpToken(/^(normal)$/)
const STYLE = regExpToken(/^(italic)$/)
const WEIGHT = regExpToken(/^([1-9]00|bold)$/)
const VARIANT = regExpToken(/^(small-caps)$/)

const defaultFontStyle = 'normal'
const defaultFontWeight = 'normal'
const defaultFontVariant = []

export default tokenStream => {
  let fontStyle
  let fontWeight
  let fontVariant
  // let fontSize;
  let lineHeight
  // let fontFamily;

  let numStyleWeightVariantMatched = 0
  while (numStyleWeightVariantMatched < 3 && tokenStream.hasTokens()) {
    if (tokenStream.matches(NORMAL)) {
      /* pass */
    } else if (fontStyle === undefined && tokenStream.matches(STYLE)) {
      fontStyle = tokenStream.lastValue
    } else if (fontWeight === undefined && tokenStream.matches(WEIGHT)) {
      fontWeight = tokenStream.lastValue
    } else if (fontVariant === undefined && tokenStream.matches(VARIANT)) {
      fontVariant = [tokenStream.lastValue]
    } else {
      break
    }

    tokenStream.expect(SPACE)
    numStyleWeightVariantMatched += 1
  }

  const fontSize = tokenStream.expect(LENGTH, UNSUPPORTED_LENGTH_UNIT)

  if (tokenStream.matches(SLASH)) {
    lineHeight = tokenStream.expect(LENGTH, UNSUPPORTED_LENGTH_UNIT)
  }

  tokenStream.expect(SPACE)

  const { fontFamily } = parseFontFamily(tokenStream)

  if (fontStyle === undefined) fontStyle = defaultFontStyle
  if (fontWeight === undefined) fontWeight = defaultFontWeight
  if (fontVariant === undefined) fontVariant = defaultFontVariant

  const out = { fontStyle, fontWeight, fontVariant, fontSize, fontFamily }
  if (lineHeight !== undefined) out.lineHeight = lineHeight

  return out
}

Youez - 2016 - github.com/yon3zu
LinuXploit