mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-24 14:50:17 +03:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d38f9a2af6 |
No files matched your search
Vendored
+4
-1
@@ -119,7 +119,6 @@ declare module '@vue/runtime-core' {
|
||||
ListConverter: typeof import('./src/tools/list-converter/list-converter.vue')['default']
|
||||
LocaleSelector: typeof import('./src/modules/i18n/components/locale-selector.vue')['default']
|
||||
LoremIpsumGenerator: typeof import('./src/tools/lorem-ipsum-generator/lorem-ipsum-generator.vue')['default']
|
||||
LuhnValidator: typeof import('./src/tools/luhn-validator/luhn-validator.vue')['default']
|
||||
MacAddressGenerator: typeof import('./src/tools/mac-address-generator/mac-address-generator.vue')['default']
|
||||
MacAddressLookup: typeof import('./src/tools/mac-address-lookup/mac-address-lookup.vue')['default']
|
||||
MarkdownToHtml: typeof import('./src/tools/markdown-to-html/markdown-to-html.vue')['default']
|
||||
@@ -132,6 +131,7 @@ declare module '@vue/runtime-core' {
|
||||
MimeTypes: typeof import('./src/tools/mime-types/mime-types.vue')['default']
|
||||
NAlert: typeof import('naive-ui')['NAlert']
|
||||
NavbarButtons: typeof import('./src/components/NavbarButtons.vue')['default']
|
||||
NCheckbox: typeof import('naive-ui')['NCheckbox']
|
||||
NCollapseTransition: typeof import('naive-ui')['NCollapseTransition']
|
||||
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
|
||||
NDivider: typeof import('naive-ui')['NDivider']
|
||||
@@ -142,6 +142,8 @@ declare module '@vue/runtime-core' {
|
||||
NLayout: typeof import('naive-ui')['NLayout']
|
||||
NLayoutSider: typeof import('naive-ui')['NLayoutSider']
|
||||
NMenu: typeof import('naive-ui')['NMenu']
|
||||
NSpace: typeof import('naive-ui')['NSpace']
|
||||
NTable: typeof import('naive-ui')['NTable']
|
||||
NumeronymGenerator: typeof import('./src/tools/numeronym-generator/numeronym-generator.vue')['default']
|
||||
OtpCodeGeneratorAndValidator: typeof import('./src/tools/otp-code-generator-and-validator/otp-code-generator-and-validator.vue')['default']
|
||||
PasswordStrengthAnalyser: typeof import('./src/tools/password-strength-analyser/password-strength-analyser.vue')['default']
|
||||
@@ -184,6 +186,7 @@ declare module '@vue/runtime-core' {
|
||||
UserAgentParser: typeof import('./src/tools/user-agent-parser/user-agent-parser.vue')['default']
|
||||
UserAgentResultCards: typeof import('./src/tools/user-agent-parser/user-agent-result-cards.vue')['default']
|
||||
UuidGenerator: typeof import('./src/tools/uuid-generator/uuid-generator.vue')['default']
|
||||
VatValidator: typeof import('./src/tools/vat-validator/vat-validator.vue')['default']
|
||||
WifiQrCodeGenerator: typeof import('./src/tools/wifi-qr-code-generator/wifi-qr-code-generator.vue')['default']
|
||||
XmlFormatter: typeof import('./src/tools/xml-formatter/xml-formatter.vue')['default']
|
||||
XmlToJson: typeof import('./src/tools/xml-to-json/xml-to-json.vue')['default']
|
||||
|
||||
+1
-1
@@ -70,10 +70,10 @@
|
||||
"ibantools": "^4.3.3",
|
||||
"js-base64": "^3.7.6",
|
||||
"json5": "^2.2.3",
|
||||
"jsvat-next": "^3.0.4",
|
||||
"jwt-decode": "^3.1.2",
|
||||
"libphonenumber-js": "^1.10.28",
|
||||
"lodash": "^4.17.21",
|
||||
"luhn-js": "^1.1.2",
|
||||
"markdown-it": "^14.0.0",
|
||||
"marked": "^10.0.0",
|
||||
"mathjs": "^11.9.1",
|
||||
|
||||
Generated
+7
-7
@@ -107,6 +107,9 @@ dependencies:
|
||||
json5:
|
||||
specifier: ^2.2.3
|
||||
version: 2.2.3
|
||||
jsvat-next:
|
||||
specifier: ^3.0.4
|
||||
version: 3.0.4
|
||||
jwt-decode:
|
||||
specifier: ^3.1.2
|
||||
version: 3.1.2
|
||||
@@ -116,9 +119,6 @@ dependencies:
|
||||
lodash:
|
||||
specifier: ^4.17.21
|
||||
version: 4.17.21
|
||||
luhn-js:
|
||||
specifier: ^1.1.2
|
||||
version: 1.1.2
|
||||
markdown-it:
|
||||
specifier: ^14.0.0
|
||||
version: 14.1.0
|
||||
@@ -6672,6 +6672,10 @@ packages:
|
||||
engines: {node: '>=0.10.0'}
|
||||
dev: true
|
||||
|
||||
/jsvat-next@3.0.4:
|
||||
resolution: {integrity: sha512-Q9wV2xfBG8yaD4WkskQMLKWXy9vbU5GUABp9tIPldjp7eyLCGK4BLyIYxUP+lXr1E6pIbI0HlSBocF5YSqZduw==}
|
||||
dev: false
|
||||
|
||||
/jwt-decode@3.1.2:
|
||||
resolution: {integrity: sha512-UfpWE/VZn0iP50d8cz9NrZLM9lSWhcJ+0Gt/nm4by88UL+J1SiKN8/5dkjMmbEzwL2CAe+67GsegCbIKtbp75A==}
|
||||
dev: false
|
||||
@@ -6820,10 +6824,6 @@ packages:
|
||||
dependencies:
|
||||
yallist: 4.0.0
|
||||
|
||||
/luhn-js@1.1.2:
|
||||
resolution: {integrity: sha512-GdINoHY50s4Zkhvmt6Pss/8ZwVxIOLsMHuJCg6EDcT1heSt4hM2V+7aKCihemn8rI0n22+lxqomzgvWDzMyEuQ==}
|
||||
dev: false
|
||||
|
||||
/magic-string@0.25.9:
|
||||
resolution: {integrity: sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==}
|
||||
dependencies:
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@ import { tool as base64FileConverter } from './base64-file-converter';
|
||||
import { tool as base64StringConverter } from './base64-string-converter';
|
||||
import { tool as basicAuthGenerator } from './basic-auth-generator';
|
||||
import { tool as emailNormalizer } from './email-normalizer';
|
||||
import { tool as luhnValidator } from './luhn-validator';
|
||||
import { tool as vatValidator } from './vat-validator';
|
||||
|
||||
import { tool as asciiTextDrawer } from './ascii-text-drawer';
|
||||
|
||||
@@ -192,7 +192,7 @@ export const toolsByCategory: ToolCategory[] = [
|
||||
components: [
|
||||
phoneParserAndFormatter,
|
||||
ibanValidatorAndParser,
|
||||
luhnValidator,
|
||||
vatValidator,
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
import { Check } from '@vicons/tabler';
|
||||
import { defineTool } from '../tool';
|
||||
|
||||
export const tool = defineTool({
|
||||
name: 'Luhn Validator',
|
||||
path: '/luhn-validator',
|
||||
description: 'Check and generate key for identifier validated by a Luhn checknum',
|
||||
keywords: ['luhn', 'credit-card', 'imei', 'identifier', 'validator'],
|
||||
component: () => import('./luhn-validator.vue'),
|
||||
icon: Check,
|
||||
createdAt: new Date('2024-08-15'),
|
||||
});
|
||||
@@ -1,49 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import Luhn from 'luhn-js';
|
||||
import type { CKeyValueListItems } from '@/ui/c-key-value-list/c-key-value-list.types';
|
||||
|
||||
const rawValue = ref('44540661970241257');
|
||||
const cleanedValue = computed(() => rawValue.value.replace(/[^\d]/g, ''));
|
||||
const isValid = computed(() => {
|
||||
try {
|
||||
return Luhn.isValid(cleanedValue.value);
|
||||
}
|
||||
catch (_) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
const luhnInfos = computed<CKeyValueListItems>(() => {
|
||||
return [
|
||||
{
|
||||
label: 'Is valid ?',
|
||||
value: isValid.value,
|
||||
},
|
||||
{
|
||||
label: 'Luhn Key',
|
||||
value: (isValid.value
|
||||
? cleanedValue.value.slice(-1)
|
||||
: Luhn.generate(cleanedValue.value).slice(-1)) || '',
|
||||
},
|
||||
{
|
||||
label: 'Value with Luhn Key',
|
||||
value: (isValid.value
|
||||
? cleanedValue.value
|
||||
: Luhn.generate(cleanedValue.value)) || '',
|
||||
},
|
||||
];
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<c-input-text v-model:value="rawValue" placeholder="Enter a 'Luhn validated' value..." />
|
||||
<n-alert v-if="!isValid" type="error">
|
||||
Invalid Luhn Key.
|
||||
<input-copyable label="Probably correct" label-position="left" :value="Luhn.generate(cleanedValue)" disabled="true" />
|
||||
</n-alert>
|
||||
|
||||
<c-card v-if="luhnInfos.length > 0" mt-5 title="Infos">
|
||||
<c-key-value-list :items="luhnInfos" />
|
||||
</c-card>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,12 @@
|
||||
import { ReceiptTax } from '@vicons/tabler';
|
||||
import { defineTool } from '../tool';
|
||||
|
||||
export const tool = defineTool({
|
||||
name: 'VAT Numbers Validator',
|
||||
path: '/vat-validator',
|
||||
description: 'Validate VAT Numbers',
|
||||
keywords: ['vat', 'validator'],
|
||||
component: () => import('./vat-validator.vue'),
|
||||
icon: ReceiptTax,
|
||||
createdAt: new Date('2024-08-15'),
|
||||
});
|
||||
@@ -0,0 +1,58 @@
|
||||
<script setup lang="ts">
|
||||
import { checkVAT, countries } from 'jsvat-next';
|
||||
import type { CKeyValueListItems } from '@/ui/c-key-value-list/c-key-value-list.types';
|
||||
|
||||
const rawVATNumber = ref('BE0411905847');
|
||||
const vatInfos = computed<{ isValid: boolean; infos: CKeyValueListItems }>(() => {
|
||||
const vat = checkVAT(rawVATNumber.value, countries);
|
||||
if (vat == null) {
|
||||
return { isValid: false, infos: [] };
|
||||
}
|
||||
return {
|
||||
isValid: vat.isValid,
|
||||
infos: [
|
||||
{
|
||||
label: 'Is VAT Number valid ?',
|
||||
value: vat.isValid,
|
||||
},
|
||||
{
|
||||
label: 'Is VAT Number valid format ?',
|
||||
value: vat.isValidFormat,
|
||||
},
|
||||
{
|
||||
label: 'Cleaned VAT Number',
|
||||
value: vat.value,
|
||||
},
|
||||
{
|
||||
label: 'Country (name)',
|
||||
value: vat.country?.name || 'Unknown',
|
||||
},
|
||||
{
|
||||
label: 'Country (ISO2)',
|
||||
value: vat.country?.isoCode?.short || 'unk',
|
||||
},
|
||||
{
|
||||
label: 'Country (ISO3)',
|
||||
value: vat.country?.isoCode?.long || 'unk',
|
||||
},
|
||||
{
|
||||
label: 'Country (ISO Num)',
|
||||
value: vat.country?.isoCode?.numeric || 0,
|
||||
},
|
||||
],
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<c-input-text v-model:value="rawVATNumber" placeholder="Enter a VAT number to check for validity..." test-id="vat-input" mb-2 />
|
||||
<n-alert v-if="!vatInfos.isValid" type="error" mb-2>
|
||||
Invalid VAT Number.
|
||||
</n-alert>
|
||||
|
||||
<c-card v-if="vatInfos.infos.length > 0" title="VAT Number Infos">
|
||||
<c-key-value-list :items="vatInfos.infos" data-test-id="vat-info" />
|
||||
</c-card>
|
||||
</div>
|
||||
</template>
|
||||
Reference in new issue
Block a user