mirror of
https://github.com/iib0011/omni-tools.git
synced 2025-12-10 00:48:37 -06:00
chore: void input edge case added to service
This commit is contained in:
parent
8cc7986c7f
commit
ef034f2b8b
@ -1,20 +1,13 @@
|
||||
import { InitialValuesType } from './types';
|
||||
|
||||
export function main(input: string, options: InitialValuesType): string {
|
||||
return input;
|
||||
}
|
||||
|
||||
export function unicode(
|
||||
input: string,
|
||||
encode: boolean,
|
||||
uppercase: boolean
|
||||
): string {
|
||||
if (encode) {
|
||||
export function unicode(input: string, options: InitialValuesType): string {
|
||||
if (!input) return '';
|
||||
if (options.mode === 'encode') {
|
||||
let result = '';
|
||||
for (let i = 0; i < input.length; i++) {
|
||||
let hex = input.charCodeAt(i).toString(16);
|
||||
hex = ('0000' + hex).slice(-4);
|
||||
if (uppercase) {
|
||||
if (options.uppercase) {
|
||||
hex = hex.toUpperCase();
|
||||
}
|
||||
result += '\\u' + hex;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user