Gathering detailed insights and metrics for center-align
Gathering detailed insights and metrics for center-align
Gathering detailed insights and metrics for center-align
Gathering detailed insights and metrics for center-align
npm install center-align
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (100%)
Total Downloads
1,053,089,045
Last Day
242,166
Last Week
1,095,184
Last Month
5,404,508
Last Year
77,694,805
23 Stars
18 Commits
10 Forks
4 Watching
1 Branches
2 Contributors
Minified
Minified + Gzipped
Latest Version
1.0.1
Package Id
center-align@1.0.1
Size
2.77 kB
NPM Version
4.6.1
Node Version
7.7.3
Publised On
26 May 2017
Cumulative downloads
Total Downloads
Last day
-4.7%
242,166
Compared to previous day
Last week
-19.3%
1,095,184
Compared to previous week
Last month
5.5%
5,404,508
Compared to previous month
Last year
-5.3%
77,694,805
Compared to previous year
2
2
Center-align the text in a string.
Install with npm:
1$ npm install --save center-align
1var center = require('center-align'); 2center(val, width);
Params
val
{String|Array}: the string or array of strings to center alignwidth
{Number} (optional): the total width of each line in the expected result, after it's centered.1console.log(center('foo')); //=> 'foo' (does nothing) 2console.log(center('foo', 12)); //=> ' foo ' 3console.log(center('foo', 10)); //=> ' foo ' 4console.log(center('foo', 8)); //=> ' foo '
If expected width
is not provided, the length of the longest line will be used.
Example
If used on the following:
1// value can be a string, or an array of strings 2center([ 3 'Lorem ipsum dolor sit amet,', 4 'consectetur adipiscing', 5 'elit, sed do eiusmod tempor incididunt', 6 'ut labore et dolore', 7 'magna aliqua. Ut enim ad minim', 8 'veniam, quis' 9]);
The result would be:
Lorem ipsum dolor sit amet,
consectetur adipiscing
elit, sed do eiusmod tempor incididunt
ut labore et dolore
magna aliqua. Ut enim ad minim
veniam, quis
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)
To generate the readme, run the following command:
1$ npm install -g verbose/verb#dev verb-generate-readme && verb
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
1$ npm install && npm test
Jon Schlinkert
Copyright © 2017, Jon Schlinkert. Released under the MIT License.
This file was generated by verb-generate-readme, v0.6.0, on May 26, 2017.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
Found 1/14 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More