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.12.0 to 0.12.1

test/fixtures/crlf.test.scss

11

index.js

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

escapeStringRegexp(blockCommentStyle) +
'((?:[^*]|[\\r\\n]|(?:\\*+(?:[^*/]|[\\r\\n])))*)(\\*+)\\/';
'((?:[^*]|\\n|(?:\\*+(?:[^*/]|\\n)))*)(\\*+)\\/';
}

@@ -110,3 +110,3 @@

var cleanBlockComment = function (comment) {
var removeFirstLine = comment.replace(/^.*?[\r\n]+|[\r\n].*?$/g, '');
var removeFirstLine = comment.replace(/^.*?\n+|\n.*?$/g, '');
var removeLeadingStar = removeFirstLine.replace(/^[ \t]*\*/gm, '');

@@ -137,2 +137,7 @@ return stripIndent(removeLeadingStar).split(/\n/);

var unifyLineEndings = function (code) {
return code.replace(/\r\n?|\n/g, '\n');
};
function CommentExtractor (parseContext, opts) {

@@ -171,2 +176,4 @@ this.parseContext = parseContext;

CommentExtractor.prototype.extract = function (code) {
code = unifyLineEndings(code);
var match;

@@ -173,0 +180,0 @@ var comments = [];

7

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

@@ -11,3 +11,3 @@ "main": "index.js",

"scripts": {
"test": "mocha test"
"test": "./node_modules/mocha/bin/mocha test"
},

@@ -26,3 +26,4 @@ "keywords": [

"devDependencies": {
"assert": "^1.1.1"
"assert": "^1.1.1",
"mocha": "^2.1.0"
},

@@ -29,0 +30,0 @@ "dependencies": {

@@ -230,2 +230,6 @@ CDocParser

#### 0.12.1
* Unify platform specify line breaks (like `\r\n`) to `\n` before processing
#### 0.12.0

@@ -232,0 +236,0 @@

@@ -504,2 +504,20 @@ var fs = require('fs');

describe('File with CRLF', function(){
it('should extract comments', function (){
var comments = getCommentsFrom('crlf.test.scss');
assert.equal(comments.length, 2);
assert.deepEqual(comments[0].lines, [
'Block comment with CRLF.',
'With multiple lines.'
]);
assert.deepEqual(comments[0].commentRange, { start: 1, end: 4 });
assert.deepEqual(comments[1].lines, [
'',
'Comment with CRLF.',
'It have multiple lines in a single comment.',
''
]);
assert.deepEqual(comments[1].commentRange, { start: 6, end: 9 });
});
});

@@ -506,0 +524,0 @@ });

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