1.0.3 • Published 3 years ago

babel-plugin-transform-for-in v1.0.3

Weekly downloads
15
License
MIT
Repository
github
Last release
3 years ago

Start

  // .babelrc
  {
    "plugins":["babel-plugin-transform-for-in"]
  }

Example

  • in
for (var id in this.infoDict) {
  var info = this.infoDict[id]

  if (info.kind !== kind) {
    continue
  }

  var _s = info.pathArr.join('.')

  if (_s.indexOf(s) === 0) {
    if (!includingEqual && _s === s) {
      continue
    }

    res.push(info)
    continue
  }
  • out
for (var id in this.infoDict) {
  if (Object.hasOwnProperty.call(this.infoDict, id)) {
    var info = this.infoDict[id]

    if (info.kind !== kind) {
      continue
    } // 检查是否以 dataPath 开头


    var _s = info.pathArr.join('.')

    if (_s.indexOf(s) === 0) {
      if (!includingEqual && _s === s) {
        continue
      }

      res.push(info)
      continue
    }
  }
}