Skip to content

Commit

Permalink
new release
Browse files Browse the repository at this point in the history
  • Loading branch information
jaipack17 authored Jul 10, 2021
1 parent e0d8785 commit 3c96383
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 14 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
readme.md
package-lock.json
5 changes: 5 additions & 0 deletions examples/center_aligned.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const wrap = require("ruxe");

let textwrapped = wrap("Harry has a little farm, he has 4 cows, 15 chickens and 3 goats in his farm. He likes to grow a variety of crops such as wheat, barley, rice and corn! He loves farming! He also has good storage facilities in the farm and modern irrigation systems!", { align:"center" });

console.log(textwrapped);
23 changes: 20 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,33 @@
{
"name": "ruxe",
"version": "1.2.0",
"version": "1.2.4",
"main": "src/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": ["cli", "string", "text", "wrap", "paragraph", "manipulation","para", "stanza", "format", "color", "console", "formatting", "command-line-tool"],
"keywords": [
"cli",
"string",
"text",
"wrap",
"paragraph",
"manipulation",
"para",
"stanza",
"format",
"color",
"console",
"formatting",
"command-line-tool"
],
"author": "jaipack17",
"license": "MIT",
"directories": {
"example": "examples"
},
"description": "format strings into paragraphs along with text styling.",
"repository": "https://github.com/jaipack17/ruxe"
"repository": "https://github.com/jaipack17/ruxe",
"dependencies": {
"center-align": "^1.0.1"
}
}
15 changes: 5 additions & 10 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
const config = require("../config/default");
const alignments = require("../utils/alignments");
const colors = require("../utils/colors");
var center = require('center-align');

/**
*
Expand Down Expand Up @@ -86,20 +87,14 @@ module.exports = function (_str, _config) {

return fin;
}
/*
else if (p[1] == "center") {
for(var i = 0; i < a.length; i++){
let spaces = Math.round((maxLen - a[i].length)/2);
if(spaces == 0) {
fin += " ".repeat(5) + a[i] + "\n"
} else {
fin += " ".repeat(spaces) + a[i] + "\n";
}
}
let centered = center(a);
centered.forEach(line => {
fin += line + "\n";
})

return fin;
}
*/
return s;
}

Expand Down
2 changes: 1 addition & 1 deletion utils/alignments.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = ["right", "left"]
module.exports = ["right", "left", "center"]

0 comments on commit 3c96383

Please sign in to comment.