UNPKG

webpack

Version:

Packs ECMAScript/CommonJs/AMD modules for the browser. Allows you to split your codebase into multiple bundles, which can be loaded on demand. Supports loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.

24 lines (19 loc) • 907 B
/* MIT License http://www.opensource.org/licenses/mit-license.php Author Alexander Akait @alexander-akait */ "use strict"; /** @import Dependency, { DependencyKinds } from "./Dependency" */ /** * Returns whether a dependency is of the given kind; use it wherever a plugin's dependency can reach. * A dependency extending another webpack copy's `Dependency` has no `is()` and is of no kind. * @template {keyof DependencyKinds} K * @param {Dependency} dependency a dependency * @param {K} kind a dependency kind * @returns {dependency is DependencyKinds[K]} true when the dependency is of that kind */ const isDependencyKind = (dependency, kind) => // TODO in the next major release: remove, require plugin dependencies to extend the current // `Dependency` and call `dependency.is(kind)` directly typeof dependency.is === "function" && dependency.is(kind); module.exports = isDependencyKind;