Merge branch 'feat/json-escape' into chore/all-my-stuffs

# Conflicts:
#	package.json
#	pnpm-lock.yaml
#	src/tools/index.ts
This commit is contained in:
ShareVB committed 2024-11-03 22:59:11 +01:00
commit 0622e17590
5 files changed
+102 -1

No files matched your search

+1
View File
@@ -266,6 +266,7 @@
"potrace": "^2.1.8",
"qrcode": "^1.5.1",
"rtf-stream-parser": "^3.8.0",
"slashes": "^3.0.12",
"sql-formatter": "^13.0.0",
"sshpk": "^1.18.0",
"turndown": "^7.1.2",
+9 -1
View File
@@ -554,6 +554,9 @@ dependencies:
silly-password-generator:
specifier: ^1.0.28
version: 1.0.28
slashes:
specifier: ^3.0.12
version: 3.0.12
sql-formatter:
specifier: ^13.0.0
version: 13.0.0
@@ -9667,6 +9670,7 @@ packages:
/glob@7.2.3:
resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==}
deprecated: Glob versions prior to v9 are no longer supported
dependencies:
fs.realpath: 1.0.0
inflight: 1.0.6
@@ -10933,7 +10937,6 @@ packages:
/jsesc@2.5.2:
resolution: {integrity: sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==}
engines: {node: '>=4'}
hasBin: true
/jsesc@3.0.2:
resolution: {integrity: sha512-xKqzzWXDttJuOcawBt4KnKHHIf5oQ/Cxax+0PWFG+DFDgHNAdi+TXECADI+RYiFUMmx8792xsMbbgXj4CwnP4g==}
@@ -13777,6 +13780,10 @@ packages:
resolution: {integrity: sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==}
engines: {node: '>=12'}
/slashes@3.0.12:
resolution: {integrity: sha512-Q9VME8WyGkc7pJf6QEkj3wE+2CnvZMI+XJhwdTPR8Z/kWQRXi7boAWLDibRPyHRTUTPx5FaU7MsyrjI3yLB4HA==}
dev: false
/snake-case@2.1.0:
resolution: {integrity: sha512-FMR5YoPFwOLuh4rRz92dywJjyKYZNLpMn1R5ujVpIYkbA9p01fq8RMg0FkO4M+Yobt4MjHeLTJVm5xFFBHSV2Q==}
dependencies:
@@ -16226,6 +16233,7 @@ packages:
/yamljs@0.3.0:
resolution: {integrity: sha512-C/FsVVhht4iPQYXOInoxUM/1ELSf9EsgKH34FofQOp6hwCPrW4vG4w5++TED3xRUo8gD7l0P1J1dLlDYzODsTQ==}
hasBin: true
dependencies:
argparse: 1.0.10
glob: 7.2.3
+2
View File
@@ -118,6 +118,7 @@ import { tool as fileType } from './file-type';
import { tool as htmlCleaner } from './html-cleaner';
import { tool as imageToAsciiArt } from './image-to-ascii-art';
import { tool as ipv6SubnetCalculator } from './ipv6-subnet-calculator';
import { tool as jsonEscaper } from './json-escaper';
import { tool as pdfSignatureChecker } from './pdf-signature-checker';
import { tool as numeronymGenerator } from './numeronym-generator';
import { tool as macAddressGenerator } from './mac-address-generator';
@@ -335,6 +336,7 @@ export const toolsByCategory: ToolCategory[] = [
phpArrayToJson,
torrentToMagnet,
unicodeSearch,
jsonEscaper,
],
},
{
+12
View File
@@ -0,0 +1,12 @@
import { Braces } from '@vicons/tabler';
import { defineTool } from '../tool';
export const tool = defineTool({
name: 'Json Escaper/Unescaper',
path: '/json-escaper',
description: 'Escape and unescape JSON string',
keywords: ['json', 'string', 'escape', 'unescape'],
component: () => import('./json-escaper.vue'),
icon: Braces,
createdAt: new Date('2024-03-09'),
});
+78
View File
@@ -0,0 +1,78 @@
<script setup lang="ts">
import { addSlashes, removeSlashes } from 'slashes';
import TextareaCopyable from '@/components/TextareaCopyable.vue';
const unescapedInput = ref('');
const escapedOutput = computed(
() => {
try {
return addSlashes(unescapedInput.value);
}
catch (e: any) {
return e.toString();
}
},
);
const escapedInput = ref('');
const unescapedOutput = computed(
() => {
try {
return removeSlashes(escapedInput.value);
}
catch (e: any) {
return e.toString();
}
},
);
</script>
<template>
<div max-w-600>
<c-card title="Escape JSON string">
<c-input-text
v-model:value="unescapedInput"
placeholder="Put your string to escape..."
label="String to escape"
raw-text
multiline
rows="5"
mb-5
/>
<n-divider />
<TextareaCopyable
label="Escaped string"
:value="escapedOutput"
multiline
readonly
rows="5"
mb-5
/>
</c-card>
<c-card title="Unescape JSON string" mt-5>
<c-input-text
v-model:value="escapedInput"
placeholder="Put your string to unescape..."
label="String to unescape"
raw-text
multiline
rows="5"
mb-5
/>
<n-divider />
<TextareaCopyable
label="Unescaped string"
:value="unescapedOutput"
multiline
readonly
rows="5"
mb-5
/>
</c-card>
</div>
</template>