@stonyx/orm 0.2.1-alpha.2 → 0.2.1-alpha.3

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/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "stonyx-async",
5
5
  "stonyx-module"
6
6
  ],
7
- "version": "0.2.1-alpha.2",
7
+ "version": "0.2.1-alpha.3",
8
8
  "description": "",
9
9
  "main": "src/main.js",
10
10
  "type": "module",
@@ -1,6 +1,6 @@
1
1
  import { Request } from '@stonyx/rest-server';
2
2
  import { createRecord, store } from '@stonyx/orm';
3
- import { pluralize } from './utils.js';
3
+ import { pluralize as basePluralize } from '@stonyx/utils/string';
4
4
 
5
5
  const methodAccessMap = {
6
6
  GET: 'read',
@@ -9,6 +9,17 @@ const methodAccessMap = {
9
9
  PATCH: 'update',
10
10
  };
11
11
 
12
+ function pluralize(word) {
13
+ if (word.includes('-')) {
14
+ const parts = word.split('-');
15
+ const pluralizedLast = basePluralize(parts.pop());
16
+
17
+ return [...parts, pluralizedLast].join('-');
18
+ }
19
+
20
+ return basePluralize(word);
21
+ }
22
+
12
23
  function getId({ id }) {
13
24
  if (isNaN(id)) return id;
14
25
 
package/src/utils.js DELETED
@@ -1,12 +0,0 @@
1
- import { pluralize as basePluralize } from '@stonyx/utils/string';
2
-
3
- export function pluralize(word) {
4
- if (word.includes('-')) {
5
- const parts = word.split('-');
6
- const pluralizedLast = basePluralize(parts.pop());
7
-
8
- return [...parts, pluralizedLast].join('-');
9
- }
10
-
11
- return basePluralize(word);
12
- }