Compare commits

..

4 Commits

Author SHA1 Message Date
Corentin Thomasset
cf5e4d9056 chore(release): 2.10.3 2022-08-14 10:55:06 +02:00
Corentin Thomasset
992f96b48a refactor(share): updated twitter meta tags 2022-08-14 10:53:45 +02:00
Corentin Thomasset
fcf4cfe64d refactor(share): new share banner 2022-08-14 10:53:39 +02:00
Corentin Thomasset
f54223fb0a refactor(validation): simplified validation management with helpers 2022-08-04 21:59:48 +02:00
10 changed files with 55 additions and 46 deletions

View File

@@ -2,6 +2,15 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
### [2.10.3](https://github.com/CorentinTh/it-tools/compare/v2.10.2...v2.10.3) (2022-08-14)
### Refactors
* **share:** new share banner ([fcf4cfe](https://github.com/CorentinTh/it-tools/commit/fcf4cfe64d4c1c3814137c8ff23b83a1ca0d502d))
* **share:** updated twitter meta tags ([992f96b](https://github.com/CorentinTh/it-tools/commit/992f96b48a89e2793ccf75fb9e28b2ec7b7f62b6))
* **validation:** simplified validation management with helpers ([f54223f](https://github.com/CorentinTh/it-tools/commit/f54223fb0aaedbd101b5d3dc4176053533bb936a))
### [2.10.2](https://github.com/CorentinTh/it-tools/compare/v2.10.1...v2.10.2) (2022-08-04)

View File

@@ -31,17 +31,21 @@
property="og:description"
content="Collection of handy online tools for developers, with great UX. IT Tools is a free and open-source collection of handy online tools for developers & people working in IT."
/>
<meta property="og:image" content="/banner.png" />
<meta property="og:image" content="https://it-tools.tech/banner.png" />
<meta name="twitter:card" content="summary_large_image" />
<meta property="twitter:domain" content="it-tools.tech" />
<meta property="twitter:url" content="https://it-tools.tech/" />
<meta name="twitter:domain" content="it-tools.tech" />
<meta name="twitter:url" content="https://it-tools.tech/" />
<meta name="twitter:site" content="@ittoolsdottech" />
<meta name="twitter:creator" content="@cthmsst" />
<meta name="twitter:title" content="IT Tools - Handy online tools for developers" />
<meta
name="twitter:description"
content="Collection of handy online tools for developers, with great UX. IT Tools is a free and open-source collection of handy online tools for developers & people working in IT."
/>
<meta name="twitter:image" content="/banner.png" />
<meta name="twitter:image" content="https://it-tools.tech/banner.png" />
<meta name="twitter:image:alt" content="IT Tools - Handy online tools for developers" />
</head>
<body>
<div id="app"></div>

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "it-tools",
"version": "2.10.2",
"version": "2.10.3",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "it-tools",
"version": "2.10.2",
"version": "2.10.3",
"license": "GNU GPLv3",
"dependencies": {
"@it-tools/bip39": "^0.0.4",

View File

@@ -1,6 +1,6 @@
{
"name": "it-tools",
"version": "2.10.2",
"version": "2.10.3",
"description": "Collection of handy online tools for developers, with great UX. ",
"keywords": [
"productivity",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB

After

Width:  |  Height:  |  Size: 155 KiB

View File

@@ -60,6 +60,7 @@
<script setup lang="ts">
import { useCopy } from '@/composable/copy';
import { useValidation } from '@/composable/validation';
import { isNotThrowing } from '@/utils/boolean';
import { withDefaultOnError } from '@/utils/defaults';
import {
chineseSimplifiedWordList,
@@ -98,11 +99,7 @@ const passphraseInput = ref('');
const language = ref<keyof typeof languages>('English');
const passphrase = computed({
get() {
try {
return entropyToMnemonic(entropy.value, languages[language.value]);
} catch (_) {
return passphraseInput.value;
}
return withDefaultOnError(() => entropyToMnemonic(entropy.value, languages[language.value]), passphraseInput.value);
},
set(value: string) {
passphraseInput.value = value;
@@ -128,14 +125,7 @@ const mnemonicValidation = useValidation({
source: passphrase,
rules: [
{
validator: (value) => {
try {
mnemonicToEntropy(value, languages[language.value]);
return true;
} catch (_) {
return false;
}
},
validator: (value) => isNotThrowing(() => mnemonicToEntropy(value, languages[language.value])),
message: 'Invalid mnemonic',
},
],

View File

@@ -60,6 +60,7 @@
<script setup lang="ts">
import { useCopy } from '@/composable/copy';
import { useValidation } from '@/composable/validation';
import { isNotThrowing } from '@/utils/boolean';
import { withDefaultOnError } from '@/utils/defaults';
import { computed, ref } from 'vue';
@@ -70,14 +71,7 @@ const encodedValidation = useValidation({
source: encodeInput,
rules: [
{
validator: (value) => {
try {
encodeURIComponent(value);
return true;
} catch (_) {
return false;
}
},
validator: (value) => isNotThrowing(() => encodeURIComponent(value)),
message: 'Impossible to parse this string',
},
],
@@ -92,14 +86,7 @@ const decodeValidation = useValidation({
source: encodeInput,
rules: [
{
validator: (value) => {
try {
decodeURIComponent(value);
return true;
} catch (_) {
return false;
}
},
validator: (value) => isNotThrowing(() => decodeURIComponent(value)),
message: 'Impossible to parse this string',
},
],

View File

@@ -27,10 +27,11 @@
</template>
<script setup lang="ts">
import { computed, ref } from 'vue';
import { SubdirectoryArrowRightRound } from '@vicons/material';
import { useValidation } from '@/composable/validation';
import { isNotThrowing } from '@/utils/boolean';
import { withDefaultOnError } from '@/utils/defaults';
import { SubdirectoryArrowRightRound } from '@vicons/material';
import { computed, ref } from 'vue';
import InputCopyable from '../../components/InputCopyable.vue';
const urlToParse = ref('https://me:pwd@it-tools.tech:3000/url-parser?key1=value&key2=value2#the-hash');
@@ -40,14 +41,7 @@ const validation = useValidation({
source: urlToParse,
rules: [
{
validator: (value) => {
try {
new URL(value);
return true;
} catch (_) {
return false;
}
},
validator: (value) => isNotThrowing(() => new URL(value)),
message: 'Invalid url',
},
],

15
src/utils/boolean.test.ts Normal file
View File

@@ -0,0 +1,15 @@
import { describe, expect, it } from 'vitest';
import { isNotThrowing } from './boolean';
describe('boolean utils', () => {
describe('isNotThrowing', () => {
it('should return if the call throws or false otherwise', () => {
expect(isNotThrowing(() => {})).to.eql(true);
expect(
isNotThrowing(() => {
throw new Error();
}),
).to.eql(false);
});
});
});

10
src/utils/boolean.ts Normal file
View File

@@ -0,0 +1,10 @@
export { isNotThrowing };
function isNotThrowing(cb: () => unknown): boolean {
try {
cb();
return true;
} catch (_) {
return false;
}
}