Skip to content

Commit 65b6758

Browse files
committed
feature: @putout/operator-keyword: migrate to ESM
1 parent 4636adf commit 65b6758

File tree

5 files changed

+10
-14
lines changed

5 files changed

+10
-14
lines changed
File renamed without changes.

packages/operator-keyword/lib/keyword.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
'use strict';
2-
31
const moduleDeclarations = [
42
'import',
53
'export',
@@ -63,27 +61,27 @@ const keywords = [
6361
...expressions,
6462
];
6563

66-
module.exports.isKeyword = (name) => {
64+
export const isKeyword = (name) => {
6765
return keywords.includes(name);
6866
};
6967

70-
module.exports.isDeclarationKeyword = (name) => {
68+
export const isDeclarationKeyword = (name) => {
7169
return declarations.includes(name);
7270
};
7371

74-
module.exports.isModuleDeclarationKeyword = (name) => {
72+
export const isModuleDeclarationKeyword = (name) => {
7573
return moduleDeclarations.includes(name);
7674
};
7775

78-
module.exports.isConditionKeyword = (name) => {
76+
export const isConditionKeyword = (name) => {
7977
return conditions.includes(name);
8078
};
8179

82-
module.exports.isStatementKeyword = (name) => {
80+
export const isStatementKeyword = (name) => {
8381
return statements.includes(name);
8482
};
8583

86-
module.exports.isTSKeyword = (name) => {
84+
export const isTSKeyword = (name) => {
8785
const ts = typescript.includes(name);
8886
const tsReserved = typescriptReserved.includes(name);
8987

packages/operator-keyword/lib/keyword.spec.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
'use strict';
2-
3-
const {test} = require('supertape');
4-
const {
1+
import {test} from 'supertape';
2+
import {
53
isKeyword,
64
isTSKeyword,
75
isDeclarationKeyword,
86
isConditionKeyword,
97
isModuleDeclarationKeyword,
108
isStatementKeyword,
11-
} = require('./keyword');
9+
} from './keyword.js';
1210

1311
test('putout: operator: keyword: isKeyword: yes', (t) => {
1412
const result = isKeyword('if');

packages/operator-keyword/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@putout/operator-keyword",
33
"version": "3.0.0",
4-
"type": "commonjs",
4+
"type": "module",
55
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
66
"description": "🐊Putout operator adds ability to check if Identifier is Keyword",
77
"homepage": "https://github.com/coderaiser/putout/tree/master/packages/operator-keyword#readme",

0 commit comments

Comments
 (0)