Get the type by string length

@private
@param {String} sText
@param {Number} nCorrectLevel
@return {Number} type
165436
function _getTypeNumber(sText, nCorrectLevel) {			
		var nType = 1;
		var length = _getUTF8Length(sText);
		
		for (var i = 0, len = QRCodeLimitLength.length; i <= len; i++) {
			var nLimit = 0;
			
			switch (nCorrectLevel) {
				case QRErrorCorrectLevel.L :
					nLimit = QRCodeLimitLength[i][0];
					break;
				case QRErrorCorrectLevel.M :
					nLimit = QRCodeLimitLength[i][1];
					break;
				case QRErrorCorrectLevel.Q :
					nLimit = QRCodeLimitLength[i][2];
					break;
				case QRErrorCorrectLevel.H :
					nLimit = QRCodeLimitLength[i][3];
					break;
			}
			
			if (length <= nLimit) {
				break;
			} else {
				nType++;
			}
		}
		
		if (nType > QRCodeLimitLength.length) {
			throw new Error("Too long data");
		}
		
		return nType;
	}
1220835
@Override
	protected Type getTypeToSerialize() {

		if (contentType != null) {

			switch (contentType) {

				case "application/x-structr-javascript":
				case "application/x-structr-script":
					return Type.Function;

				case "application/x-cypher":
					return Type.Cypher;

			}
		}

		return Type.Function;
	}
448447
function getNthIndex(node)
{
	var child,i;
	var count = 0;
	var parentsChildren = node.parentNode.childNodes;
	var numParentsChildren = parentsChildren.length;
	
	for (i=0; i<numParentsChildren; i++)
	{
		child = parentsChildren[i];
		
		if (child !== node)
		{
			// Exclude text and comments nodes
			if (child.nodeName[0] !== "#")
			{
				count++;
			}
		}
		else
		{
			break;
		}
	}
	
	// `:nth-child()` indices don't start at 0
	return count+1;
}
1014375
function numericIndexGetter(row, index) {
    if (row == null)
        return '';
    // mimic behavior of deepValueGetter
    if (!row || index == null)
        return row;
    var value = row[index];
    if (value == null)
        return '';
    return value;
}
1179522
function parse(sText, oProp) {

		var aLines = sText.split(rLines), // split file into lines
			sLine,rMatcher,sKey,sValue,i,m,iLastIndex,iConcatOps;

		function append(s) {
			if ( sValue ) {
				sValue = sValue + s;
				iConcatOps++;
			} else {
				sValue = s;
				iConcatOps = 0;
			}
		}

		oProp.mProperties = {};

		for (i = 0; i < aLines.length; i++) {
			sLine = aLines[i];
			// ignore empty lines
			if (sLine === "" || sLine.charAt(0) === "#" || sLine.charAt(0) === "!" ) {
				continue;
			}

			// start with the full regexp incl. key/value separator
			rMatcher = rEscapesOrSeparator;
			rMatcher.lastIndex = iLastIndex = 0;
			sKey = null;
			sValue = "";

			while ( (m = rMatcher.exec(sLine)) !== null ) {
				// handle any raw, unmatched input
				if ( iLastIndex < m.index ) {
					append(sLine.slice(iLastIndex, m.index));
				}
				iLastIndex = rMatcher.lastIndex;
				if ( m[1] ) {
					// unicode escape
					if ( m[1].length !== 6 ) {
						throw new Error("Incomplete Unicode Escape '" + m[1] + "'");
					}
					append(String.fromCharCode(parseInt(m[1].slice(2), 16)));
				} else if ( m[2] ) {
					// special or simple escape
					append(mEscapes[m[2]] || m[2].slice(1));
				} else if ( m[3] ) {
					// continuation line marker
					sLine = aLines[++i];
					rMatcher.lastIndex = iLastIndex = 0;
				} else if ( m[4] ) { // only occurs in full regexp
					// key/value separator detected
					// -> remember key and switch to simplified regexp
					sKey = sValue;
					sValue = "";
					rMatcher = rEscapes;
					rMatcher.lastIndex = iLastIndex;
				}
			}
			if ( iLastIndex < sLine.length ) {
				append(sLine.slice(iLastIndex));
			}
			if ( sKey == null ) {
				sKey = sValue;
				sValue = "";
			}

			oProp.mProperties[sKey] = flatstr(sValue, sValue ? iConcatOps : 0); // Note: empty sValue implies iConcatOps == 0

		}

	}
1169290
function (el, type) {
		while (el && el.nodeName.toLowerCase() !== type.toLowerCase()) {
			el = el.parentNode;
		}
		return el;
	}
11360
@Nonnull
  public JSFormatter plain (@Nonnull final String sText)
  {
    _spaceIfNeeded ();
    m_aPW.print (sText);
    return this;
  }
280655
function getNumStr(num, fixed = 4) {
  let numStr = '';

  if (typeof num != "number") {
    num = Number(num);
    if (isNaN(num)) {
      // console.log("Pushbullet Plugin: Number Conversion Failed");
      return "Conversion Failure";
    }
  }


  if (Number.isInteger(num)) {
    numStr = num.toString();
  } else {

    //Create modNum Max - Must be a better way...
    let modNumMax = '1';
    for (let i = 1; i < fixed; i++) {
      modNumMax = modNumMax + '0';
    }
    modNumMax = Number(modNumMax);

    let i = 0;
    if (num < 1) {
      let modNum = num - Math.floor(num);
      while (modNum < modNumMax && i < 8) {
        modNum *= 10;
        i += 1;
      }
    } else {
      i = fixed;
    }
    numStr = num.toFixed(i);
    //Remove any excess zeros
    while (numStr.charAt(numStr.length - 1) === '0') {
      numStr = numStr.substring(0, numStr.length - 1);
    }

    //If last char remaining is a decimal point, remove it
    if (numStr.charAt(numStr.length - 1) === '.') {
      numStr = numStr.substring(0, numStr.length - 1);
    }

  }

  //Add commas for thousands etc
  let dp = numStr.indexOf('.'); //find deciaml point
  if (dp < 0) { //no dp found
    dp = numStr.length;
  }

  let insPos = dp - 3;
  insCount = 0;
  while (insPos > 0) {
    insCount++;
    numStr = numStr.slice(0, insPos) + ',' + numStr.slice(insPos);
    insPos -= 3;
  }


  return (numStr);
}
872327
function ElementRect(element) {
    _classCallCheck(this, ElementRect);

    this._element = element;

    /**
     * Returns the width of the current element.
     *
     * @type {Number}
     */
    this.width = this.boundingRect.width;

    /**
     * Returns the height of the current element.
     *
     * @type {Number}
     */
    this.height = this.boundingRect.height;

    /**
     * Returns the size (the biggest side) of the current element.
     *
     * @type {number}
     */
    this.size = Math.max(this.width, this.height);

    return this;
  }
228668
function getEmphasisToken({ tokens, intEmphasis, currTag, num }) {
  const rawContent = joinArrString(_.flattenDeep([
    tokens[num].markup,
    intEmphasis,
    tokens[num].markup
  ]));
  const contentLength = getTokensLength(rawContent);
  return {
    type: getEmphasisType(currTag),
    content: rawContent,
    length: contentLength
  };
}
995689
function typeOf(value, options) {
            if (value === undefined) return '#Undefined';
            if (value === null) return '#Null';
            if (options !== 'forceObjectToString') {
                var constructor = getConstructor(value);
                if (constructor !== null) {
                    var type = getFunctionName(constructor);
                    if (type === 'Object') {
                        return getObjectToStringValue(value);
                    }
                    return (type === 'Number' && value != +value) ? '#NaN' : type;
                }
            }
            return getObjectToStringValue(value);
        }
405452
function getElementText (parent, localName, ns) {
    var el = _getFirstChildNS(parent, localName, ns);
    if (el === undefined) return undefined;
    return el.textContent;
  }
1005784
function getInnerType(str){
  var index = str.indexOf('(');
  return index > 0 ? str.substring(index + 1, str.length - 1) : str;
}
501724
function getText (element, callback) {
  const iterator = new NodeIterator(element)
  let next
  while ((next = iterator.getNext())) {
    if (next.nodeType === nodeType.textNode && next.data !== '') {
      callback(next.data)
    } else if (next.nodeType === nodeType.elementNode && next.nodeName === 'BR') {
      callback(' ') // eslint-disable-line standard/no-callback-literal
    }
  }
}
1247283
def getTypeRef(self, element):
        """"""
        typeattr = self.getAttr(element, 'type', default=None)
        if typeattr is None:
            return None
        parts = typeattr.split(':', 1)
        if len(parts) == 2:
            nsuri = self.findNamespaceURI(parts[0], element)
        else:
            nsuri = self.findDefaultNS(element)
        return (nsuri, parts[1])
966888
function getMarkLength(markType, nodes) {
  let length = 0;
  while (nodes[length] && nodes[length].marks.includes(markType)) {
    ++length;
  }
  return { markType, length };
}
775044
function nthChild(node, type) {
    var node = node.firstChild;
    return (!node || checkNth(node, type)) ? node : nthNext(node, type);
  }