teamplay 0.4.0-alpha.50 → 0.4.0-alpha.51

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.
@@ -1,3 +1,5 @@
1
+ import pluralize from 'pluralize'
2
+
1
3
  function getCollectionName (OrmEntity, options = {}, helperName = 'association') {
2
4
  if (options.key) return undefined
3
5
  const collection = OrmEntity?.collection
@@ -10,11 +12,7 @@ function getCollectionName (OrmEntity, options = {}, helperName = 'association')
10
12
 
11
13
  function toSingular (name) {
12
14
  if (typeof name !== 'string' || !name) return name
13
- if (name.endsWith('ies') && name.length > 3) return name.slice(0, -3) + 'y'
14
- if (name.endsWith('sses') && name.length > 4) return name.slice(0, -2) // classes -> class
15
- if (name.endsWith('ses') && name.length > 3) return name.slice(0, -2) // houses -> house
16
- if (name.endsWith('s') && !name.endsWith('ss') && name.length > 1) return name.slice(0, -1)
17
- return name
15
+ return pluralize.singular(name)
18
16
  }
19
17
 
20
18
  export function belongsTo (AssociatedOrmEntity, options = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "teamplay",
3
- "version": "0.4.0-alpha.50",
3
+ "version": "0.4.0-alpha.51",
4
4
  "description": "Full-stack signals ORM with multiplayer",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -46,6 +46,7 @@
46
46
  "json0-ot-diff": "^1.1.2",
47
47
  "localforage": "^1.10.0",
48
48
  "lodash": "^4.17.20",
49
+ "pluralize": "^8.0.0",
49
50
  "sharedb": "^5.0.0",
50
51
  "stream": "npm:readable-stream@^4.7.0"
51
52
  },
@@ -82,5 +83,5 @@
82
83
  ]
83
84
  },
84
85
  "license": "MIT",
85
- "gitHead": "f9d3a5f81198f665ec95f30c947ec93e5a7aaa5b"
86
+ "gitHead": "5e790f79c274ec5d414f3bcd2af17ca749957bc1"
86
87
  }