# pstr

> A Javascript port of python's string methods

Latest version **1.0.1** (published 2022-10-03) · ISC license · 0 weekly downloads

## Install

```sh
npm install pstr
pnpm add pstr
yarn add pstr
bun add pstr
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2022-10-03 |
| First published | 2022-10-02 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 13.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | TheWisePigeon |
| Maintainers | the_wise_pigeon |

## Links

- npm: https://www.npmjs.com/package/pstr
- Repository: https://github.com/TheWisePigeon/wstr
- Homepage: https://github.com/TheWisePigeon/wstr#readme
- Issues: https://github.com/TheWisePigeon/wstr/issues
- npm.io page: https://npm.io/package/pstr

## Recent versions

- 1.0.1 (latest) — 2022-10-03
- 1.0.0 — 2022-10-02

## README

## This is (supposed to be) a JavaScript port of Python's most useful string methods(At least those who are not in JavaScript)

I wrote it in TypeScript and then transpiled it into JavaScript.
It exports 4 functions, but expect this number to grow very soon

- capitalize
- title
- center
- zfill


### capitalize
From the Python's functionm it takes in a string and returns the same sring with the first character capitalized.
```js
const pstr = require("pstr")
let name = "freeman"

console.log(pstr.capitalize(name)) //-> "Freeman"
```

### title
Also does the same thing as the Python's `title`.
```js
const pstr = require("pstr")
let bookTitle = "the flying house"

console.log(pstr.title(bookTitle)) //-> "The Flying House"
```

### center
The center() method will center align the string, using a specified character (space is default) as the fill character.
```js
const pstr = require("pstr")
let menu = "Menu"

console.log(pstr.center(menu)) //-> "   menu   "
console.log(pstr.center(menu, "*")) //-> "***menu***"
console.log(pstr.center(menu, "*", 5)) //-> "*****menu*****"
```

### zfill
The zfill() method adds zeros (0) at the beginning of the string, until it reaches the specified length.
```js
const pstr = require("pstr")
let id = "12"

console.log(pstr.zfill(name, 5)) //-> "00012"
```

---
_Source: https://npm.io/package/pstr · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
