@wixc3/common
Advanced tools
Comparing version 5.3.0 to 6.0.0
@@ -150,7 +150,2 @@ /** | ||
export declare function escapeRegExp(str: string): string; | ||
/** | ||
* Removes comments from string | ||
* Note that there's lexical no parsing, so stuff like "//'//" will not work | ||
*/ | ||
export declare function naiveStripComments(str: string): string; | ||
//# sourceMappingURL=strings.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.naiveStripComments = exports.escapeRegExp = exports.templateCompilerProvider = exports.isString = exports.noWhiteSpace = exports.minimalIndent = exports.noIdents = exports.equalIdents = exports.includesCaseInsensitive = exports.indexToLineAndColumn = exports.toCSSCamelCase = exports.toCSSKebabCase = exports.toNamingConvention = exports.toCamelCase = exports.toPascalCaseJsIdentifier = exports.toPascalCase = exports.toKebabCase = exports.splitIntoWords = exports.capitalizeFirstLetter = exports.isValidNamingConvention = exports.NamingConvention = exports.escapeCSS = exports.assertIsString = void 0; | ||
exports.escapeRegExp = exports.templateCompilerProvider = exports.isString = exports.noWhiteSpace = exports.minimalIndent = exports.noIdents = exports.equalIdents = exports.includesCaseInsensitive = exports.indexToLineAndColumn = exports.toCSSCamelCase = exports.toCSSKebabCase = exports.toNamingConvention = exports.toCamelCase = exports.toPascalCaseJsIdentifier = exports.toPascalCase = exports.toKebabCase = exports.splitIntoWords = exports.capitalizeFirstLetter = exports.isValidNamingConvention = exports.NamingConvention = exports.escapeCSS = exports.assertIsString = void 0; | ||
const objects_1 = require("./objects"); | ||
@@ -292,10 +292,2 @@ /** | ||
exports.escapeRegExp = escapeRegExp; | ||
/** | ||
* Removes comments from string | ||
* Note that there's lexical no parsing, so stuff like "//'//" will not work | ||
*/ | ||
function naiveStripComments(str) { | ||
return str.replace(/\/\*.+?\*\//gs, '').replace(/\s*(?<!:)\/\/.*\n?/g, ''); | ||
} | ||
exports.naiveStripComments = naiveStripComments; | ||
//# sourceMappingURL=strings.js.map |
@@ -150,7 +150,2 @@ /** | ||
export declare function escapeRegExp(str: string): string; | ||
/** | ||
* Removes comments from string | ||
* Note that there's lexical no parsing, so stuff like "//'//" will not work | ||
*/ | ||
export declare function naiveStripComments(str: string): string; | ||
//# sourceMappingURL=strings.d.ts.map |
@@ -268,9 +268,2 @@ import { getIn } from './objects'; | ||
} | ||
/** | ||
* Removes comments from string | ||
* Note that there's lexical no parsing, so stuff like "//'//" will not work | ||
*/ | ||
export function naiveStripComments(str) { | ||
return str.replace(/\/\*.+?\*\//gs, '').replace(/\s*(?<!:)\/\/.*\n?/g, ''); | ||
} | ||
//# sourceMappingURL=strings.js.map |
{ | ||
"name": "@wixc3/common", | ||
"version": "5.3.0", | ||
"version": "6.0.0", | ||
"description": "Common utils, usable in all environments", | ||
@@ -5,0 +5,0 @@ "main": "dist/cjs/index.js", |
@@ -86,3 +86,2 @@ [![npm version](https://badge.fury.io/js/@wixc3%2Fcommon.svg)](https://badge.fury.io/js/@wixc3%2Fcommon) | ||
| [mulberry32(a)](https://wixplosives.github.io/core3-utils/common.mulberry32) | | | ||
| [naiveStripComments(str)](https://wixplosives.github.io/core3-utils/common.naivestripcomments) | Removes comments from string Note that there's lexical no parsing, so stuff like "//'//" will not work | | ||
| [next(iterable, item)](https://wixplosives.github.io/core3-utils/common.next) | Find the element following an item | | ||
@@ -89,0 +88,0 @@ | [noIdents(modified, separator)](https://wixplosives.github.io/core3-utils/common.noidents) | Remove line indentation (heading whitespace) | |
@@ -297,9 +297,1 @@ import { getIn } from './objects'; | ||
} | ||
/** | ||
* Removes comments from string | ||
* Note that there's lexical no parsing, so stuff like "//'//" will not work | ||
*/ | ||
export function naiveStripComments(str: string) { | ||
return str.replace(/\/\*.+?\*\//gs, '').replace(/\s*(?<!:)\/\/.*\n?/g, ''); | ||
} |
@@ -1,2 +0,2 @@ | ||
import { noWhiteSpace, splitIntoWords, naiveStripComments, toCamelCase, toKebabCase, toPascalCase } from '..'; | ||
import { noWhiteSpace, splitIntoWords, toCamelCase, toKebabCase, toPascalCase } from '..'; | ||
import { expect } from 'chai'; | ||
@@ -45,19 +45,1 @@ | ||
}); | ||
describe('stripComments', () => { | ||
it('removes /* */ comments', () => { | ||
expect(naiveStripComments(`no /* success removing */comments`)).to.equal('no comments'); | ||
expect( | ||
naiveStripComments(`no /* | ||
success removing | ||
*/comments`) | ||
).to.equal('no comments'); | ||
}); | ||
it('removes // comments', () => { | ||
expect(naiveStripComments(`no comments// after code`)).to.equal('no comments'); | ||
expect(naiveStripComments(`// line comments\nno comments`)).to.equal('no comments'); | ||
}); | ||
it('does not identify :// as comment', () => { | ||
expect(naiveStripComments(`http://url //my site`)).to.equal('http://url'); | ||
}); | ||
}); |
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
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
334847
6015
159