@microsoft/node-core-library
Advanced tools
Comparing version 0.7.3 to 0.8.0
@@ -5,2 +5,14 @@ { | ||
{ | ||
"version": "0.8.0", | ||
"tag": "@microsoft/node-core-library_v0.8.0", | ||
"date": "Thu, 15 Mar 2018 16:05:43 GMT", | ||
"comments": { | ||
"minor": [ | ||
{ | ||
"comment": "Add new Text API" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"version": "0.7.3", | ||
@@ -7,0 +19,0 @@ "tag": "@microsoft/node-core-library_v0.7.3", |
# Change Log - @microsoft/node-core-library | ||
This log was last generated on Fri, 02 Mar 2018 01:13:59 GMT and should not be manually modified. | ||
This log was last generated on Thu, 15 Mar 2018 16:05:43 GMT and should not be manually modified. | ||
## 0.8.0 | ||
Thu, 15 Mar 2018 16:05:43 GMT | ||
### Minor changes | ||
- Add new Text API | ||
## 0.7.3 | ||
@@ -6,0 +13,0 @@ Fri, 02 Mar 2018 01:13:59 GMT |
@@ -156,10 +156,2 @@ /** | ||
private static _formatKeyPath(keyPath); | ||
/** | ||
* Returns the same thing as targetString.replace(searchValue, replaceValue), except that | ||
* all matches are replaced, rather than just the first match. | ||
* @param targetString The string to be modified | ||
* @param searchValue The value to search for | ||
* @param replaceValue The replacement text | ||
*/ | ||
private static _getAllReplaced(targetString, searchValue, replaceValue); | ||
} | ||
@@ -346,1 +338,30 @@ | ||
} | ||
/** | ||
* Operations for working with strings that contain text. | ||
* | ||
* @remarks | ||
* The utilities provided by this class are intended to be simple, small, and very | ||
* broadly applicable. | ||
* | ||
* @public | ||
*/ | ||
export declare class Text { | ||
private static readonly _newLineRegEx; | ||
/** | ||
* Returns the same thing as targetString.replace(searchValue, replaceValue), except that | ||
* all matches are replaced, rather than just the first match. | ||
* @param input - The string to be modified | ||
* @param searchValue - The value to search for | ||
* @param replaceValue - The replacement text | ||
*/ | ||
static replaceAll(input: string, searchValue: string, replaceValue: string): string; | ||
/** | ||
* Converts all newlines in the provided string to use Windows-style CRLF end of line characters. | ||
*/ | ||
static convertToCrLf(input: string): string; | ||
/** | ||
* Converts all newlines in the provided string to use Unix-style LF end of line characters. | ||
*/ | ||
static convertToLf(input: string): string; | ||
} |
@@ -8,2 +8,3 @@ "use strict"; | ||
const PackageJsonLookup_1 = require("./PackageJsonLookup"); | ||
const Text_1 = require("./Text"); | ||
/** | ||
@@ -73,3 +74,3 @@ * Implements a unit testing strategy that generates output files, and then | ||
static _getNormalizedContent(s) { | ||
return s.replace(/\r\n/g, '\n').replace(/\r/g, '') // convert to Unix-style newlines | ||
return Text_1.Text.convertToLf(s) // convert to Unix-style newlines | ||
.replace(/\s+\n/g, '\n') // strip spaces from end of line | ||
@@ -76,0 +77,0 @@ .replace(/\n+$/g, ''); // strip newlines from end of file |
@@ -12,1 +12,2 @@ /** | ||
export { Path } from './Path'; | ||
export { Text } from './Text'; |
@@ -22,3 +22,5 @@ "use strict"; | ||
exports.Path = Path_1.Path; | ||
var Text_1 = require("./Text"); | ||
exports.Text = Text_1.Text; | ||
//# sourceMappingURL=index.js.map |
@@ -66,10 +66,2 @@ import { JsonSchema, IJsonSchemaErrorInfo, IJsonSchemaValidateOptions } from './JsonSchema'; | ||
private static _formatKeyPath(keyPath); | ||
/** | ||
* Returns the same thing as targetString.replace(searchValue, replaceValue), except that | ||
* all matches are replaced, rather than just the first match. | ||
* @param targetString The string to be modified | ||
* @param searchValue The value to search for | ||
* @param replaceValue The replacement text | ||
*/ | ||
private static _getAllReplaced(targetString, searchValue, replaceValue); | ||
} |
@@ -8,2 +8,3 @@ "use strict"; | ||
const jju = require("jju"); | ||
const Text_1 = require("./Text"); | ||
/** | ||
@@ -60,3 +61,3 @@ * Utilities for reading/writing JSON files. | ||
else { | ||
return JsonFile._getAllReplaced(stringified, '\n', '\r\n'); | ||
return Text_1.Text.convertToCrLf(stringified); | ||
} | ||
@@ -157,12 +158,2 @@ } | ||
} | ||
/** | ||
* Returns the same thing as targetString.replace(searchValue, replaceValue), except that | ||
* all matches are replaced, rather than just the first match. | ||
* @param targetString The string to be modified | ||
* @param searchValue The value to search for | ||
* @param replaceValue The replacement text | ||
*/ | ||
static _getAllReplaced(targetString, searchValue, replaceValue) { | ||
return targetString.split(searchValue).join(replaceValue); | ||
} | ||
} | ||
@@ -169,0 +160,0 @@ exports.JsonFile = JsonFile; |
{ | ||
"name": "@microsoft/node-core-library", | ||
"version": "0.7.3", | ||
"version": "0.8.0", | ||
"description": "Core libraries that every NodeJS toolchain project should use", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
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
197062
46
2464