Skip to content

Commit

Permalink
Merge pull request DefinitelyTyped#437 from DefinitelyTyped/bug/other…
Browse files Browse the repository at this point in the history
…-owners-merge

Allow other owners to merge when infrastructure is edited
  • Loading branch information
andrewbranch authored Mar 31, 2022
2 parents 7264be7 + 2754257 commit 5485345
Show file tree
Hide file tree
Showing 7 changed files with 502 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/_tests/fixtures/59628/_downloads.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"twemoji": 242870
}
3 changes: 3 additions & 0 deletions src/_tests/fixtures/59628/_files.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"e11ae5d76bb7c11e606ed5aa0e47c1f1e81fd88d:types/twemoji/index.d.ts": "// Type definitions for twemoji 12.1\n// Project: https://github.com/twitter/twemoji\n// Definitions by: Markus Tacker <https://github.com/coderbyheart>\n// Piotr Błażejewicz <https://github.com/peterblazejewicz>\n// David Wheatley <https://github.com/davwheat>\n// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped\n// TypeScript Version: 2.2\n\n/**\n * A simple library that provides standard Unicode emoji support across all platforms.\n * Twemoji v12.0 adheres to the Unicode 12.0 spec and supports the Emoji 12.0 spec\n * The Twemoji library offers support for 3,075 emojis.\n */\nexport as namespace twemoji;\n\n/**\n * default assets url, by default will be Twitter Inc. CDN\n */\nexport const base: string;\n\n/**\n * default assets file extensions, by default '.png'\n */\nexport const ext: string;\n\n/**\n * default assets/folder size, by default \"72x72\"\n * available via Twitter CDN: 72\n */\nexport const size: string;\n\n/**\n * default class name, by default 'emoji'\n */\nexport const className: string;\n\n/**\n * basic utilities / helpers to convert code points\n * to JavaScript surrogates and vice versa\n */\nexport const convert: {\n /**\n * Given an HEX codepoint, returns UTF16 surrogate pairs.\n *\n * @param codepoint string generic codepoint, i.e. '1F4A9'\n * @return string codepoint transformed into utf16 surrogates pair,\n * i.e. \\uD83D\\uDCA9\n *\n * @example\n * twemoji.convert.fromCodePoint('1f1e8');\n * // \"\\ud83c\\udde8\"\n *\n * '1f1e8-1f1f3'.split('-').map(twemoji.convert.fromCodePoint).join('')\n * // \"\\ud83c\\udde8\\ud83c\\uddf3\"\n */\n fromCodePoint: (codepoint: string) => string;\n\n /**\n * Given UTF16 surrogate pairs, returns the equivalent HEX codepoint.\n *\n * @param unicodeSurrogates string generic utf16 surrogates pair, i.e. \\uD83D\\uDCA9\n * @param sep string optional separator for double code points, default='-'\n * @return string utf16 transformed into codepoint, i.e. '1F4A9'\n *\n * @example\n * twemoji.convert.toCodePoint('\\ud83c\\udde8\\ud83c\\uddf3');\n * // \"1f1e8-1f1f3\"\n *\n * twemoji.convert.toCodePoint('\\ud83c\\udde8\\ud83c\\uddf3', '~');\n * // \"1f1e8~1f1f3\"\n */\n toCodePoint: (unicodeSurrogates: string, sep?: string) => string;\n};\n\n/**\n * User first: used to remove missing images\n * preserving the original text intent when\n * a fallback for network problems is desired.\n * Automatically added to Image nodes via DOM\n * It could be recycled for string operations via:\n * $('img.emoji').on('error', twemoji.onerror)\n */\nexport function onerror(): void;\n\n/**\n * Given a string, invokes the callback argument\n * per each emoji found in such string.\n * This is the most raw version used by\n * the .parse(string) method itself.\n *\n * @param text string generic string to parse\n * @param callback Function a generic callback that will be\n * invoked to replace the content.\n * This calback wil receive standard\n * String.prototype.replace(str, callback)\n * arguments such:\n * callback(\n * rawText, // the emoji match\n * );\n *\n * and others commonly received via replace.\n */\nexport function replace(text: string, callback: () => void): string;\n\n/**\n * Simplify string tests against emoji.\n *\n * @param text string some text that might contain emoji\n * @return boolean true if any emoji was found, false otherwise.\n *\n * @example\n *\n * if (twemoji.test(someContent)) {\n * console.log(\"emoji All The Things!\");\n * }\n */\nexport function test(text: string): boolean;\n\n/**\n * If given to parse, this callback will be invoked per each found emoji.\n *\n * If this callback returns a falsy value instead of a valid `src` to use for the image, nothing will actually change for that specific emoji.\n *\n * @param icon the lower case HEX code point i.e. \"1f4a9\"\n * @param options all info for this parsing operation\n * @param variant the optional \\uFE0F (\"as image\") variant, in case this info is anyhow meaningful. By default this is ignored.\n */\nexport type ParseCallback = (icon: string, options: object, variant: string) => string | false;\n\n/**\n * If given to parse, this object with all properties will be used per each found emoji.\n *\n * callback Function the callback to invoke per each found emoji.\n * base string the base url, by default twemoji.base\n * ext string the image extension, by default twemoji.ext\n * size string the assets size, by default twemoji.size\n */\nexport interface ParseObject {\n /**\n * the callback to invoke per each found emoji.\n *\n * default: the common replacer\n */\n callback: ParseCallback;\n /**\n * The function to invoke in order to generate additional, custom attributes for the image tag.\n *\n * @param the lower case HEX code point i.e. \"1f4a9\"\n * @param variant the optional \\uFE0F (\"as image\") variant, in case this info is anyhow meaningful. By default this is ignored.\n */\n attributes: (icon: string, variant: string) => object;\n /**\n * default: MaxCDN\n */\n base: string;\n /**\n * default: \".png\"\n */\n ext: string;\n /**\n * default: \"emoji\"\n */\n className: string;\n /**\n * default: \"72x72\"\n */\n size: string | number;\n /**\n * in case it's specified it replaces .size info, if any\n */\n folder: string;\n}\n\n/**\n * Main method/logic to generate either <img> tags or HTMLImage nodes.\n * \"emojify\" a generic text or DOM Element.\n *\n * @overloads\n *\n * String replacement for `innerHTML` or server side operations\n * twemoji.parse(string);\n * twemoji.parse(string, Function);\n * twemoji.parse(string, Object);\n *\n * HTMLElement tree parsing for safer operations over existing DOM\n * twemoji.parse(HTMLElement);\n * twemoji.parse(HTMLElement, Function);\n * twemoji.parse(HTMLElement, Object);\n *\n * @param what string|HTMLElement the source to parse and enrich with emoji.\n *\n * string replace emoji matches with <img> tags.\n * Mainly used to inject emoji via `innerHTML`\n * It does **not** parse the string or validate it,\n * it simply replaces found emoji with a tag.\n * NOTE: be sure this won't affect security.\n *\n * HTMLElement walk through the DOM tree and find emoji\n * that are inside **text node only** (nodeType === 3)\n * Mainly used to put emoji in already generated DOM\n * without compromising surrounding nodes and\n * **avoiding** the usage of `innerHTML`.\n * NOTE: Using DOM elements instead of strings should\n * improve security without compromising too much\n * performance compared with a less safe `innerHTML`.\n *\n * @param how object|Function\n *\n * @example\n *\n * twemoji.parse(\"I \\u2764\\uFE0F emoji!\");\n * // I <img class=\"emoji\" draggable=\"false\" alt=\"❤️\" src=\"/assets/2764.gif\"/> emoji!\n *\n *\n * twemoji.parse(\"I \\u2764\\uFE0F emoji!\", function(iconId, options) {\n * return '/assets/' + iconId + '.gif';\n * });\n * // I <img class=\"emoji\" draggable=\"false\" alt=\"❤️\" src=\"/assets/2764.gif\"/> emoji!\n *\n *\n * twemoji.parse(\"I \\u2764\\uFE0F emoji!\", {\n * size: 72,\n * callback: function(iconId, options) {\n * return '/assets/' + options.size + '/' + iconId + options.ext;\n * }\n * });\n * // I <img class=\"emoji\" draggable=\"false\" alt=\"❤️\" src=\"/assets/72x72/2764.png\"/> emoji!\n */\nexport function parse<T extends string | HTMLElement>(what: T, how?: Partial<ParseObject> | ParseCallback): T;\n"
}
Loading

0 comments on commit 5485345

Please sign in to comment.