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

@contentful/rich-text-plain-text-renderer

Package Overview
Dependencies
Maintainers
39
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@contentful/rich-text-plain-text-renderer - npm Package Compare versions

Comparing version 9.0.0 to 9.0.1

76

dist/lib/__test__/index.test.js

@@ -65,5 +65,3 @@ "use strict";

data: {},
marks: [
{ type: 'bold' }
]
marks: [{ type: 'bold' }],
},

@@ -74,3 +72,3 @@ {

data: {},
marks: []
marks: [],
},

@@ -81,5 +79,3 @@ {

data: {},
marks: [
{ type: 'italic' }
]
marks: [{ type: 'italic' }],
},

@@ -90,3 +86,3 @@ {

data: {},
marks: []
marks: [],
},

@@ -101,13 +97,11 @@ {

data: {},
marks: [
{ type: 'bold' }
]
}
marks: [{ type: 'bold' }],
},
],
data: {
url: 'https://example.com',
title: 'qux'
}
}
]
title: 'qux',
},
},
],
},

@@ -133,3 +127,3 @@ {

data: {},
marks: []
marks: [],
},

@@ -144,13 +138,13 @@ {

data: {},
marks: []
}
marks: [],
},
],
data: {
url: 'https://google.com',
title: 'woo'
}
}
]
}
]
title: 'woo',
},
},
],
},
],
},

@@ -171,17 +165,27 @@ {

data: {},
marks: []
}
]
}
]
}
]
}
]
marks: [],
},
],
},
],
},
],
},
],
};
it('handles nested nodes gracefully', function () {
expect(index_1.documentToPlainTextString(document)).toEqual('Trout is a seafood delicacy. It is scrumptious.');
expect(index_1.documentToPlainTextString(document)).toEqual([
'This is text.',
'This is text with some marks.',
'This is text from a bolded hyperlink.',
'This is a list element in a separate block with a link with marks.',
'This is a separate list element in the same block.',
].join(' '));
});
it('defers to the user-supplied block divisor', function () {
expect(index_1.documentToPlainTextString(document, '\n\n')).toEqual('Trout is a seafood delicacy.\n\nIt is scrumptious.');
expect(index_1.documentToPlainTextString(document, '\n\n')).toEqual([
'This is text. This is text with some marks. This is text from a bolded hyperlink.',
'This is a list element in a separate block with a link with marks.',
'This is a separate list element in the same block.',
].join('\n\n'));
});

@@ -188,0 +192,0 @@ });

@@ -68,3 +68,3 @@ "use strict";

? node.value
: documentToPlainTextString(node);
: documentToPlainTextString(node, blockDivisor);
if (!nodeIsText && !nodeTextValue.length) {

@@ -75,5 +75,3 @@ return textValue;

var nextNode = childNodeList[i + 1];
var nodeIsInBlockSequence = (nextNode &&
!isText(nextNode) &&
nextNode.nodeClass === 'block');
var nodeIsInBlockSequence = nextNode && !isText(nextNode) && nextNode.nodeClass === 'block';
var divisor = nodeIsInBlockSequence ? blockDivisor : '';

@@ -80,0 +78,0 @@ return textValue + nodeTextValue + divisor;

@@ -70,3 +70,3 @@ 'use strict';

? node.value
: documentToPlainTextString(node);
: documentToPlainTextString(node, blockDivisor);
if (!nodeIsText && !nodeTextValue.length) {

@@ -77,5 +77,3 @@ return textValue;

var nextNode = childNodeList[i + 1];
var nodeIsInBlockSequence = (nextNode &&
!isText(nextNode) &&
nextNode.nodeClass === 'block');
var nodeIsInBlockSequence = nextNode && !isText(nextNode) && nextNode.nodeClass === 'block';
var divisor = nodeIsInBlockSequence ? blockDivisor : '';

@@ -82,0 +80,0 @@ return textValue + nodeTextValue + divisor;

{
"name": "@contentful/rich-text-plain-text-renderer",
"version": "9.0.0",
"version": "9.0.1",
"main": "dist/rich-text-plain-text-renderer.es5.js",

@@ -40,3 +40,3 @@ "typings": "dist/types/rich-text-plain-text-renderer.d.ts",

},
"gitHead": "7d6edbf9e64ae9b9206ee5432c72c7e0b0236eb5"
"gitHead": "95b9ffe910687bc2bae233e3333db9aaa4585c39"
}

@@ -50,1 +50,2 @@ # rich-text-plain-text-renderer

```

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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