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

canvas-native

Package Overview
Dependencies
Maintainers
2
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

canvas-native - npm Package Compare versions

Comparing version 2.3.3 to 2.3.4

18

dist/lib/formatters/summary.js

@@ -23,2 +23,13 @@ 'use strict';

/**
* @module Formatters.Summary
/**
* Format a CanvasNative document as a summary.
*
* @static
* @param {string} native A CanvasNative string
* @return {string} The summarized CanvasNative string
*/
function format(native) {

@@ -52,3 +63,8 @@ var result = '';

var next = (0, _removeMarkdown2['default'])(nextContent).replace(/\.?$/, '. ');
var next = (0, _removeMarkdown2['default'])(nextContent);
if (!/[.?!]$/.test(next)) {
next = next + '. ';
} else {
next = next + ' ';
}

@@ -55,0 +71,0 @@ if (next.length + result.length > 256) {

@@ -6,2 +6,12 @@ import Scanner from '../scanner';

/**
* @module Formatters.Summary
/**
* Format a CanvasNative document as a summary.
*
* @static
* @param {string} native A CanvasNative string
* @return {string} The summarized CanvasNative string
*/
export default function format(native) {

@@ -26,3 +36,8 @@ let result = '';

const next = stripMd(nextContent).replace(/\.?$/, '. ');
let next = stripMd(nextContent);
if (!/[.?!]$/.test(next)) {
next = `${next}. `;
} else {
next = `${next} `;
}

@@ -29,0 +44,0 @@ if (next.length + result.length > 256) {

2

package.json
{
"name": "canvas-native",
"description": "Utilities for working with the native Canvas format",
"version": "2.3.3",
"version": "2.3.4",
"author": "Jonathan Clem <jonathan@usecanvas.com>",

@@ -6,0 +6,0 @@ "bugs": "https://github.com/usecanvas/canvas-native/issues",

@@ -22,2 +22,9 @@ import format from '../../../lib/formatters/summary';

});
['!', '?'].forEach(punct => {
it(`does not add a period after existing "${punct}" punctuation`, () => {
const doc = parse(`Foo${punct}\nBar`);
expect(format(doc)).to.eq(`Foo${punct} Bar.`);
});
});
});
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