Skip to content

Commit

Permalink
Export getNewLineChar function.
Browse files Browse the repository at this point in the history
Turn off validation, consider user may validate separately.
  • Loading branch information
jalal246 committed Mar 11, 2020
1 parent 6007a1d commit 42f2887
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const { lines, words, chars, spaces } = textics(str);
### Example

```js
const textics = require("textics");
const { textics } = require("textics");

const result = textics("you got the power");

Expand Down
36 changes: 18 additions & 18 deletions src/textics.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/**
* validates string
*
* @param {string} str
* @returns {boolean}
*/
function isValid(str) {
return str && typeof str === "string" && str.length > 0;
}
// /**
// * validates string
// *
// * @param {string} str
// * @returns {boolean}
// */
// function isValid(str) {
// return str && typeof str === "string" && str.length > 0;
// }

/**
* Extracts new line used char in a given string.
Expand Down Expand Up @@ -42,14 +42,14 @@ function textics(str) {
let chars = 0;
let spaces = 0;

if (!isValid(str)) {
return {
lines,
words,
chars,
spaces
};
}
// if (!isValid(str)) {
// return {
// lines,
// words,
// chars,
// spaces
// };
// }

const regNewLine = getNewLineChar(str);

Expand Down Expand Up @@ -118,4 +118,4 @@ function textics(str) {
};
}

module.exports = textics;
module.exports = { textics, getNewLineChar };

0 comments on commit 42f2887

Please sign in to comment.