Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tg-format

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tg-format - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

10

index.js

@@ -10,2 +10,6 @@ const Escaped = { '<': '&lt;', '>': '&gt;', '&': '&amp;' };

function isFormattedLike(object) {
return object && 'text' in other && 'entities' in other && Array.isArray(entities);
}
class FormattedString {

@@ -32,4 +36,4 @@ constructor(...vals) {

} else
if (other instanceof FormattedString) {
// Merge entities
if (isFormattedLike(other)) {
// FormattedString or something similar; merge entities
const len = this.text.length;

@@ -117,3 +121,3 @@ this.text += other.text;

builder.append(expr[j++]);
} while (expr[j] instanceof FormattedString || Array.isArray(expr[j]));
} while (isFormattedLike(expr[j]) || Array.isArray(expr[j]));
const length = builder.text.length - offset;

@@ -120,0 +124,0 @@ for (; length && j < expr.length; j++, k++) {

{
"name": "tg-format",
"version": "1.0.1",
"version": "1.1.0",
"description": "A tiny Node.JS helper for sending formatted text messages using Telegram Bot API",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -81,9 +81,9 @@ # tg-format

```js
const formatted = fmt`Участники:\n${
users.map(user => fmt`\n${[
const formatted = fmt`Участники:\n\n${
FormattedString.join(users.map(user => fmt`${[
fmt`${[user.firstName, 'bold']} ${user.lastName}`,
{ type: 'text_link', url: user.website }
]}`)
]}`), '\n')
}`;
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc