chrome-devtools-frontend
Version:
Chrome DevTools UI
29 lines (21 loc) • 769 B
JavaScript
// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
;
function isUIStringsIdentifier(node) {
return node.type === 'Identifier' && node.name === 'UIStrings';
}
function isModuleScope(context) {
return context.getScope().type === 'module';
}
function isUIStringsVariableDeclarator(context, variableDeclarator) {
if (!isModuleScope(context)) {
return false;
}
if (!isUIStringsIdentifier(variableDeclarator.id)) {
return false;
}
return variableDeclarator.init?.type === 'ObjectExpression';
}
exports.isUIStringsIdentifier = isUIStringsIdentifier;
exports.isUIStringsVariableDeclarator = isUIStringsVariableDeclarator;