Skip to content

Commit

Permalink
🔀 #11 - fix: merge duplicate string formatting lib
Browse files Browse the repository at this point in the history
  • Loading branch information
svenvandescheur committed Feb 6, 2024
1 parent 0247278 commit 7976b2c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
17 changes: 17 additions & 0 deletions src/lib/format/string.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/** Matches a URL. */
export const REGEX_URL = /https?:\/\/[^\s]+$/;

/**
* Returns whether `string` is a link according to `REGEX_URL`.
* @param string
*/
export const isLink = (string: string): boolean =>
Boolean(string.match(REGEX_URL));

/**
* Converts "field_name" to "FIELD NAME".
* @param field
*/
export const field2Caption = (field: string): string =>
String(field).replaceAll("_", " ").toUpperCase();

/**
* Converts "Some object name" to "some-object-name".
* @param input
Expand Down
16 changes: 0 additions & 16 deletions src/lib/format/string.tsx

This file was deleted.

0 comments on commit 7976b2c

Please sign in to comment.