@putout/operator-keyword
v5.0.0
Published
🐊Putout operator adds ability to check if whether Identifier is a keyword or not
Maintainers
Readme
@putout/operator-keyword 
🐊Putout operator adds ability to check whether Identifier is a keyword or not.
Install
npm i putout @putout/operator-keywordAPI
import {operator} from 'putout';
const {
isKeyword,
isTSKeyword,
isDeclarationKeyword,
isModuleDeclarationKeyword,
isConditionKeyword,
} = operator;
isKeyword('if');
// returns
true;
isKeyword('abc');
// returns
false;
isDeclarationKeyword('const');
// returns
true;
isModuleDeclarationKeyword('import');
// returns
true;
isConditionKeyword('if');
// returns
true;
isStatementKeyword('for');
// returns
true;
isTSKeyword('implements');
// returns
true;isLegacyKeyword
A previous version of
import attributesused theassertkeyword instead of with. The assertion feature is now non-standard.(c) MDN
import {operator} from 'putout';
const {isLegacyKeyword} = operator;
isLegacyKeyword('assert');
// returns
true;License
MIT
