/*
解析表达式，如['firstName','default:"John Doe"','capitalize']
@param  {Array}  表达式内容
@param  {Number} 表达式索引
@param  {Array}  内容输出
@return {Void}
346311
function(_exps,_out){
        // foo|a:x|b:y1,y2|c:z1,z2 -> c(b(a(foo,x),y1,y2),z1,z2)
        if (!_exps||!_exps.length) return;
        if (_exps.length==1){
            var _var = _exps.pop();
            _doParseVars(_var);
            // fix error for ${}
            _out.push(_var==''?'""':_var);
            return;
        }
        var _exp = _exps.pop().split(':');
        _out.push('__MDF[\''+_exp.shift()+'\'](');
        _doParseExpression(_exps,_out);
        if (_exp.length>0){
            var _args = _exp.join(':');
            _doParseVars(_args);
            _out.push(','+_args);
        }
        _out.push(')');
    }
243197
function stringDotToObj(result, prop, name, value) {
        if (!result[prop]) {
            result[prop] = {};
        }
        name = name.substring((prop + '.').length, name.length);
        result[prop][name] = value;
    }
437369
function initCloneArray(array) {
    var length = array.length,
      result = new array.constructor(length);

    // Add properties assigned by `RegExp#exec`.
    if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
      result.index = array.index;
      result.input = array.input;
    }
    return result;
  }
843894
function titlecase() {
  return function(data, render) {
    var text = render(data);
    if (text.length === 0) {
      return text;
    }

    return text[0].toUpperCase() + text.substring(1);
  };
}
715470
function processSectionChild(objectString) {
    //regular expression that matches key value pairs
    var obj = {};
    var objArray = [];
    var topObj = obj;
    var keyValuePairRegExp = /(\n){1,}[\S\s,]+?(:)[\S\s]+?(?=((\n){1,})|$)/gi;
    var keyValuePairArray = objectString.match(keyValuePairRegExp);

    var multiKeyCount = {};
    /*this is to deal with multiple same keys from
  one child of a section*/
    //unusual steps are required to parse meta data and claims summary
    for (var s = 0; s < keyValuePairArray.length; s++) {
        //clean up the key pair
        var keyValuePairString = trimStringEnds(keyValuePairArray[s], ['\n']);
        //split each string by the :, the result is an array of size two
        var keyValuePair = keyValuePairString.split(/:(.*)/);
        var key = removeUnwantedCharacters(keyValuePair[0].trim(), ['\n', '-']);
        var value = keyValuePair[1].trim();
        //reassign tthe key based on how many duplicates tehre are
        if (key.length <= 0) {
            break;
        }
        key = key.toLowerCase();
        if (key in obj) {
            if (!(key in multiKeyCount)) {
                multiKeyCount[key] = 1;
            }
            var newKey = key + " " + String(multiKeyCount[key]);
            obj[newKey] = value;
            multiKeyCount[key] = multiKeyCount[key] + 1;
        } else {
            obj[key] = value;
        }
    }
    return obj;
}
430258
function(name) {
            var parseName = "parse" + can.capitalize(name);
            return function(data) {
                // If there's a `parse...` function, use its output.
                if (this[parseName]) {
                    data = this[parseName].apply(this, arguments);
                }
                // Run our maybe-parsed data through `model` or `models`.
                return this[name](data);
            };
        }
1234214
function stringDotToObj(result, name, value) {
        var parts = name.split('.'),
            prop = parts[0];

        parts.forEach(function (prop, i) {
            if (i === parts.length - 1) {
                result[prop] = value;
            } else {
                if (!result[prop]) {
                    result[prop] = {};
                }
                result = result[prop];
            }

        });
    }
642344
public static String capitalize(String input) {
        char[] stringArray = input.toCharArray();
        stringArray[0] = Character.toUpperCase(stringArray[0]);
        return new String(stringArray);
    }
411421
function (name, obj) {

		if (obj === null || obj === undefined) noReference();
		if (!typeIs(name, 'string')) unsupportedType(name);
		if (String.isEmpty(name)) throw new Error("不能使用空字符串作为属性名");

		setToGlobal(that, name.split("."), obj);
	}
164223
function cleanTitle( el ) {
		var txt = cleanPath( el.innerHTML );
		var idx = txt.indexOf( 'stdlib' );
		if ( idx === -1 || idx === 1 ) { // e.g., '@stdlib/types/iter'
			txt = 'stdlib | ' + txt;
		} else if ( txt.indexOf( ' | stdlib' ) === txt.length-9 ) { // e.g., 'foo/bar | stdlib'
			txt = 'stdlib | ' + txt.slice( 0, -9 );
		}
		el.innerHTML = txt;
	}
256637
function parseValue (num) {
  if (num === '') return '0'

  const numStr = _toString(num)
  if (numStr.indexOf('0') === 0
    && numStr.indexOf('.') === -1) {
    // 处理01变成1,并且不处理1.
    return _toString(parseFloat(num))
  }
  return _toString(num)
}
70771
function innerDecode(byteBuffer, readBody, deCompressBody) {
  const msgExt = new Message();
  // 消息ID
  byteBufferMsgId.reset();
  // 1 TOTALSIZE
  msgExt.storeSize = byteBuffer.getInt();
  // 2 MAGICCODE
  byteBuffer.getInt();
  // 3 BODYCRC
  msgExt.bodyCRC = byteBuffer.getInt();
  // 4 QUEUEID
  msgExt.queueId = byteBuffer.getInt();
  // 5 FLAG
  msgExt.flag = byteBuffer.getInt();
  // 6 QUEUEOFFSET
  msgExt.queueOffset = byteBuffer.getLong().toNumber();
  // 7 PHYSICALOFFSET
  msgExt.commitLogOffset = byteBuffer.getLong().toNumber();
  // 8 SYSFLAG
  const sysFlag = byteBuffer.getInt();
  msgExt.sysFlag = sysFlag;
  // 9 BORNTIMESTAMP
  msgExt.bornTimestamp = byteBuffer.getLong().toNumber();
  // 10 BORNHOST
  const host = Buffer.alloc(4);
  byteBuffer.get(host);
  let port = byteBuffer.getInt();
  msgExt.bornHost = host[0] + '.' + host[1] + '.' + host[2] + '.' + host[3] + ':' + port;
  // 11 STORETIMESTAMP
  msgExt.storeTimestamp = byteBuffer.getLong().toNumber();
  // 12 STOREHOST
  host.fill(0);
  byteBuffer.get(host);
  port = byteBuffer.getInt();
  msgExt.storeHost = host[0] + '.' + host[1] + '.' + host[2] + '.' + host[3] + ':' + port;
  byteBufferMsgId.put(host);
  byteBufferMsgId.putInt(port);
  byteBufferMsgId.putLong(msgExt.commitLogOffset);
  // 13 RECONSUMETIMES
  msgExt.reconsumeTimes = byteBuffer.getInt();
  // 14 Prepared Transaction Offset
  msgExt.preparedTransactionOffset = byteBuffer.getLong().toNumber();
  // 15 BODY
  const bodyLen = byteBuffer.getInt();
  if (bodyLen > 0) {
    if (readBody) {
      let body = Buffer.alloc(bodyLen);
      byteBuffer.get(body);

      // uncompress body
      if (deCompressBody && (sysFlag & MessageSysFlag.CompressedFlag) === MessageSysFlag.CompressedFlag) {
        body = utils.uncompress(body);
      }
      msgExt.body = body;
    } else {
      byteBuffer.position(byteBuffer.position() + bodyLen);
    }
  }

  // 16 TOPIC
  const topicLen = byteBuffer.get();
  const topic = Buffer.alloc(topicLen);
  byteBuffer.get(topic);
  msgExt.topic = topic.toString();

  // 17 properties
  const propertiesLength = byteBuffer.getShort();
  if (propertiesLength > 0) {
    const properties = Buffer.alloc(propertiesLength);
    byteBuffer.get(properties);
    const propertiesString = properties.toString();
    msgExt.properties = string2messageProperties(propertiesString);
  }

  msgExt.msgId = bytes2string(byteBufferMsgId.copy());
  return msgExt;
}
455818
function(modelName) {

    modelName = _.camelCase(modelName); // Model variable name are always in one word with no seprator
    modelName = pluralize.singular(modelName); // Model variable name are always singular
    modelName = _.upperFirst(modelName); // Model variable name always have their first letter capitalize

    return global[modelName];
  }
745613
public static String capitalize(String str) {
        char[] array = str.toCharArray();
        if (array.length > 0) {
            array[0] = Character.toUpperCase(array[0]);
        }
        return new String(array);
    }
307515
function capitalize (value, options) {
  options = options || {}
  var onlyFirstLetter = options.onlyFirstLetter != null ? options.onlyFirstLetter : false
  if (!value && value !== 0) return ''
  if(onlyFirstLetter === true) {
    return value.charAt(0).toUpperCase() + value.slice(1)
  } else {
    value = value.toString().toLowerCase().split(' ')
    return value.map(function(item) {
      return item.charAt(0).toUpperCase() + item.slice(1)
    }).join(' ')
  }
}
268203
function toEnumName(value) {
  var result = '';
  var wasLower = false;
  for (var i = 0; i < value.length; i++) {
    var c = value.charAt(i);
    var isLower = /[a-z]/.test(c);
    if (!isLower && wasLower) {
      result += '_';
    }
    result += c.toUpperCase();
    wasLower = isLower;
  }
  if (!isNaN(value[0])) {
    result = '_' + result;
  }
  result = result.replace(/[^\w]/g, '_');
  result = result.replace(/_+/g, '_');
  return result;
}
556874
function parsePrimitives(info, name, value) {
  var index
  var length
  var result

  if (typeof value !== 'object' || !('length' in value)) {
    return parsePrimitive(info, name, value)
  }

  length = value.length
  index = -1
  result = []

  while (++index < length) {
    result[index] = parsePrimitive(info, name, value[index])
  }

  return result
}