How to use execall - 5 common examples

To help you get started, we’ve selected a few execall examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github stylelint / stylelint / src / rules / media-feature-no-missing-punctuation / index.js View on Github external
root.walkAtRules(/^media$/i, atRule => {
      execall(/\((.*?)\)/g, atRule.params).forEach(mediaFeatureMatch => {
        if (!isStandardSyntaxMediaFeature(mediaFeatureMatch.match)) { return }

        const splitMediaFeature = mediaFeatureMatch.sub[0].trim().split(/\s+/)
        if (splitMediaFeature.length === 1) { return }

        // Ignore the last one
        for (let i = 0, l = splitMediaFeature.length - 1; i < l; i++) {
          const mediaFeaturePart = splitMediaFeature[i]

          // This part is valid if it is punctuation,
          // it ends with punctuation,
          // the next part is punctuation,
          // or the next part begins with punctuation
          if (isPunctuation(mediaFeaturePart)) { continue }
          if (endsWithPunctuation(mediaFeaturePart)) { continue }
          const nextPart = splitMediaFeature[i + 1]
github stylelint / stylelint / src / rules / number-no-trailing-zeros / index.js View on Github external
function check(source, node) {
      // Get out quickly if there are no periods
      if (source.indexOf(".") === -1) { return }

      const sanitizedSource = blurComments(blurFunctionArguments(source, "url"))
      const errors = execall(/\.\d*0+(?:\D|$)/g, sanitizedSource)
      if (!errors.length) { return }

      errors.forEach(error => {
        report({
          message: messages.rejected,
          node,
          index: error.index + error.match.length - 2,
          result,
          ruleName,
        })
      })
    }
  }
github marktext / marktext / src / muya / lib / contentState / searchCtrl.js View on Github external
}

  if (!isRegexp) {
    regStr = value.replace(SPECIAL_CHAR_REG, (p) => {
      return p === '\\' ? '\\\\' : `\\${p}`
    })
  }

  if (isWholeWord) {
    regStr = `\\b${regStr}\\b`
  }

  try {
    // Add try catch expression because not all string can generate a valid RegExp. for example `\`.
    SEARCH_REG = new RegExp(regStr, flag)
    return execall(SEARCH_REG, text)
  } catch (err) {
    return []
  }
}
github gatsbyjs / gatsby / packages / gatsby-source-wordpress-experimental / src / gatsby-node / source-nodes / create-nodes.js View on Github external
for (const node of wpgqlNodes.values()) {
      if (node.link) {
        // create a pathname for the node using the WP permalink
        node.path = urlToPath(node.link)
      }

      // here we're searching for file strings in our node
      // we use this to download only the media items
      // that are being used in posts
      // this is important not only for downloading only used images
      // but also for downloading images in post content
      if (wpgqlNodesGroup.singular !== `mediaItems`) {
        const nodeString = JSON.stringify(node)

        const matches = execall(remoteFileRegex, nodeString)

        if (matches.length) {
          store.dispatch.imageNodes.addUrlMatches(matches)
        }
      }

      await actions.createNode({
        ...node,
        id: node.id,
        parent: null,
        internal: {
          contentDigest: createContentDigest(node),
          // @todo allow namespacing types with a plugin option. Default to `Wp`
          type: `Wp${node.type}`,
        },
      })
github stylelint / stylelint / src / rules / number-max-precision / index.js View on Github external
function check(source, node) {

      const sanitizedSource = blurComments(blurFunctionArguments(source, "url"))
      const decimalNumberMatches = execall(/(\d*\.(\d+))/g, sanitizedSource)
      if (!decimalNumberMatches.length) { return }

      decimalNumberMatches.forEach(match => {
        if (match.sub[1].length <= precision) { return }
        report({
          result,
          ruleName,
          node,
          index: match.index,
          message: messages.expected(parseFloat(match.sub[0]), precision),
        })
      })
    }
  }

execall

Find multiple RegExp matches in a string

MIT
Latest version published 4 years ago

Package Health Score

68 / 100
Full package analysis

Popular execall functions