UNPKG

1.59 kBSource Map (JSON)View Raw
1{"version":3,"sources":["../../src/utils/strict.js"],"names":["IsStrict","node","type","directives","some","directive","value"],"mappings":";;;;;;;AAAA;;;;;;;;AAae,SAASA,QAAT,CAAkBC,IAAlB,EAA4C;AACzD,MAAIA,KAAKC,IAAL,KAAc,gBAAd,IAAkCD,KAAKC,IAAL,KAAc,SAApD,EAA+D,OAAO,KAAP;AAC/D,MAAIC,aAAeF,IAAF,CAA0DE,UAA3E;AACA,MAAI,CAACA,UAAL,EAAiB,OAAO,KAAP;AACjB,SAAOA,WAAWC,IAAX,CAAgBC,aAAa;AAClC,QAAIA,UAAUH,IAAV,KAAmB,WAAvB,EAAoC;AAClC,aAAO,KAAP;AACD;;AACD,QAAIG,UAAUC,KAAV,CAAgBJ,IAAhB,KAAyB,kBAA7B,EAAiD;AAC/C,aAAO,KAAP;AACD;;AACD,WAAOG,UAAUC,KAAV,CAAgBA,KAAhB,KAA0B,YAAjC;AACD,GARM,CAAP;AASD","sourcesContent":["/**\n * Copyright (c) 2017-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\n/* @flow */\n\nimport type { BabelNode, BabelNodeBlockStatement, BabelNodeProgram } from \"@babel/types\";\n\nexport default function IsStrict(node: BabelNode): boolean {\n if (node.type !== \"BlockStatement\" && node.type !== \"Program\") return false;\n let directives = ((node: any): BabelNodeBlockStatement | BabelNodeProgram).directives;\n if (!directives) return false;\n return directives.some(directive => {\n if (directive.type !== \"Directive\") {\n return false;\n }\n if (directive.value.type !== \"DirectiveLiteral\") {\n return false;\n }\n return directive.value.value === \"use strict\";\n });\n}\n"],"file":"strict.js"}
\No newline at end of file