Skip to content

NEWLINE: added eol for different environments and updated dependencies #30

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 19 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
NEWLINE: check for environment
  • Loading branch information
Sven Ulrich committed Mar 15, 2023
commit 10549bb8a384997dd261b1b65923ec7c17584c25
138 changes: 69 additions & 69 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,69 +1,69 @@
export declare const emptyString = "";
export declare function isNullOrWhiteSpace(value: string | null): boolean;
export declare function joinString(delimiter: string, ...args: (string | object | Array<any>)[]): string;
export declare function formatString(format: string, ...args: any[]): string;
export declare class String {
private static readonly regexNumber;
private static readonly regexObject;
static empty: string;
/**
* @deprecated The property should not be used, and will be removed in future versions! Use `String.empty` instead.
*/
static Empty: string;
/**
* @deprecated The method should not be used, and will be removed in future versions! Use `String.isNullOrWhiteSpace()` instead.
*/
static IsNullOrWhiteSpace(value: string | null | undefined): boolean;
/**
* @deprecated The method should not be used, and will be removed in future versions! Use `String.join()` instead.
*/
static Join(delimiter: string, ...args: (string | object | Array<any>)[]): string;
/**
* @deprecated The method should not be used, and will be removed in future version!s Use `String.format()` instead.
*/
static Format(format: string, ...args: any[]): string;
static isNullOrWhiteSpace(value: string | null): boolean;
static join(delimiter: string, ...args: (string | object | Array<any>)[]): string;
static format(format: string, ...args: any[]): string;
private static formatString;
private static parsePattern;
private static decimalToHexString;
private static getDisplayDateFromString;
private static getSortableDateFromString;
private static formatNumber;
private static joinString;
}
export declare class StringBuilder {
Values: string[];
constructor(value?: string);
toString(): string;
/**
* @deprecated The method should not be used, and will be removed in future versions! Use `toString()` instead.
*/
ToString(): string;
append(value: string): void;
/**
* @deprecated The method should not be used, and will be removed in future versions! Use `append()` instead.
*/
Append(value: string): void;
appendLine(value: string): void;
/**
* @deprecated The method should not be used, and will be removed in future versions! Use `appendLine()` instead.
*/
AppendLine(value: string): void;
appendFormat(format: string, ...args: any[]): void;
/**
* @deprecated The method should not be used, and will be removed in future versions! Use `appendFormat()` instead.
*/
AppendFormat(format: string, ...args: any[]): void;
appendLineFormat(format: string, ...args: any[]): void;
/**
* @deprecated The method should not be used, and will be removed in future versions! Use `appendLineFormat()` instead.
*/
AppendLineFormat(format: string, ...args: any[]): void;
clear(): void;
/**
* @deprecated The method should not be used, and will be removed in future versions! Use `clear()` instead.
*/
Clear(): void;
}
export declare const emptyString = "";
export declare function isNullOrWhiteSpace(value: string | null): boolean;
export declare function joinString(delimiter: string, ...args: (string | object | Array<any>)[]): string;
export declare function formatString(format: string, ...args: any[]): string;
export declare class String {
private static readonly regexNumber;
private static readonly regexObject;
static empty: string;
/**
* @deprecated The property should not be used, and will be removed in future versions! Use `String.empty` instead.
*/
static Empty: string;
/**
* @deprecated The method should not be used, and will be removed in future versions! Use `String.isNullOrWhiteSpace()` instead.
*/
static IsNullOrWhiteSpace(value: string | null | undefined): boolean;
/**
* @deprecated The method should not be used, and will be removed in future versions! Use `String.join()` instead.
*/
static Join(delimiter: string, ...args: (string | object | Array<any>)[]): string;
/**
* @deprecated The method should not be used, and will be removed in future version!s Use `String.format()` instead.
*/
static Format(format: string, ...args: any[]): string;
static isNullOrWhiteSpace(value: string | null): boolean;
static join(delimiter: string, ...args: (string | object | Array<any>)[]): string;
static format(format: string, ...args: any[]): string;
private static formatString;
private static parsePattern;
private static decimalToHexString;
private static getDisplayDateFromString;
private static getSortableDateFromString;
private static formatNumber;
private static joinString;
}
export declare class StringBuilder {
Values: string[];
constructor(value?: string);
toString(): string;
/**
* @deprecated The method should not be used, and will be removed in future versions! Use `toString()` instead.
*/
ToString(): string;
append(value: string): void;
/**
* @deprecated The method should not be used, and will be removed in future versions! Use `append()` instead.
*/
Append(value: string): void;
appendLine(value: string): void;
/**
* @deprecated The method should not be used, and will be removed in future versions! Use `appendLine()` instead.
*/
AppendLine(value: string): void;
appendFormat(format: string, ...args: any[]): void;
/**
* @deprecated The method should not be used, and will be removed in future versions! Use `appendFormat()` instead.
*/
AppendFormat(format: string, ...args: any[]): void;
appendLineFormat(format: string, ...args: any[]): void;
/**
* @deprecated The method should not be used, and will be removed in future versions! Use `appendLineFormat()` instead.
*/
AppendLineFormat(format: string, ...args: any[]): void;
clear(): void;
/**
* @deprecated The method should not be used, and will be removed in future versions! Use `clear()` instead.
*/
Clear(): void;
}
14 changes: 12 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
const isWindows = typeof process != 'undefined' && 'win32' === process.platform;
const newLine = isWindows ? '\r\n' : '\n';

let newLine = '\r\n';
const isNode = new Function('try {return this===global;}catch(e){return false;}');

if (isNode()) {
console.log('running under node.js');
const isWindows = typeof process != 'undefined' && 'win32' === process.platform;

if (!isWindows) {
newLine = '\n';
}
}

export const emptyString = '';

Expand Down
13 changes: 11 additions & 2 deletions tests/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,17 @@ import { Fruit } from './fruit';
import { expect } from 'chai';
import 'mocha';

const isWindows = typeof process != 'undefined' && 'win32' === process.platform;
const newLine = isWindows ? '\r\n' : '\n';
let newLine = '\r\n';
const isNode = new Function('try {return this===global;}catch(e){return false;}');

if (isNode()) {
console.log('running under node.js');
const isWindows = typeof process != 'undefined' && 'win32' === process.platform;

if (!isWindows) {
newLine = '\n';
}
}


describe('String.IsNullOrWhitespace', () => {
Expand Down