diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 8c1f08a..6447329 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -7,10 +7,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout sources - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup latest deno version - uses: denolib/setup-deno@v2 + uses: denoland/setup-deno@main with: deno-version: v1.x @@ -24,10 +24,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout sources - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup latest deno version - uses: denolib/setup-deno@v2 + uses: denoland/setup-deno@main with: deno-version: v1.x diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml index 1ecdabd..cc9edac 100644 --- a/.github/workflows/update.yml +++ b/.github/workflows/update.yml @@ -13,7 +13,7 @@ on: version: description: 'Emoji Version' required: true - default: 14 + default: 15 jobs: publish: @@ -24,13 +24,12 @@ jobs: uses: actions/checkout@v3 - name: Setup Deno - # uses: denoland/setup-deno@v1 - uses: denoland/setup-deno@004814556e37c54a2f6e31384c9e18e983317366 + uses: denoland/setup-deno@main with: deno-version: v1.x - name: Run Update Script - run: deno run --allow-net --allow-write ./update.ts ${{ github.event.inputs.version }} + run: deno task update ${{ github.event.inputs.version }} - name: Run deno fmt run: deno fmt diff --git a/LICENSE b/LICENSE index 41e1668..f73db37 100644 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,6 @@ MIT License +Copyright (c) 2014 Daniel Bugl Copyright (c) 2020-2023 the denosaurs team Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/deno.lock b/deno.lock index a36efe5..b7e58e2 100644 --- a/deno.lock +++ b/deno.lock @@ -1,9 +1,9 @@ { "version": "2", "remote": { - "https://deno.land/std@0.183.0/fmt/colors.ts": "d67e3cd9f472535241a8e410d33423980bec45047e343577554d3356e1f0ef4e", - "https://deno.land/std@0.183.0/testing/_diff.ts": "1a3c044aedf77647d6cac86b798c6417603361b66b54c53331b312caeb447aea", - "https://deno.land/std@0.183.0/testing/_format.ts": "a69126e8a469009adf4cf2a50af889aca364c349797e63174884a52ff75cf4c7", - "https://deno.land/std@0.183.0/testing/asserts.ts": "e16d98b4d73ffc4ed498d717307a12500ae4f2cbe668f1a215632d19fcffc22f" + "https://deno.land/std@0.184.0/fmt/colors.ts": "d67e3cd9f472535241a8e410d33423980bec45047e343577554d3356e1f0ef4e", + "https://deno.land/std@0.184.0/testing/_diff.ts": "1a3c044aedf77647d6cac86b798c6417603361b66b54c53331b312caeb447aea", + "https://deno.land/std@0.184.0/testing/_format.ts": "a69126e8a469009adf4cf2a50af889aca364c349797e63174884a52ff75cf4c7", + "https://deno.land/std@0.184.0/testing/asserts.ts": "e16d98b4d73ffc4ed498d717307a12500ae4f2cbe668f1a215632d19fcffc22f" } } diff --git a/emoji.ts b/emoji.ts index 4b464db..3778115 100644 --- a/emoji.ts +++ b/emoji.ts @@ -7,9 +7,6 @@ export { Emoji }; // Regex to parse emoji in a string - e.g. :coffee: const reEmojiName = /:([a-zA-Z0-9_\-\+]+):/g; -// Regex to trim whitespace. (with IE8 support) -const reTrimSpace = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g; - // Non spacing mark, some emoticons have them. It's the 'Variant Form', // which provides more information so that emoticons can be rendered as // more colorful graphics. FE0E is a unicode text version, where as FE0F @@ -28,11 +25,10 @@ function stripColons(str: string): string { if (colonIndex > -1) { if (colonIndex === str.length - 1) { str = str.substring(0, colonIndex); - return stripColons(str); } else { - str = str.substr(colonIndex + 1); - return stripColons(str); + str = str.substring(colonIndex + 1); } + return stripColons(str); } return str; @@ -128,7 +124,7 @@ export function replace( return emoji ? replace(emoji) : s; }) .join(""); - return trim ? result.replace(reTrimSpace, "") : result; + return trim ? result.trim() : result; } /** Replace all emoji names in a string with actual emojis. */ diff --git a/emoji.test.ts b/emoji_test.ts similarity index 94% rename from emoji.test.ts rename to emoji_test.ts index 219d760..e4db045 100644 --- a/emoji.test.ts +++ b/emoji_test.ts @@ -1,4 +1,4 @@ -import { assertEquals } from "https://deno.land/std@0.183.0/testing/asserts.ts"; +import { assertEquals } from "https://deno.land/std@0.184.0/testing/asserts.ts"; import * as emj from "./emoji.ts"; Deno.test({