vue-convenia-util
Advanced tools
Comparing version 0.7.0 to 0.7.1
@@ -8,2 +8,4 @@ 'use strict'; | ||
var moment = _interopDefault(require('moment')); | ||
var normalize = require('normalize-text'); | ||
var normalize__default = _interopDefault(normalize); | ||
@@ -365,12 +367,3 @@ /** | ||
var isValid = is(value, 'String'); | ||
var chars = [ | ||
'àáäâãèéëêìíïîòóöôõùúüûçÀÁÄÂÃÈÉËÊÌÍÏÎÒÓÖÔÕÙÚÜÛÇ', | ||
'aaaaaeeeeiiiiooooouuuucAAAAAEEEEIIIIOOOOOUUUUC' | ||
]; | ||
var hasSpecial = new RegExp(chars[0].split('').join('|'), 'g'); | ||
var formatted = !isValid ? null : value.replace(hasSpecial, function (char) { | ||
var index = chars[0].indexOf(char); | ||
var clean = chars[1][index]; | ||
return clean | ||
}); | ||
var formatted = !isValid ? null : normalize.normalizeDiacritics(value); | ||
return formatted | ||
@@ -385,11 +378,10 @@ }; | ||
var toSlug = function (value) { | ||
var isValid = is(value, 'String'); | ||
var clean = isValid ? toClean(value.toLowerCase()) : null; | ||
var formatted = !isValid ? null : replace(clean, [ | ||
[/\\|ß|·|\/|_|,|:|;|\s/g, '-'], | ||
if (!is(value, 'String')) { // Short-circuit to handle all non-string values | ||
return null // and return null. | ||
} | ||
var formatted = replace(normalize__default(value), [ | ||
[/&/g, '-e-'], | ||
[/[^\w-]+/g, ''], | ||
[/\W/g, '-'], | ||
[/--+/g, '-'], | ||
[/^-+/, ''], | ||
[/-+$/, ''] | ||
[/(^-+)|(-+$)/, ''] | ||
]); | ||
@@ -396,0 +388,0 @@ return formatted |
import moment from 'moment'; | ||
import normalize, { normalizeDiacritics } from 'normalize-text'; | ||
@@ -358,12 +359,3 @@ /** | ||
var isValid = is(value, 'String'); | ||
var chars = [ | ||
'àáäâãèéëêìíïîòóöôõùúüûçÀÁÄÂÃÈÉËÊÌÍÏÎÒÓÖÔÕÙÚÜÛÇ', | ||
'aaaaaeeeeiiiiooooouuuucAAAAAEEEEIIIIOOOOOUUUUC' | ||
]; | ||
var hasSpecial = new RegExp(chars[0].split('').join('|'), 'g'); | ||
var formatted = !isValid ? null : value.replace(hasSpecial, function (char) { | ||
var index = chars[0].indexOf(char); | ||
var clean = chars[1][index]; | ||
return clean | ||
}); | ||
var formatted = !isValid ? null : normalizeDiacritics(value); | ||
return formatted | ||
@@ -378,11 +370,10 @@ }; | ||
var toSlug = function (value) { | ||
var isValid = is(value, 'String'); | ||
var clean = isValid ? toClean(value.toLowerCase()) : null; | ||
var formatted = !isValid ? null : replace(clean, [ | ||
[/\\|ß|·|\/|_|,|:|;|\s/g, '-'], | ||
if (!is(value, 'String')) { // Short-circuit to handle all non-string values | ||
return null // and return null. | ||
} | ||
var formatted = replace(normalize(value), [ | ||
[/&/g, '-e-'], | ||
[/[^\w-]+/g, ''], | ||
[/\W/g, '-'], | ||
[/--+/g, '-'], | ||
[/^-+/, ''], | ||
[/-+$/, ''] | ||
[/(^-+)|(-+$)/, ''] | ||
]); | ||
@@ -389,0 +380,0 @@ return formatted |
{ | ||
"name": "vue-convenia-util", | ||
"version": "0.7.0", | ||
"version": "0.7.1", | ||
"description": "Plugin com validações, formatações e filtros para projetos Vue.", | ||
@@ -48,3 +48,6 @@ "keywords": [ | ||
] | ||
}, | ||
"dependencies": { | ||
"normalize-text": "^0.2.0" | ||
} | ||
} |
import moment from 'moment' | ||
import normalize, { normalizeDiacritics } from 'normalize-text' | ||
import { getDateFormat, replace } from './helpers' | ||
@@ -177,12 +178,3 @@ import { is, isDate } from './validators' | ||
const isValid = is(value, 'String') | ||
const chars = [ | ||
'àáäâãèéëêìíïîòóöôõùúüûçÀÁÄÂÃÈÉËÊÌÍÏÎÒÓÖÔÕÙÚÜÛÇ', | ||
'aaaaaeeeeiiiiooooouuuucAAAAAEEEEIIIIOOOOOUUUUC' | ||
] | ||
const hasSpecial = new RegExp(chars[0].split('').join('|'), 'g') | ||
const formatted = !isValid ? null : value.replace(hasSpecial, (char) => { | ||
const index = chars[0].indexOf(char) | ||
const clean = chars[1][index] | ||
return clean | ||
}) | ||
const formatted = !isValid ? null : normalizeDiacritics(value) | ||
return formatted | ||
@@ -197,11 +189,10 @@ } | ||
export const toSlug = (value) => { | ||
const isValid = is(value, 'String') | ||
const clean = isValid ? toClean(value.toLowerCase()) : null | ||
const formatted = !isValid ? null : replace(clean, [ | ||
[/\\|ß|·|\/|_|,|:|;|\s/g, '-'], | ||
if (!is(value, 'String')) { // Short-circuit to handle all non-string values | ||
return null // and return null. | ||
} | ||
const formatted = replace(normalize(value), [ | ||
[/&/g, '-e-'], | ||
[/[^\w-]+/g, ''], | ||
[/\W/g, '-'], | ||
[/--+/g, '-'], | ||
[/^-+/, ''], | ||
[/-+$/, ''] | ||
[/(^-+)|(-+$)/, ''] | ||
]) | ||
@@ -208,0 +199,0 @@ return formatted |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
296340
2
1488
+ Addednormalize-text@^0.2.0
+ Addedarray-buffer-byte-length@1.0.2(transitive)
+ Addedarray.prototype.reduce@1.0.7(transitive)
+ Addedarraybuffer.prototype.slice@1.0.4(transitive)
+ Addedavailable-typed-arrays@1.0.7(transitive)
+ Addedcall-bind@1.0.8(transitive)
+ Addedcall-bind-apply-helpers@1.0.1(transitive)
+ Addedcall-bound@1.0.3(transitive)
+ Addeddata-view-buffer@1.0.2(transitive)
+ Addeddata-view-byte-length@1.0.2(transitive)
+ Addeddata-view-byte-offset@1.0.1(transitive)
+ Addeddefine-data-property@1.1.4(transitive)
+ Addeddefine-properties@1.2.1(transitive)
+ Addeddunder-proto@1.0.1(transitive)
+ Addedes-abstract@1.23.9(transitive)
+ Addedes-array-method-boxes-properly@1.0.0(transitive)
+ Addedes-define-property@1.0.1(transitive)
+ Addedes-errors@1.3.0(transitive)
+ Addedes-object-atoms@1.0.0(transitive)
+ Addedes-set-tostringtag@2.1.0(transitive)
+ Addedes-to-primitive@1.3.0(transitive)
+ Addedfor-each@0.3.3(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedfunction.prototype.name@1.1.8(transitive)
+ Addedfunctions-have-names@1.2.3(transitive)
+ Addedget-intrinsic@1.2.7(transitive)
+ Addedget-proto@1.0.1(transitive)
+ Addedget-symbol-description@1.1.0(transitive)
+ Addedglobalthis@1.0.4(transitive)
+ Addedgopd@1.2.0(transitive)
+ Addedhas-bigints@1.1.0(transitive)
+ Addedhas-property-descriptors@1.0.2(transitive)
+ Addedhas-proto@1.2.0(transitive)
+ Addedhas-symbols@1.1.0(transitive)
+ Addedhas-tostringtag@1.0.2(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedinternal-slot@1.1.0(transitive)
+ Addedis-array-buffer@3.0.5(transitive)
+ Addedis-async-function@2.1.0(transitive)
+ Addedis-bigint@1.1.0(transitive)
+ Addedis-boolean-object@1.2.1(transitive)
+ Addedis-callable@1.2.7(transitive)
+ Addedis-data-view@1.0.2(transitive)
+ Addedis-date-object@1.1.0(transitive)
+ Addedis-finalizationregistry@1.1.1(transitive)
+ Addedis-generator-function@1.1.0(transitive)
+ Addedis-map@2.0.3(transitive)
+ Addedis-number-object@1.1.1(transitive)
+ Addedis-regex@1.2.1(transitive)
+ Addedis-set@2.0.3(transitive)
+ Addedis-shared-array-buffer@1.0.4(transitive)
+ Addedis-string@1.1.1(transitive)
+ Addedis-symbol@1.1.1(transitive)
+ Addedis-typed-array@1.1.15(transitive)
+ Addedis-weakmap@2.0.2(transitive)
+ Addedis-weakref@1.1.0(transitive)
+ Addedis-weakset@2.0.4(transitive)
+ Addedisarray@2.0.5(transitive)
+ Addedmath-intrinsics@1.1.0(transitive)
+ Addednormalize-text@0.2.0(transitive)
+ Addedobject-inspect@1.13.3(transitive)
+ Addedobject-keys@1.1.1(transitive)
+ Addedobject.assign@4.1.7(transitive)
+ Addedobject.entries@1.1.8(transitive)
+ Addedobject.getownpropertydescriptors@2.1.8(transitive)
+ Addedown-keys@1.0.1(transitive)
+ Addedpossible-typed-array-names@1.0.0(transitive)
+ Addedreflect.getprototypeof@1.0.10(transitive)
+ Addedregexp.prototype.flags@1.5.4(transitive)
+ Addedsafe-array-concat@1.1.3(transitive)
+ Addedsafe-push-apply@1.0.0(transitive)
+ Addedsafe-regex-test@1.1.0(transitive)
+ Addedset-function-length@1.2.2(transitive)
+ Addedset-function-name@2.0.2(transitive)
+ Addedset-proto@1.0.0(transitive)
+ Addedside-channel@1.1.0(transitive)
+ Addedside-channel-list@1.0.0(transitive)
+ Addedside-channel-map@1.0.1(transitive)
+ Addedside-channel-weakmap@1.0.2(transitive)
+ Addedstring.prototype.trim@1.2.10(transitive)
+ Addedstring.prototype.trimend@1.0.9(transitive)
+ Addedstring.prototype.trimstart@1.0.8(transitive)
+ Addedtyped-array-buffer@1.0.3(transitive)
+ Addedtyped-array-byte-length@1.0.3(transitive)
+ Addedtyped-array-byte-offset@1.0.4(transitive)
+ Addedtyped-array-length@1.0.7(transitive)
+ Addedunbox-primitive@1.1.0(transitive)
+ Addeduncouple@0.2.0(transitive)
+ Addedwhich-boxed-primitive@1.1.1(transitive)
+ Addedwhich-builtin-type@1.2.1(transitive)
+ Addedwhich-collection@1.0.2(transitive)
+ Addedwhich-typed-array@1.1.18(transitive)