From c7323a91874302ebd2f284470c1ccf462cc85033 Mon Sep 17 00:00:00 2001 From: silverwind Date: Thu, 21 Sep 2023 22:08:23 +0200 Subject: [PATCH 1/2] Clarify return values in docs Fixes: #11 --- readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index 1103ee4..30ec068 100644 --- a/readme.md +++ b/readme.md @@ -21,11 +21,11 @@ detectNewline('foo\nbar\nbaz\r\n'); ### detectNewline(string) -Returns the detected newline or `undefined` when no newline character is found. +Returns the detected newline or `undefined` when no newline character is found or `\n` when no dominant newline is present. ### detectNewlineGraceful(unknown) -Returns the detected newline or `\n` when no newline character is found or the input is not a string. +Returns the detected newline or `\n` when no newline character is found, no dominant newline is present, or the input is not a string. ## Related From 095d9f183300bb677ed1f197c7d80d65447e3238 Mon Sep 17 00:00:00 2001 From: silverwind Date: Fri, 22 Sep 2023 20:43:13 +0200 Subject: [PATCH 2/2] update d.ts --- index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.d.ts b/index.d.ts index 20cb682..05d40ab 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,7 +1,7 @@ /** Detect the dominant newline character of a string. -@returns The detected newline or `undefined` when no newline character is found. +@returns The detected newline or `undefined` when no newline character is found or `\n` when no dominant newline is present. @example ``` @@ -16,7 +16,7 @@ export function detectNewline(string: string): '\r\n' | '\n' | undefined; /** Detect the dominant newline character of a string. -@returns The detected newline or `\n` when no newline character is found or the input is not a string. +@returns The detected newline or `\n` when no newline character is found, no dominant newline is present, or the input is not a string. @example ```