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

rtf-parser

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rtf-parser - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

2

package.json
{
"name": "rtf-parser",
"version": "1.0.2",
"version": "1.0.3",
"description": "This is a general RTF parser. It takes a text stream and produces a document object representing the parsed document. In and of itself, this isn't super useful but it's the building block for other tools to convert RTF into other formats.",

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

@@ -49,6 +49,19 @@ 'use strict'

if (node.content.length) {
node.style = Object.assign({}, node.content[0].style)
node.style.font = this.getFont(node.style.font)
node.style.foreground = this.getColor(node.style.foreground)
node.style.background = this.getColor(node.style.background)
const initialStyle = node.content[0].style
const style = {}
style.font = this.getFont(initialStyle.font)
style.foreground = this.getColor(initialStyle.foreground)
style.background = this.getColor(initialStyle.background)
for (let prop of Object.keys(initialStyle)) {
if (initialStyle[prop] == null) continue
let match = true
for (let span of node.content) {
if (initialStyle[prop] !== span.style[prop]) {
match = false
break
}
}
if (match) style[prop] = initialStyle[prop]
}
node.style = style
}

@@ -55,0 +68,0 @@ } else {

@@ -43,2 +43,13 @@ 'use strict'

this.doc.addContent(new RTFParagraph())
const initialStyle = this.doc.content[0].style
for (let prop of Object.keys(this.doc.style)) {
let match = true
for (let para of this.doc.content) {
if (initialStyle[prop] !== para.style[prop]) {
match = false
break
}
}
if (match) this.doc.style[prop] = initialStyle[prop]
}
})

@@ -45,0 +56,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