Socket
Socket
Sign inDemoInstall

@microsoft/node-core-library

Package Overview
Dependencies
Maintainers
2
Versions
116
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@microsoft/node-core-library - npm Package Compare versions

Comparing version 3.3.1 to 3.4.0

lib/StringBuilder.d.ts

12

CHANGELOG.json

@@ -5,2 +5,14 @@ {

{
"version": "3.4.0",
"tag": "@microsoft/node-core-library_v3.4.0",
"date": "Wed, 24 Oct 2018 16:03:10 GMT",
"comments": {
"minor": [
{
"comment": "Adding Terminal API."
}
]
}
},
{
"version": "3.3.1",

@@ -7,0 +19,0 @@ "tag": "@microsoft/node-core-library_v3.3.1",

9

CHANGELOG.md
# Change Log - @microsoft/node-core-library
This log was last generated on Wed, 17 Oct 2018 21:04:49 GMT and should not be manually modified.
This log was last generated on Wed, 24 Oct 2018 16:03:10 GMT and should not be manually modified.
## 3.4.0
Wed, 24 Oct 2018 16:03:10 GMT
### Minor changes
- Adding Terminal API.
## 3.3.1

@@ -6,0 +13,0 @@ Wed, 17 Oct 2018 21:04:49 GMT

@@ -249,2 +249,12 @@ /// <reference types="node" />

/**
* Writes a text string to a file on disk, appending to the file if it already exists.
* Behind the scenes it uses `fs.appendFileSync()`.
* @remarks
* Throws an error if the folder doesn't exist, unless ensureFolder=true.
* @param filePath - The absolute or relative path of the file.
* @param contents - The text that should be written to the file.
* @param options - Optional settings that can change the behavior. Type: `IWriteFileOptions`
*/
static appendToFile(filePath: string, contents: string | Buffer, options?: IFileSystemWriteFileOptions): void;
/**
* Reads the contents of a file into a string.

@@ -251,0 +261,0 @@ * Behind the scenes it uses `fs.readFileSync()`.

@@ -184,2 +184,20 @@ "use strict";

/**
* Writes a text string to a file on disk, appending to the file if it already exists.
* Behind the scenes it uses `fs.appendFileSync()`.
* @remarks
* Throws an error if the folder doesn't exist, unless ensureFolder=true.
* @param filePath - The absolute or relative path of the file.
* @param contents - The text that should be written to the file.
* @param options - Optional settings that can change the behavior. Type: `IWriteFileOptions`
*/
static appendToFile(filePath, contents, options) {
options = Object.assign({ ensureFolderExists: false, convertLineEndings: undefined, encoding: "utf8" /* Utf8 */ }, options);
if (options.ensureFolderExists) {
const folderPath = pathUtilities.dirname(filePath);
FileSystem.ensureFolder(folderPath);
}
contents = FileSystem._convertLineEndings(contents.toString(), options.convertLineEndings);
fsx.appendFileSync(filePath, contents, { encoding: options.encoding });
}
/**
* Reads the contents of a file into a string.

@@ -186,0 +204,0 @@ * Behind the scenes it uses `fs.readFileSync()`.

@@ -23,1 +23,6 @@ /**

export { LegacyAdapters, callback } from './LegacyAdapters';
export { StringBuilder } from './StringBuilder';
export { Terminal } from './Terminal/Terminal';
export { Colors, IColorableSequence } from './Terminal/Colors';
export { ITerminalProvider, TerminalProviderSeverity } from './Terminal/ITerminalProvider';
export { ConsoleTerminalProvider, IConsoleTerminalProviderOptions } from './Terminal/ConsoleTerminalProvider';

@@ -33,2 +33,12 @@ "use strict";

exports.LegacyAdapters = LegacyAdapters_1.LegacyAdapters;
var StringBuilder_1 = require("./StringBuilder");
exports.StringBuilder = StringBuilder_1.StringBuilder;
var Terminal_1 = require("./Terminal/Terminal");
exports.Terminal = Terminal_1.Terminal;
var Colors_1 = require("./Terminal/Colors");
exports.Colors = Colors_1.Colors;
var ITerminalProvider_1 = require("./Terminal/ITerminalProvider");
exports.TerminalProviderSeverity = ITerminalProvider_1.TerminalProviderSeverity;
var ConsoleTerminalProvider_1 = require("./Terminal/ConsoleTerminalProvider");
exports.ConsoleTerminalProvider = ConsoleTerminalProvider_1.ConsoleTerminalProvider;
//# sourceMappingURL=index.js.map

@@ -56,3 +56,3 @@ /**

/**
* Append spaces to the end of a string to ensure the result has a minimum length.
* Append characters to the end of a string to ensure the result has a minimum length.
* @remarks

@@ -62,4 +62,11 @@ * If the string length already exceeds the minimum length, then the string is unchanged.

*/
static padEnd(s: string, minimumLength: number): string;
static padEnd(s: string, minimumLength: number, paddingCharacter?: string): string;
/**
* Append characters to the start of a string to ensure the result has a minimum length.
* @remarks
* If the string length already exceeds the minimum length, then the string is unchanged.
* The string is not truncated.
*/
static padStart(s: string, minimumLength: number, paddingCharacter?: string): string;
/**
* If the string is longer than maximumLength characters, truncate it to that length

@@ -66,0 +73,0 @@ * using "..." to indicate the truncation.

@@ -40,3 +40,3 @@ "use strict";

/**
* Append spaces to the end of a string to ensure the result has a minimum length.
* Append characters to the end of a string to ensure the result has a minimum length.
* @remarks

@@ -46,10 +46,35 @@ * If the string length already exceeds the minimum length, then the string is unchanged.

*/
static padEnd(s, minimumLength) {
let result = s;
while (result.length < minimumLength) {
result += ' ';
static padEnd(s, minimumLength, paddingCharacter = ' ') {
if (paddingCharacter.length !== 1) {
throw new Error('The paddingCharacter parameter must be a single character.');
}
return result;
if (s.length < minimumLength) {
const paddingArray = new Array(minimumLength - s.length);
paddingArray.unshift(s);
return paddingArray.join(paddingCharacter);
}
else {
return s;
}
}
/**
* Append characters to the start of a string to ensure the result has a minimum length.
* @remarks
* If the string length already exceeds the minimum length, then the string is unchanged.
* The string is not truncated.
*/
static padStart(s, minimumLength, paddingCharacter = ' ') {
if (paddingCharacter.length !== 1) {
throw new Error('The paddingCharacter parameter must be a single character.');
}
if (s.length < minimumLength) {
const paddingArray = new Array(minimumLength - s.length);
paddingArray.push(s);
return paddingArray.join(paddingCharacter);
}
else {
return s;
}
}
/**
* If the string is longer than maximumLength characters, truncate it to that length

@@ -56,0 +81,0 @@ * using "..." to indicate the truncation.

5

package.json
{
"name": "@microsoft/node-core-library",
"version": "3.3.1",
"version": "3.4.0",
"description": "Core libraries that every NodeJS toolchain project should use",

@@ -23,3 +23,4 @@ "main": "lib/index.js",

"jju": "~1.3.0",
"z-schema": "~3.18.3"
"z-schema": "~3.18.3",
"colors": "~1.2.1"
},

@@ -26,0 +27,0 @@ "devDependencies": {

Sorry, the diff of this file is too big to display

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

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