Skip to content

Commit da6ef1e

Browse files
committed
feat: add built in naming convention regex
1 parent 0873bb5 commit da6ef1e

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

lib/constants/naming-convention.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/**
2+
* @fileoverview Built in filename naming convention
3+
* @author Duke Luo
4+
*/
5+
'use strict';
6+
7+
/**
8+
* @example hello, helloWorld
9+
*/
10+
const CAMEL_CASE = /^([a-z]+){1}([A-Z][a-z0-9]*)*$/;
11+
12+
/**
13+
* @example Hello, HelloWorld
14+
*/
15+
const PASCAL_CASE = /^([A-Z][a-z0-9]*)*$/;
16+
17+
/**
18+
* @example hello, hello_world
19+
*/
20+
const SNAKE_CASE = /^([a-z]+_?)([a-z0-9]+_)*[a-z0-9]+$/;
21+
22+
/**
23+
* @example hello, hello-world
24+
*/
25+
const KEBAB_CASE = /^([a-z]+-?)([a-z0-9]+-)*[a-z0-9]+$/;
26+
27+
/**
28+
* @example HELLO, HELLO_WORLD
29+
*/
30+
const SCREAMING_SNAKE_CASE = /^([A-Z]+_?)([A-Z0-9]+_)*[A-Z0-9]+$/;
31+
32+
/**
33+
* @example hello, helloworld
34+
*/
35+
const FLAT_CASE = /^[a-z0-9]+$/;
36+
37+
module.exports = {
38+
CAMEL_CASE,
39+
PASCAL_CASE,
40+
SNAKE_CASE,
41+
KEBAB_CASE,
42+
SCREAMING_SNAKE_CASE,
43+
FLAT_CASE,
44+
};

0 commit comments

Comments
 (0)