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

cdocparser

Package Overview
Dependencies
Maintainers
3
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cdocparser - npm Package Compare versions

Comparing version 0.13.0 to 0.14.0

test/fixtures/posterOverwrite.test.scss

19

index.js

@@ -8,2 +8,3 @@ 'use strict';

var escapeStringRegexp = require('escape-string-regexp');
var union = require('lodash.union');

@@ -252,2 +253,7 @@ /**

var isOverwritePoster = function(annotation){
return annotation.overwritePoster === true;
};
var getContent = function(line, match){

@@ -372,5 +378,12 @@ return line.substr(match.index + match[0].length).replace(/^[ \t]+|[ \t]+$/g,'');

Object.keys(posterComment).forEach(function(key){
if (parsedComment[key] === undefined &&
isAnnotationAllowed(parsedComment, annotations[key])){
parsedComment[key] = posterComment[key];
if (annotations[key] === undefined) return;
var annotation = annotations[key];
if ( isAnnotationAllowed(parsedComment, annotation) ) {
if (parsedComment[key] === undefined) {
parsedComment[key] = posterComment[key];
} else if (isOverwritePoster(annotation)) {
posterComment[key] = parsedComment[key];
} else {
parsedComment[key] = union(posterComment[key], parsedComment[key]);
}
}

@@ -377,0 +390,0 @@ });

3

package.json
{
"name": "cdocparser",
"version": "0.13.0",
"version": "0.14.0",
"description": "Extract C style comments and extract context from source",

@@ -31,4 +31,5 @@ "main": "index.js",

"lodash.assign": "^2.4.1",
"lodash.union": "^3.1.0",
"strip-indent": "^1.0.0"
}
}

@@ -165,3 +165,5 @@ CDocParser

multiple : true
multiple : true,
overwritePoster : true
}

@@ -226,2 +228,6 @@ ```

### `overwritePoster` key
The `overwritePoster` key is used to control if a this annotation used on an item will overwrite a poster comment.
## Development

@@ -228,0 +234,0 @@

@@ -221,2 +221,13 @@ var fs = require('fs');

},
poster : {
parse : function(commentLine){
return commentLine;
}
},
posterOverwrite : {
parse : function(commentLine){
return commentLine;
},
overwritePoster: true
},
multiline : {

@@ -305,2 +316,10 @@ parse : function(commentLine){

it('should extend poster comments except for posterOverwrite `true`', function () {
var comments = getCommentsFrom('posterOverwrite.test.scss');
var result = parser.parse ( comments );
assert.equal(result.length , 2);
assert.deepEqual(result[1].poster , [ 'Poster', 'OnItem' ]);
assert.deepEqual(result[1].posterOverwrite , [ 'OnItem' ]);
});
it('should apply annotations in a line poster comment to each item', function () {

@@ -307,0 +326,0 @@ var comments = getCommentsFrom('linePoster.test.scss');

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