UNPKG

@dev-thought/nx-deploy-it

Version:

[![npm version](https://badge.fury.io/js/%40dev-thought%2Fnx-deploy-it.svg)](https://www.npmjs.com/package/@dev-thought/nx-deploy-it) [![The MIT License](https://img.shields.io/badge/license-MIT-orange.svg?color=blue&style=flat-square)](http://opensource.

14 lines (12 loc) 404 B
import * as ts from 'typescript'; export function hasImport( statements: ts.NodeArray<ts.Statement>, importModule: string ): boolean { return !!statements .filter(node => { return node.kind === ts.SyntaxKind.ImportDeclaration; }) .map((node: ts.ImportDeclaration) => (node.moduleSpecifier as any).text) .find((importName: string) => importName.indexOf(importModule) > -1); }