nuxt-change-case
Advanced tools
Comparing version 1.0.2 to 1.1.0
@@ -0,0 +0,0 @@ const { resolve } = require('path') |
@@ -1,11 +0,2 @@ | ||
import * as changeCase from 'change-case' | ||
import { titleCase } from 'title-case' | ||
import { swapCase } from 'swap-case' | ||
import { isLowerCase } from 'is-lower-case' | ||
import { isUpperCase } from 'is-upper-case' | ||
import { lowerCase, localeLowerCase } from 'lower-case' | ||
import { lowerCaseFirst } from 'lower-case-first' | ||
import { upperCase, localeUpperCase } from 'upper-case' | ||
import { upperCaseFirst } from 'upper-case-first' | ||
import { spongeCase } from 'sponge-case' | ||
import * as changeCase from 'change-case-all' | ||
@@ -25,17 +16,30 @@ // Extract all methods matching *Case* from changeCase | ||
//** Custom methods */ | ||
const localeCapitalCase = (value, locale) => { | ||
// Split the input string into words | ||
const words = value.split(/[\s._-]+/); | ||
// Capitalize each word using the specified locale | ||
const capitalizedWords = words.map(word => { | ||
return word.charAt(0).toLocaleUpperCase(locale) + word.slice(1).toLocaleLowerCase(locale); | ||
}); | ||
// Join the words back together | ||
return capitalizedWords.join(' '); | ||
} | ||
export default ({ app }, inject) => { | ||
const localeMethods = ['localeUpperCase', 'localeLowerCase'] | ||
extractMethods().forEach((methodName) => { | ||
inject(methodName, value => changeCase[methodName](value)) | ||
inject('titleCase', value => titleCase(value)) | ||
inject('swapCase', value => swapCase(value)) | ||
inject('isLowerCase', value => isLowerCase(value)) | ||
inject('isUpperCase', value => isUpperCase(value)) | ||
inject('lowerCase', value => lowerCase(value)) | ||
inject('localeLowerCase', (value, locale) => localeLowerCase(value, locale)) | ||
inject('lowerCaseFirst', value => lowerCaseFirst(value)) | ||
inject('upperCase', value => upperCase(value)) | ||
inject('localeUpperCase', (value, locale) => localeUpperCase(value, locale)) | ||
inject('upperCaseFirst', value => upperCaseFirst(value)) | ||
inject('spongeCase', value => spongeCase(value)) | ||
if (localeMethods.includes(methodName)) { | ||
inject(methodName, (value, locale) => changeCase[methodName](value, locale)) | ||
} else { | ||
inject(methodName, value => changeCase[methodName](value)) | ||
} | ||
}) | ||
inject('localeCapitalCase', (value, locale) => localeCapitalCase(value, locale)) | ||
} | ||
{ | ||
"name": "nuxt-change-case", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"description": "change-case integration as nuxt module.", | ||
@@ -14,5 +14,3 @@ "repository": "https://github.com/selimdoyranli/nuxt-change-case.git", | ||
"nuxt change case", | ||
"nuxt string filter", | ||
"vue change case", | ||
"vue string filter" | ||
"nuxt string case utils" | ||
], | ||
@@ -30,12 +28,3 @@ "files": [ | ||
"dependencies": { | ||
"change-case": "^4.1.1", | ||
"is-lower-case": "^2.0.1", | ||
"is-upper-case": "^2.0.1", | ||
"lower-case": "^2.0.1", | ||
"lower-case-first": "^2.0.1", | ||
"sponge-case": "^1.0.0", | ||
"swap-case": "^2.0.1", | ||
"title-case": "^3.0.2", | ||
"upper-case": "^2.0.1", | ||
"upper-case-first": "^2.0.1" | ||
"change-case-all": "1.0.15" | ||
}, | ||
@@ -42,0 +31,0 @@ "devDependencies": { |
@@ -8,3 +8,3 @@ # nuxt-change-case | ||
> change-case implementation as nuxt module. | ||
> change-case-all@1.0.15 implementation as nuxt module. | ||
@@ -60,5 +60,16 @@ [📖 **Release Notes**](./CHANGELOG.md) | ||
``` | ||
<br> | ||
Please check full documentation. Same as **[change-case](https://github.com/blakeembrey/change-case)**. | ||
Please check full documentation. Same as **[change-case-all@1.0.15](https://www.npmjs.com/package/change-case-all/v/1.0.15)**. | ||
<br> | ||
### Additional Converters | ||
These methods are custom-written methods on this module that are not provided by change-case-all. | ||
```js | ||
<h1> {{ $localeCapitalCase('benim adım ibrahim yılmaz', 'tr') </h1> | ||
// Benim Adım İbrahim Yılmaz | ||
``` | ||
## Development | ||
@@ -74,3 +85,3 @@ | ||
Copyright (c) selimdoyranli <selimdoyranli@gmail.com.com> | ||
Copyright (c) selimdoyranli <selimdoyranli@gmail.com> | ||
@@ -77,0 +88,0 @@ <!-- Badges --> |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1
97
6166
46
+ Addedchange-case-all@1.0.15
+ Addedchange-case-all@1.0.15(transitive)
- Removedchange-case@^4.1.1
- Removedis-lower-case@^2.0.1
- Removedis-upper-case@^2.0.1
- Removedlower-case@^2.0.1
- Removedlower-case-first@^2.0.1
- Removedsponge-case@^1.0.0
- Removedswap-case@^2.0.1
- Removedtitle-case@^3.0.2
- Removedupper-case@^2.0.1
- Removedupper-case-first@^2.0.1