New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@puregram/markup

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@puregram/markup - npm Package Compare versions

Comparing version 1.3.0 to 1.3.1

7

lib/markup.d.ts

@@ -26,6 +26,7 @@ import { Hooks } from 'puregram/hooks';

}
type Rest = (StringLike | MarkupRepresentative)[];
interface MarkupElement {
(text: string): MarkupRepresentative;
(markup: MarkupRepresentative): MarkupRepresentative;
(strings: TemplateStringsArray, ...rest: (StringLike | MarkupRepresentative)[]): MarkupRepresentative;
(strings: TemplateStringsArray, ...rest: Rest): MarkupRepresentative;
}

@@ -115,3 +116,3 @@ interface MarkupRequiredElement<Fields extends string[]> {

*/
export declare function format(strings: TemplateStringsArray, ...rest: (StringLike | MarkupRepresentative)[]): Formatted;
export declare function format(strings: TemplateStringsArray, ...rest: Rest): Formatted;
/**

@@ -137,4 +138,4 @@ * The same as `format`, but this one strips all the leading spaces, not just the first group of spaces.

*/
export declare function formatDedent(strings: TemplateStringsArray, ...rest: (StringLike | MarkupRepresentative)[]): Formatted;
export declare function formatDedent(strings: TemplateStringsArray, ...rest: Rest): Formatted;
export declare const hooks: (() => Partial<Hooks>);
export {};

@@ -17,10 +17,8 @@ "use strict";

}
const constructMarkup = (type, strings, ...rest) => {
let text = '';
let offset = 0;
function process(parts, ...rest) {
let result = parts[0];
let offset = result.length;
const entities = [];
text += strings[0];
offset += text.length;
for (let i = 0; i < rest.length; i++) {
const frame = strings[i + 1];
const frame = parts[i + 1];
const arg = rest[i];

@@ -31,3 +29,5 @@ if (arg instanceof MarkupRepresentative) {

}
text += arg.text + frame;
const addition = arg.text + frame;
result += addition;
offset += addition.length;
entities.push(...arg.entities);

@@ -37,6 +37,10 @@ }

const addition = arg + frame;
text += addition;
result += addition;
offset += addition.length;
}
}
return { text: result, entities };
}
const constructMarkup = (type, strings, ...rest) => {
const { text, entities } = process(strings, ...rest);
return new MarkupRepresentative({

@@ -165,28 +169,2 @@ text,

exports.pre = buildWithField('pre', 'language');
function process(parts, ...rest) {
let result = '';
let offset = 0;
result += parts[0];
offset += result.length;
const entities = [];
for (let i = 0; i < rest.length; i++) {
const frame = parts[i + 1];
const arg = rest[i];
if (arg instanceof MarkupRepresentative) {
for (const entity of arg.entities) {
entity.offset += offset;
}
const addition = arg.text + frame;
result += addition;
offset += addition.length;
entities.push(...arg.entities);
}
else {
const addition = arg + frame;
result += addition;
offset += addition.length;
}
}
return new format_1.Formatted(result, entities.map(e => new puregram_1.MessageEntity(e)));
}
/**

@@ -223,3 +201,4 @@ * Formats provided text using **entities**, not **formatting mode**. Also supports multiline text.

}
return process(parts, ...rest);
const { text, entities } = process(parts, ...rest);
return new format_1.Formatted(text, entities.map(e => new puregram_1.MessageEntity(e)));
}

@@ -254,5 +233,7 @@ exports.format = format;

}
return process(parts, ...rest);
const { text, entities } = process(parts, ...rest);
return new format_1.Formatted(text, entities.map(e => new puregram_1.MessageEntity(e)));
}
exports.formatDedent = formatDedent;
// TODO: simplify...?
const hooks = () => ({

@@ -259,0 +240,0 @@ onBeforeRequest: [

{
"name": "@puregram/markup",
"version": "1.3.0",
"version": "1.3.1",
"description": "simple yet powerful markup system for puregram",

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

@@ -88,2 +88,29 @@ <div align='center'>

### `format(strings: TemplateStringsArray, ...rest: Rest)`
formats the template and strips first pack of spaces from all lines *(`stripIndent`-like)*
```js
format`
hello!
those two spaces at the start will be stripped
but those additional two spaces wont
`
```
### `formatDedent(strings: TemplateStringsArray, ...rest: Rest)`
this one acts like `format` except it... ugh just roll the ~~credits~~ code example
```js
format`
hello!
those two spaces at the start will be stripped
those additional two will also be stripped
and those additional 18 spaces too!
`
```
*(`stripIndents`-like)*
### `bold(text: string)`

@@ -90,0 +117,0 @@

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