# owl-str

> Make a string with owl-str!

Latest version **2.0.0** (published 2020-09-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install owl-str
pnpm add owl-str
yarn add owl-str
bun add owl-str
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2020-09-28 |
| First published | 2020-09-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 8.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Juan Kim |
| Maintainers | juan003 |
| Keywords | string, string-template, string template, sql |

## Links

- npm: https://www.npmjs.com/package/owl-str
- Repository: https://github.com/pure-juan/owl-str
- npm.io page: https://npm.io/package/owl-str

## Alternatives

- [@mce/gif](https://npm.io/package/@mce/gif.md) — 2.6K weekly downloads
- [cleanse](https://npm.io/package/cleanse.md) — 173 weekly downloads
- [str](https://npm.io/package/str.md) — 127 weekly downloads
- [naming](https://npm.io/package/naming.md) — 95 weekly downloads
- [tap-telco-api](https://npm.io/package/tap-telco-api.md) — 19 weekly downloads

## Recent versions

- 2.0.0 (latest) — 2020-09-28
- 1.0.1 — 2020-09-16
- 1.0.0 — 2020-09-16
- 0.2.2 — 2020-09-09
- 0.2.1 — 2020-09-09
- 0.2.0 — 2020-09-09
- 0.1.0 — 2020-09-09

## README

# owl-str

<div align="center">
    <b style="font-size: 1.5em">Make a string with <code>owl-str</code>!</b>
</div>

## Installation

You can download via `npm`, `yarn`

```bash
npm i owl-str
```

or

```bash
yarn add owl-str
```

## Usage

You can make (sql or whatever) string more easier with tagged template literals!

```typescript
import { str } from "owl-str";
// or you can use like this
// import owlStr from 'owl-str';
// owlStr.str`blahblahblah`;

const payload = {
  arg: true,
};

const string = str<typeof payload>`Hello? Is anyone there?\n${({ arg }) =>
  arg ? "Yes" : "Nope"}`;

string(payload);
// Hello? Is anyone there?
// Yes
```

```typescript
import { str, isTrue, isNotEmpty } from "owl-str";

const payload = {
  some_function: () => (Math.floor(Math.random() * 101) >= 50 ? true : false),
};

const sql = str<typeof payload>`
    SELECT
        *
    FROM [SOME_TABLE]
    WHERE 1=1
    ${(props) => isTrue(props["some_function"]())`
        AND [SOME_COLUMN] = :SOME_COLUMN
    `}
    ${isNotEmpty(some_variable)`
        AND [SOME_COLUMN] = :SOME_COLUMN
    `}
`;

sql(payload);
// isNotEmpty method will be ignore that string if some_variables is empty(null or undefined).
// props in string will provide as the payload
```

## Documents

### raw

> This is string template made by owl-str,
> you don't need to use this.

This is only for this package.

### str

> This is the base function of tagged template literals for our package.

```javascript
const str = <T>(payload: T)
```

str can have a payload

This payload will provide to child function in string as the arguments.

### emptyStr

> This is the void.
> This function always return empty string('')

### isNotEmpty, isEmpty

> This methods are make a string with arguments.
> If you provide (empty or not empty) string, It will ignore the string what you provide, or not

### isTrue, isFalse

> This is just check the argument and return the string or not

Let me know if I wrote something wrong.
(juan003@naver.com or kimjuan220@gmail.com or [github issue](https://github.com/pure-juan/owl-str/issues/new))

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