@threlte/gltf 1.0.0-next.4 → 1.0.0-next.6

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @threlte/gltf
2
2
 
3
+ ## 1.0.0-next.6
4
+
5
+ ### Patch Changes
6
+
7
+ - 81834dd4: Refactored the pascal case function
8
+
9
+ ## 1.0.0-next.5
10
+
11
+ ### Patch Changes
12
+
13
+ - da70d570: typo
14
+
3
15
  ## 1.0.0-next.4
4
16
 
5
17
  ### Patch Changes
package/cli.js CHANGED
@@ -65,13 +65,24 @@ const cli = meow(
65
65
 
66
66
  const { packageJson } = readPackageUpSync({ cwd: __dirname, normalize: false })
67
67
 
68
- function toPascalCase(string) {
69
- return `${string}`
70
- .toLowerCase()
71
- .replace(new RegExp(/[-_]+/, 'g'), ' ')
72
- .replace(new RegExp(/[^\w\s]/, 'g'), '')
73
- .replace(new RegExp(/\s+(.)(\w*)/, 'g'), ($1, $2, $3) => `${$2.toUpperCase() + $3}`)
74
- .replace(new RegExp(/\w/), (s) => s.toUpperCase())
68
+ function toPascalCase(str) {
69
+ return (
70
+ str
71
+ .replace(/(\w)(\w*)/g, function (g0, g1, g2) {
72
+ // capitalize first letter of g1, leave the reset as-is and return the result
73
+ return g1.toUpperCase() + g2
74
+ })
75
+ // replace every non-word character with an empty string and capitalize the first following letter
76
+ .replace(/\W+(.)/g, function (g0, g1) {
77
+ return g1.toUpperCase()
78
+ })
79
+ // replace every non-word character with an empty string
80
+ .replace(/\s+/g, '')
81
+ // make first letter uppercase
82
+ .replace(/^\w/, function (g0) {
83
+ return g0.toUpperCase()
84
+ })
85
+ )
75
86
  }
76
87
 
77
88
  if (cli.input.length === 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threlte/gltf",
3
- "version": "1.0.0-next.4",
3
+ "version": "1.0.0-next.6",
4
4
  "description": "GLTF to Threlte converter",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -515,7 +515,7 @@ ${
515
515
  ${options.types ? printThrelteTypes(objects, animations) : ''}
516
516
 
517
517
  const load = () => {
518
- ${options.suspend ? 'const suspend = useSuspense()' : ''}
518
+ ${options.suspense ? 'const suspend = useSuspense()' : ''}
519
519
  return ${useGltf}
520
520
  }
521
521