aboutsummaryrefslogtreecommitdiff
path: root/src/tools/url-encoder/url-encoder.vue
blob: e178353ae827ae513d3392d4d3d08bb3b9e5d10b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<template>
  <div>
    <n-card title="Encode">
      <n-form-item
        label="Your string :"
        :feedback="encodedValidation.message"
        :validation-status="encodedValidation.status"
      >
        <n-input
          v-model:value="encodeInput"
          type="textarea"
          placeholder="The string to encode"
          :autosize="{ minRows: 2 }"
        />
      </n-form-item>

      <n-form-item label="Your string encoded :">
        <n-input
          :value="encodeOutput"
          type="textarea"
          readonly
          placeholder="Your string encoded"
          :autosize="{ minRows: 2 }"
        />
      </n-form-item>

      <n-space justify="center">
        <n-button secondary @click="copyEncoded"> Copy </n-button>
      </n-space>
    </n-card>
    <br />
    <n-card title="Decode">
      <n-form-item
        label="Your encoded string :"
        :feedback="decodeValidation.message"
        :validation-status="decodeValidation.status"
      >
        <n-input
          v-model:value="decodeInput"
          type="textarea"
          placeholder="The string to decode"
          :autosize="{ minRows: 2 }"
        />
      </n-form-item>

      <n-form-item label="Your string decoded :">
        <n-input
          :value="decodeOutput"
          type="textarea"
          readonly
          placeholder="Your string decoded"
          :autosize="{ minRows: 2 }"
        />
      </n-form-item>

      <n-space justify="center">
        <n-button secondary @click="copyDecoded"> Copy </n-button>
      </n-space>
    </n-card>
  </div>
</template>

<script setup lang="ts">
import { useCopy } from '@/composable/copy';
import { useValidation } from '@/composable/validation';
import { computed, ref } from 'vue';

const encodeInput = ref('Hello world :)');
const encodeOutput = computed(() => {
  try {
    return encodeURIComponent(encodeInput.value);
  } catch (_) {
    return '';
  }
});

const encodedValidation = useValidation({
  source: encodeInput,
  rules: [
    {
      validator: (value) => {
        try {
          encodeURIComponent(value);
          return true;
        } catch (_) {
          return false;
        }
      },
      message: 'Impossible to parse this string',
    },
  ],
});

const { copy: copyEncoded } = useCopy({ source: encodeOutput, text: 'Encoded string copied to the clipboard' });

const decodeInput = ref('Hello%20world%20%3A)');

const decodeOutput = computed(() => {
  try {
    return decodeURIComponent(decodeInput.value);
  } catch (_) {
    return '';
  }
});

const decodeValidation = useValidation({
  source: encodeInput,
  rules: [
    {
      validator: (value) => {
        try {
          decodeURIComponent(value);
          return true;
        } catch (_) {
          return false;
        }
      },
      message: 'Impossible to parse this string',
    },
  ],
});

const { copy: copyDecoded } = useCopy({ source: decodeOutput, text: 'Decoded string copied to the clipboard' });
</script>
lugin/resolvedir'>plugin/resolvedir Unnamed repository; edit this file 'description' to name the repository.
aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/modules/StringDecoderModule.h (unfollow)
AgeCommit message (Expand)AuthorFilesLines
2022-11-15Update ZigGlobalObject.cppGravatar Jarred Sumner 1-3/+1
2022-11-15Add a test with decently large headersGravatar Jarred Sumner 1-0/+61
2022-11-15Update test types a littleGravatar Jarred Sumner 1-2/+2
2022-11-15Add missing typeGravatar Jarred Sumner 1-0/+5
2022-11-14switch default encoding order (#1510)Gravatar Dylan Conway 1-1/+1
2022-11-14Fix spawn macOS issueGravatar Jarred Sumner 1-7/+11
2022-11-14Fix crash in web crypto. caused by refptrGravatar Jarred Sumner 3-2/+15
2022-11-14Fix crashiness with `process.env`Gravatar Jarred Sumner 2-27/+66
2022-11-14Fix string encoding issue in JSC C API usagesGravatar Jarred Sumner 3-139/+74
2022-11-14Prevent double-frees in log msgsGravatar Jarred Sumner 1-4/+15
2022-11-14Fix build errorGravatar Jarred SUmner 2-6/+1
2022-11-14Bugfixes and perf improvements to child_processGravatar Jarred SUmner 15-192/+416
2022-11-13use `write$NOCANCEL`, more loggingGravatar Jarred Sumner 3-12/+42
2022-11-13Add an e2e testGravatar Jarred Sumner 3-0/+52
2022-11-13Add missing `rmdir` exportGravatar Jarred Sumner 1-1/+2
2022-11-13Make node streams faster (#1502)Gravatar Jarred Sumner 23-406/+836
2022-11-13Fix incorrect exit status messageGravatar Jarred Sumner 1-3/+6
2022-11-12Fix syntax errorGravatar Jarred Sumner 1-2/+2
2022-11-12Set linker script to Bun 0.2Gravatar Jarred SUmner 1-1/+1
2022-11-12Fix infinite write loop on LinuxGravatar Jarred SUmner 3-44/+185
2022-11-12Add missing typeGravatar Jarred SUmner 1-1/+1
2022-11-12Add linker script to remove unwanted exports (#1499)Gravatar Tom Birch 2-1/+9
2022-11-12Fix memory leak in gzip pool + add test for gzip'd dataGravatar Jarred SUmner 7-62/+1530
2022-11-12Redo how we poll pipes (#1496)Gravatar Jarred Sumner 22-707/+1251
2022-11-11Add test that fails on linuxGravatar Jarred Sumner 7-21/+42
2022-11-112 framesGravatar Jarred Sumner 1-1/+1
2022-11-11Revert "Omit frame pointer"Gravatar Jarred Sumner 1-0/+1
2022-11-11Don't rm cachedGravatar Jarred Sumner 4-4/+0
2022-11-11try thisGravatar Jarred Sumner 4-0/+4
2022-11-11Update bun-linux-build.ymlGravatar Jarred Sumner 1-1/+0
2022-11-11try using git actionGravatar Jarred Sumner 4-7/+8
2022-11-11Remove with `git rm`Gravatar Jarred Sumner 2-8/+0