Skip to content

Commit b34cc75

Browse files
committed
fix
1 parent bb1f872 commit b34cc75

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/tools/json-to-object/json-to-object.vue

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
<script setup lang="ts">
22
import JSON5 from 'json5';
3+
import stringifyObject from 'stringify-object';
34
import type { UseValidationRule } from '@/composable/validation';
45
import { isNotThrowing } from '@/utils/boolean';
56
import { withDefaultOnError } from '@/utils/defaults';
6-
import stringifyObject from "stringify-object"
7-
8-
const transformer = (value: string) => withDefaultOnError(() => stringifyObject(JSON5.parse(value), {
9-
indent: ' ',
10-
singleQuotes: false
11-
}), '');
127
8+
function transformer(value: string) {
9+
return withDefaultOnError(() => stringifyObject(JSON5.parse(value), {
10+
indent: ' ',
11+
singleQuotes: false,
12+
}), '');
13+
}
1314
1415
const rules: UseValidationRule<string>[] = [
1516
{
@@ -28,4 +29,4 @@ const rules: UseValidationRule<string>[] = [
2829
:input-validation-rules="rules"
2930
:transformer="transformer"
3031
/>
31-
</template>
32+
</template>

0 commit comments

Comments
 (0)