@pgpm/inflection 0.15.3 → 0.15.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Makefile
CHANGED
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<img height="20" src="https://github.com/constructive-io/pgpm-modules/actions/workflows/ci.yml/badge.svg" />
|
|
10
10
|
</a>
|
|
11
11
|
<a href="https://github.com/constructive-io/pgpm-modules/blob/main/LICENSE"><img height="20" src="https://img.shields.io/badge/license-MIT-blue.svg"/></a>
|
|
12
|
-
<a href="https://www.npmjs.com/package/@pgpm/inflection"><img height="20" src="https://img.shields.io/github/package-json/v/constructive-io/pgpm-modules?filename=packages%
|
|
12
|
+
<a href="https://www.npmjs.com/package/@pgpm/inflection"><img height="20" src="https://img.shields.io/github/package-json/v/constructive-io/pgpm-modules?filename=packages%2Finflection%2Fpackage.json"/></a>
|
|
13
13
|
</p>
|
|
14
14
|
|
|
15
15
|
String inflection utilities for PostgreSQL naming conventions
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pgpm/inflection",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.5",
|
|
4
4
|
"description": "String inflection utilities for PostgreSQL naming conventions",
|
|
5
5
|
"author": "Dan Lynch <pyramation@gmail.com>",
|
|
6
6
|
"contributors": [
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
"test:watch": "jest --watch"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@pgpm/verify": "0.15.
|
|
24
|
+
"@pgpm/verify": "0.15.5"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"pgpm": "^1.
|
|
27
|
+
"pgpm": "^1.3.0"
|
|
28
28
|
},
|
|
29
29
|
"repository": {
|
|
30
30
|
"type": "git",
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"bugs": {
|
|
35
35
|
"url": "https://github.com/constructive-io/pgpm-modules/issues"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "f6bbdfb20760e308b02968038b6f54191a9fd527"
|
|
38
38
|
}
|
package/pgpm-inflection.control
CHANGED
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
import cases from 'jest-in-case';
|
|
2
|
-
import { getConnections, PgTestClient } from 'pgsql-test';
|
|
3
|
-
|
|
4
|
-
let pg: PgTestClient;
|
|
5
|
-
let teardown: () => Promise<void>;
|
|
6
|
-
|
|
7
|
-
describe('inflection', () => {
|
|
8
|
-
beforeAll(async () => {
|
|
9
|
-
({ pg, teardown } = await getConnections());
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
afterAll(async () => {
|
|
13
|
-
await teardown();
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
cases(
|
|
17
|
-
'slugify',
|
|
18
|
-
async (opts: { name: string; allowUnicode: boolean; result: string }) => {
|
|
19
|
-
const { pg_slugify } = await pg.one(
|
|
20
|
-
'SELECT * FROM inflection.pg_slugify($1, $2)',
|
|
21
|
-
[opts.name, opts.allowUnicode]
|
|
22
|
-
);
|
|
23
|
-
expect(pg_slugify).toEqual(opts.result);
|
|
24
|
-
},
|
|
25
|
-
[
|
|
26
|
-
{ name: 'Hello, World!', allowUnicode: false, result: 'Hello_World' },
|
|
27
|
-
{ name: 'Héllø, Wørld!', allowUnicode: false, result: 'Hello_World' },
|
|
28
|
-
{ name: 'spam & eggs', allowUnicode: false, result: 'spam_eggs' },
|
|
29
|
-
{ name: 'spam & ıçüş', allowUnicode: true, result: 'spam_ıçüş' },
|
|
30
|
-
{ name: 'foo ıç bar', allowUnicode: true, result: 'foo_ıç_bar' },
|
|
31
|
-
{ name: ' foo ıç bar', allowUnicode: true, result: 'foo_ıç_bar' },
|
|
32
|
-
{ name: '你好', allowUnicode: true, result: '你好' },
|
|
33
|
-
{ name: 'message_properties', allowUnicode: false, result: 'message_properties' },
|
|
34
|
-
{ name: 'MessageProperties', allowUnicode: false, result: 'MessageProperties' },
|
|
35
|
-
{ name: 'WebACL', allowUnicode: false, result: 'WebAcl' }
|
|
36
|
-
]
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
cases(
|
|
40
|
-
'underscore',
|
|
41
|
-
async (opts: { name: string; result: string }) => {
|
|
42
|
-
const { underscore } = await pg.one(
|
|
43
|
-
'SELECT * FROM inflection.underscore($1)',
|
|
44
|
-
[opts.name]
|
|
45
|
-
);
|
|
46
|
-
expect(underscore).toEqual(opts.result);
|
|
47
|
-
},
|
|
48
|
-
[
|
|
49
|
-
{ name: 'MessageProperties', result: 'message_properties' },
|
|
50
|
-
{ name: 'messageProperties', result: 'message_properties' },
|
|
51
|
-
{ name: 'message_properties', result: 'message_properties' },
|
|
52
|
-
{ name: 'User Post', result: 'user_post' },
|
|
53
|
-
{ name: 'MP', result: 'mp' },
|
|
54
|
-
{ name: 'WebACL', result: 'web_acl' },
|
|
55
|
-
{ name: 'wabCdEfgh', result: 'wab_cd_efgh' },
|
|
56
|
-
{ name: 'WabCDEfgH', result: 'wab_cd_efgh' }
|
|
57
|
-
]
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
cases(
|
|
61
|
-
'no_single_underscores',
|
|
62
|
-
async (opts: { name: string; result: string }) => {
|
|
63
|
-
const { no_single_underscores } = await pg.one(
|
|
64
|
-
'SELECT * FROM inflection.no_single_underscores($1)',
|
|
65
|
-
[opts.name]
|
|
66
|
-
);
|
|
67
|
-
expect(no_single_underscores).toEqual(opts.result);
|
|
68
|
-
},
|
|
69
|
-
[
|
|
70
|
-
{ name: 'w_a_b_cd_efg_h', result: 'wab_cd_efgh' }
|
|
71
|
-
]
|
|
72
|
-
);
|
|
73
|
-
|
|
74
|
-
cases(
|
|
75
|
-
'pascal',
|
|
76
|
-
async (opts: { name: string; result: string }) => {
|
|
77
|
-
const { pascal } = await pg.one(
|
|
78
|
-
'SELECT * FROM inflection.pascal($1)',
|
|
79
|
-
[opts.name]
|
|
80
|
-
);
|
|
81
|
-
expect(pascal).toEqual(opts.result);
|
|
82
|
-
},
|
|
83
|
-
[
|
|
84
|
-
{ name: 'MessageProperties', result: 'MessageProperties' },
|
|
85
|
-
{ name: 'message_properties', result: 'MessageProperties' },
|
|
86
|
-
{ name: 'messageProperties', result: 'MessageProperties' },
|
|
87
|
-
{ name: 'MP', result: 'Mp' },
|
|
88
|
-
{ name: 'WebAcl', result: 'WebAcl' },
|
|
89
|
-
{ name: 'WebACL', result: 'WebAcl' },
|
|
90
|
-
{ name: 'web_acl', result: 'WebAcl' },
|
|
91
|
-
{ name: 'web acl', result: 'WebAcl' },
|
|
92
|
-
{ name: 'Web Acl', result: 'WebAcl' },
|
|
93
|
-
{ name: 'Web ACL', result: 'WebAcl' },
|
|
94
|
-
{ name: 'w_a_b', result: 'Wab' }
|
|
95
|
-
]
|
|
96
|
-
);
|
|
97
|
-
|
|
98
|
-
cases(
|
|
99
|
-
'camel',
|
|
100
|
-
async (opts: { name: string; result: string }) => {
|
|
101
|
-
const { camel } = await pg.one(
|
|
102
|
-
'SELECT * FROM inflection.camel($1)',
|
|
103
|
-
[opts.name]
|
|
104
|
-
);
|
|
105
|
-
expect(camel).toEqual(opts.result);
|
|
106
|
-
},
|
|
107
|
-
[
|
|
108
|
-
{ name: 'MessageProperties', result: 'messageProperties' },
|
|
109
|
-
{ name: 'message_properties', result: 'messageProperties' },
|
|
110
|
-
{ name: 'messageProperties', result: 'messageProperties' },
|
|
111
|
-
{ name: 'MP', result: 'mp' },
|
|
112
|
-
{ name: 'webAcl', result: 'webAcl' },
|
|
113
|
-
{ name: 'WebACL', result: 'webAcl' },
|
|
114
|
-
{ name: 'web_acl', result: 'webAcl' },
|
|
115
|
-
{ name: 'web acl', result: 'webAcl' },
|
|
116
|
-
{ name: 'Web Acl', result: 'webAcl' },
|
|
117
|
-
{ name: 'Web ACL', result: 'webAcl' },
|
|
118
|
-
{ name: 'w_a_b', result: 'wab' },
|
|
119
|
-
{ name: 'w_a_b_cd_efg_h', result: 'wabCdEfgh' }
|
|
120
|
-
]
|
|
121
|
-
);
|
|
122
|
-
|
|
123
|
-
cases(
|
|
124
|
-
'no_consecutive_caps',
|
|
125
|
-
async (opts: { name: string; result: string }) => {
|
|
126
|
-
const { no_consecutive_caps } = await pg.one(
|
|
127
|
-
'SELECT * FROM inflection.no_consecutive_caps($1)',
|
|
128
|
-
[opts.name]
|
|
129
|
-
);
|
|
130
|
-
expect(no_consecutive_caps).toEqual(opts.result);
|
|
131
|
-
},
|
|
132
|
-
[
|
|
133
|
-
{ name: 'MP', result: 'Mp' },
|
|
134
|
-
{ name: 'Web_ACL', result: 'Web_Acl' },
|
|
135
|
-
{ name: 'MPComplete', result: 'MpComplete' },
|
|
136
|
-
{ name: 'ACLWindow', result: 'AclWindow' }
|
|
137
|
-
]
|
|
138
|
-
);
|
|
139
|
-
|
|
140
|
-
cases(
|
|
141
|
-
'plural',
|
|
142
|
-
async (opts: { name: string; result: string }) => {
|
|
143
|
-
const { plural } = await pg.one(
|
|
144
|
-
'SELECT * FROM inflection.plural($1)',
|
|
145
|
-
[opts.name]
|
|
146
|
-
);
|
|
147
|
-
expect(plural).toEqual(opts.result);
|
|
148
|
-
},
|
|
149
|
-
[
|
|
150
|
-
{ name: 'user_login', result: 'user_logins' },
|
|
151
|
-
{ name: 'user Login', result: 'user Logins' },
|
|
152
|
-
{ name: 'user_logins', result: 'user_logins' },
|
|
153
|
-
{ name: 'user Logins', result: 'user Logins' },
|
|
154
|
-
{ name: 'children', result: 'children' },
|
|
155
|
-
{ name: 'child', result: 'children' },
|
|
156
|
-
{ name: 'man', result: 'men' },
|
|
157
|
-
{ name: 'men', result: 'men' }
|
|
158
|
-
]
|
|
159
|
-
);
|
|
160
|
-
|
|
161
|
-
cases(
|
|
162
|
-
'singular',
|
|
163
|
-
async (opts: { name: string; result: string }) => {
|
|
164
|
-
const { singular } = await pg.one(
|
|
165
|
-
'SELECT * FROM inflection.singular($1)',
|
|
166
|
-
[opts.name]
|
|
167
|
-
);
|
|
168
|
-
expect(singular).toEqual(opts.result);
|
|
169
|
-
},
|
|
170
|
-
[
|
|
171
|
-
{ name: 'user_logins', result: 'user_login' },
|
|
172
|
-
{ name: 'user Logins', result: 'user Login' },
|
|
173
|
-
{ name: 'user_login', result: 'user_login' },
|
|
174
|
-
{ name: 'user Login', result: 'user Login' },
|
|
175
|
-
{ name: 'children', result: 'child' },
|
|
176
|
-
{ name: 'child', result: 'child' },
|
|
177
|
-
{ name: 'man', result: 'man' },
|
|
178
|
-
{ name: 'men', result: 'man' }
|
|
179
|
-
]
|
|
180
|
-
);
|
|
181
|
-
});
|
package/jest.config.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/** @type {import('ts-jest').JestConfigWithTsJest} */
|
|
2
|
-
module.exports = {
|
|
3
|
-
preset: 'ts-jest',
|
|
4
|
-
testEnvironment: 'node',
|
|
5
|
-
|
|
6
|
-
// Match both __tests__ and colocated test files
|
|
7
|
-
testMatch: ['**/?(*.)+(test|spec).{ts,tsx,js,jsx}'],
|
|
8
|
-
|
|
9
|
-
// Ignore build artifacts and type declarations
|
|
10
|
-
testPathIgnorePatterns: ['/dist/', '\\.d\\.ts$'],
|
|
11
|
-
modulePathIgnorePatterns: ['<rootDir>/dist/'],
|
|
12
|
-
watchPathIgnorePatterns: ['/dist/'],
|
|
13
|
-
|
|
14
|
-
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
|
|
15
|
-
};
|
|
File without changes
|