# smartstring

> handle strings in smart ways. TypeScript ready.

Latest version **2.0.28** (published 2017-10-26) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

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

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 2.0.28 |
| Published | 2017-10-26 |
| First published | 2016-02-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 6 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Lossless GmbH |
| Maintainers | pushrocks |
| Keywords | regex, string |

## Links

- npm: https://www.npmjs.com/package/smartstring
- Repository: https://gitlab.com/pushrocks/smartstring
- Homepage: https://gitlab.com/pushrocks/smartstring#readme
- Issues: https://gitlab.com/pushrocks/smartstring/issues
- npm.io page: https://npm.io/package/smartstring

## Dependencies (6)

- [js-base64](https://npm.io/package/js-base64.md) ^2.3.2
- [randomatic](https://npm.io/package/randomatic.md) ^1.1.7
- [strip-indent](https://npm.io/package/strip-indent.md) ^2.0.0
- [typings-global](https://npm.io/package/typings-global.md) ^1.0.20
- [normalize-newline](https://npm.io/package/normalize-newline.md) ^3.0.0
- [crypto-random-string](https://npm.io/package/crypto-random-string.md) ^1.0.0

## Recent versions

- 2.0.28 (latest) — 2017-10-26
- 2.0.27 — 2017-10-11
- 2.0.24 — 2017-02-19
- 2.0.22 — 2016-11-02
- 2.0.21 — 2016-11-02
- 2.0.20 — 2016-11-01
- 2.0.19 — 2016-11-01
- 2.0.18 — 2016-11-01
- 2.0.17 — 2016-08-03
- 2.0.16 — 2016-08-03
- 2.0.15 — 2016-07-17
- 2.0.14 — 2016-07-07
- 2.0.13 — 2016-07-07
- 2.0.11 — 2016-07-06
- 2.0.12 — 2016-07-06
- … 16 more at https://npm.io/package/smartstring/versions

## README

# smartstring
handle strings in smart ways. TypeScript ready.

## Availabililty
[![npm](https://pushrocks.gitlab.io/assets/repo-button-npm.svg)](https://www.npmjs.com/package/smartstring)
[![git](https://pushrocks.gitlab.io/assets/repo-button-git.svg)](https://GitLab.com/pushrocks/smartstring)
[![git](https://pushrocks.gitlab.io/assets/repo-button-mirror.svg)](https://github.com/pushrocks/smartstring)
[![docs](https://pushrocks.gitlab.io/assets/repo-button-docs.svg)](https://pushrocks.gitlab.io/smartstring/)

## Status for master
[![build status](https://GitLab.com/pushrocks/smartstring/badges/master/build.svg)](https://GitLab.com/pushrocks/smartstring/commits/master)
[![coverage report](https://GitLab.com/pushrocks/smartstring/badges/master/coverage.svg)](https://GitLab.com/pushrocks/smartstring/commits/master)
[![npm downloads per month](https://img.shields.io/npm/dm/smartstring.svg)](https://www.npmjs.com/package/smartstring)
[![Dependency Status](https://david-dm.org/pushrocks/smartstring.svg)](https://david-dm.org/pushrocks/smartstring)
[![bitHound Dependencies](https://www.bithound.io/github/pushrocks/smartstring/badges/dependencies.svg)](https://www.bithound.io/github/pushrocks/smartstring/master/dependencies/npm)
[![bitHound Code](https://www.bithound.io/github/pushrocks/smartstring/badges/code.svg)](https://www.bithound.io/github/pushrocks/smartstring)
[![TypeScript](https://img.shields.io/badge/TypeScript-2.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
[![node](https://img.shields.io/badge/node->=%206.x.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)

## Usage
Use TypeScript for best in class instellisense.

```javascript
import * as smartstring from "smartstring";

// classes

// smartstring.Domain class
let myDomain = new smartstring.Domain("https://sub.main.tld");
myDomain.level1 // "tld"
myDomain.level2 // "main"
// level3 , level 4 and so on...
myDomain.zoneName // "main.tld"
myDOmain.protocol // "https"

// smartstring.GitRepo class
let myGitRepo = new smartstring.GitRepo("git@github.com:someorg/somerepo.git"); // takes https and git and npm repo URL versions
myGitRepo.host // "github.com"
myGitRepo.user // "someorg"
myGitRepo.repo // "somerepo"
myGitRepo.accessToken // accessToken if specified with https
myGitRepo.sshUrl // "git@github.com:someorg/somerepo.git" (computed also from https)
myGitRepo.httpsUrl // "https://github.com/someorg/somerepo.git" (computed also from ssh)

//smartstring.Base64
let myBase64 = new smartstring.Base64('somestring','string') // first arg is the string, second is string type (can be string, base64, base64uri)
myBase64.simpleString // 'somestring'
myBase64.base64String // base64 representation of 'somestring'
myBase64.base64UriString // base64uri representation of 'sometring'

// methods
smartstring.base64.encode('somestring') // encodes 'somestring' to base64
smartstring.base64.encodeUri('sometring') // encodes 'somestring' to base64uri
smartstring.base64.decode() // decodes base64 and base64uri to simple string respresentation

smartstring.indent.indent('somestring\anotherstring', 4) // indents a string by 4
smartstring.indent.indent('somestring\anotherstring', '>>>> ') // indents a string with a prefix
smartstring.indent.normalize('    somestring\        anotherstring', '>>>> ') // looks for the least amount of indention and removes superflouous space
```

For further information read the linked docs at the top of this README.

> MIT licensed | **&copy;** [Lossless GmbH](https://lossless.gmbh)

[![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://push.rocks)

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