a collection of lightweight TypeScript packages for AT Protocol, the protocol powering Bluesky
atproto bluesky typescript npm
101
fork

Configure Feed

Select the types of activity you want to include in your feed.

refactor(bluesky-richtext-builder): change `substr` param name to `text`

Mary ef715567 33375f91

+19 -14
+5
.changeset/polite-goats-travel.md
··· 1 + --- 2 + '@atcute/bluesky-richtext-builder': patch 3 + --- 4 + 5 + change `substr` param name to `text`
+14 -14
packages/bluesky/richtext-builder/lib/index.ts
··· 64 64 65 65 /** 66 66 * Add plain text to the rich text 67 - * @param substr The plain text 67 + * @param text The plain text 68 68 * @returns The builder instance, for chaining 69 69 */ 70 - addText(substr: string): this { 70 + addText(text: string): this { 71 71 const segments = this.#segments; 72 - segments[segments.length - 1] += substr; 72 + segments[segments.length - 1] += text; 73 73 74 74 return this; 75 75 } 76 76 77 77 /** 78 78 * Add decorated text to the rich text 79 - * @param substr The text itself 79 + * @param text The text itself 80 80 * @param feature Feature to imbue on the text 81 81 * @returns The builder instance, for chaining 82 82 */ 83 - addDecoratedText(substr: string, feature: FacetFeature): this { 83 + addDecoratedText(text: string, feature: FacetFeature): this { 84 84 const segments = this.#segments; 85 85 const last = segments.length - 1; 86 86 ··· 92 92 start += (segments[last - 1] as Facet).index.byteEnd; 93 93 } 94 94 95 - const byteLength = getUtf8Length(substr); 95 + const byteLength = getUtf8Length(text); 96 96 97 97 const facet: Facet = { 98 98 index: { ··· 102 102 features: [feature], 103 103 }; 104 104 105 - segments[last] += substr; 105 + segments[last] += text; 106 106 segments.push(facet, ''); 107 107 return this; 108 108 } 109 109 110 110 /** 111 111 * Add link to the rich text 112 - * @param substr Text of the link 112 + * @param text Text of the link 113 113 * @param uri Valid URL, for example: https://example.com 114 114 * @returns The builder instance, for chaining 115 115 */ 116 - addLink(substr: string, uri: GenericUri): this { 117 - return this.addDecoratedText(substr, { $type: 'app.bsky.richtext.facet#link', uri: uri }); 116 + addLink(text: string, uri: GenericUri): this { 117 + return this.addDecoratedText(text, { $type: 'app.bsky.richtext.facet#link', uri: uri }); 118 118 } 119 119 120 120 /** 121 - * Mentions a user in rich text 122 - * @param substr Text of the mention, this is usually in the form of `@handle` 121 + * Mention a user in rich text 122 + * @param text Text of the mention, usually in the form of `@handle` 123 123 * @param did Valid DID, for example: did:plc:ia76kvnndjutgedggx2ibrem 124 124 * @returns The builder instance, for chaining 125 125 */ 126 - addMention(substr: string, did: Did): this { 127 - return this.addDecoratedText(substr, { $type: 'app.bsky.richtext.facet#mention', did: did }); 126 + addMention(text: string, did: Did): this { 127 + return this.addDecoratedText(text, { $type: 'app.bsky.richtext.facet#mention', did: did }); 128 128 } 129 129 130 130 /**