Sha256: ca9816ba85ddd77847c3779c16147562d50c221ac8fc078951d04a74ac94e2d8

Contents?: true

Size: 390 Bytes

Versions: 43

Compression:

Stored size: 390 Bytes

Contents

'use strict'

let callbacks = ['done', 'cb', 'callback', 'next']

module.exports = function isNamedCallback(potentialCallbackName, exceptions) {
  for (let i = 0; i < exceptions.length; i++) {
    callbacks = callbacks.filter(item => {
      return item !== exceptions[i]
    })
  }
  return callbacks.some(trueCallbackName => {
    return potentialCallbackName === trueCallbackName
  })
}

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
govuk_publishing_components-18.0.0 node_modules/eslint-plugin-promise/rules/lib/is-named-callback.js
govuk_publishing_components-17.21.0 node_modules/eslint-plugin-promise/rules/lib/is-named-callback.js
govuk_publishing_components-17.20.0 node_modules/eslint-plugin-promise/rules/lib/is-named-callback.js
govuk_publishing_components-17.19.1 node_modules/eslint-plugin-promise/rules/lib/is-named-callback.js
govuk_publishing_components-17.19.0 node_modules/eslint-plugin-promise/rules/lib/is-named-callback.js
govuk_publishing_components-17.18.0 node_modules/eslint-plugin-promise/rules/lib/is-named-callback.js
govuk_publishing_components-17.17.0 node_modules/eslint-plugin-promise/rules/lib/is-named-callback.js
govuk_publishing_components-17.16.0 node_modules/eslint-plugin-promise/rules/lib/is-named-callback.js
govuk_publishing_components-17.15.0 node_modules/eslint-plugin-promise/rules/lib/is-named-callback.js
govuk_publishing_components-17.14.0 node_modules/eslint-plugin-promise/rules/lib/is-named-callback.js
govuk_publishing_components-17.13.0 node_modules/eslint-plugin-promise/rules/lib/is-named-callback.js
govuk_publishing_components-17.12.2 node_modules/eslint-plugin-promise/rules/lib/is-named-callback.js
govuk_publishing_components-17.12.1 node_modules/eslint-plugin-promise/rules/lib/is-named-callback.js
govuk_publishing_components-17.12.0 node_modules/eslint-plugin-promise/rules/lib/is-named-callback.js
govuk_publishing_components-17.11.0 node_modules/eslint-plugin-promise/rules/lib/is-named-callback.js
govuk_publishing_components-17.10.0 node_modules/eslint-plugin-promise/rules/lib/is-named-callback.js
govuk_publishing_components-17.9.0 node_modules/eslint-plugin-promise/rules/lib/is-named-callback.js
govuk_publishing_components-17.8.0 node_modules/eslint-plugin-promise/rules/lib/is-named-callback.js
govuk_publishing_components-17.7.0 node_modules/eslint-plugin-promise/rules/lib/is-named-callback.js
govuk_publishing_components-17.6.1 node_modules/eslint-plugin-promise/rules/lib/is-named-callback.js