<commit_before>'use strict'

var getExports = require('../core/getExports').get

module.exports = function (context) {
  function checkSpecifiers(key, type) { return function (node) {
    if (!node.specifiers
          .some(function (im) { return im.type === type })) {
      return // no named imports
    }

    var imports = getExports(node.source.value, context)
    if (imports == null) return

    var names = imports.named

    node.specifiers.forEach(function (im) {
      if (im.type !== type) return

      if (!names.has(im[key].name)) {
        context.report(im[key],
          im[key].name + ' not found in \'' + node.source.value + '\'')
      }
    })
  }}

  return {
    'ImportDeclaration': checkSpecifiers('imported', 'ImportSpecifier'),
    'ExportNamedDeclaration': checkSpecifiers('local', 'ExportSpecifier')
  }
}<commit_msg>reformatted function factory to just use 'bind' as a partial<commit_after>'use strict'

var getExports = require('../core/getExports').get

module.exports = function (context) {
  function checkSpecifiers(key, type, node) {
    if (!node.specifiers
          .some(function (im) { return im.type === type })) {
      return // no named imports
    }

    var imports = getExports(node.source.value, context)
    if (imports == null) return

    var names = imports.named

    node.specifiers.forEach(function (im) {
      if (im.type !== type) return

      if (!names.has(im[key].name)) {
        context.report(im[key],
          im[key].name + ' not found in \'' + node.source.value + '\'')
      }
    })
  }

  return {
    'ImportDeclaration': checkSpecifiers.bind( null
                                             , 'imported'
                                             , 'ImportSpecifier'
                                             ),

    'ExportNamedDeclaration': checkSpecifiers.bind( null
                                                  , 'local'
                                                  , 'ExportSpecifier'
                                                  )
  }

}
{'fraction_non_alphanumeric': 0.12964774951076322, 'fraction_numerical': 0.0, 'mean_word_length': 1.7937158469945356, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '307020', 'n_tokens_mistral': 556, 'n_tokens_neox': 543, 'n_words': 125}