# extra-tags

> ```sh npm install --save extra-tags # or yarn add extra-tags ```

Latest version **0.5.4** (published 2025-07-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install extra-tags
pnpm add extra-tags
yarn add extra-tags
bun add extra-tags
```

## Health

**Score 40/100 (D)** — status: maintenance-mode.

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

Warnings: low downloads; pre 1.0.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.5.4 |
| Published | 2025-07-29 |
| First published | 2021-07-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=18.17.0 |
| Dependencies | 1 |
| Unpacked size | 36.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | BlackGlory |
| Maintainers | black_glory |

## Links

- npm: https://www.npmjs.com/package/extra-tags
- Repository: https://github.com/BlackGlory/extra-tags
- Homepage: https://github.com/BlackGlory/extra-tags#readme
- Issues: https://github.com/BlackGlory/extra-tags/issues
- npm.io page: https://npm.io/package/extra-tags

## Dependencies (1)

- [extra-utils](https://npm.io/package/extra-utils.md) ^5.16.0

## Recent versions

- 0.5.4 (latest) — 2025-07-29
- 0.5.3 — 2025-07-28
- 0.5.2 — 2024-12-23
- 0.5.1 — 2024-12-23
- 0.5.0 — 2024-10-31
- 0.4.2 — 2023-06-11
- 0.4.1 — 2023-03-17
- 0.4.0 — 2023-03-17
- 0.3.1 — 2023-01-21
- 0.3.0 — 2022-12-14
- 0.2.7 — 2022-12-13
- 0.2.6 — 2022-10-18
- 0.2.5 — 2022-08-01
- 0.2.4 — 2021-12-19
- 0.2.3 — 2021-12-12
- … 5 more at https://npm.io/package/extra-tags/versions

## README

# extra-tags
## Install
```sh
npm install --save extra-tags
# or
yarn add extra-tags
```

## API
### map
```ts
function map<T, U, Strings extends ReadonlyArray<string>>(
  fn: (value: T, index: number) => U
, strings: Strings
, ...values: T[]
): [strings: Strings, ...values: U[]]
function map<T, U>(
  fn: (value: T, index: number) => U
): <Strings extends ReadonlyArray<string>>(
  strings: Strings
, ...values: T[]
) => [strings: Strings, ...values: U[]]
```

### filter
```ts
function filter<T, U extends T = T>(
  predicate: (value: T, index: number) => boolean
, strings: TemplateStringsArray
, ...values: T[]
): [strings: TemplateStringsArray, ...values: U[]]
function filter<T, U extends T = T>(
  predicate: (value: T, index: number) => boolean
, strings: ReadonlyArray<string>
, ...values: T[]
): [strings: ReadonlyArray<string>, ...values: U[]]
function filter<T, U extends T = T>(
  predicate: (value: T, index: number) => boolean
): <Strings extends ReadonlyArray<string>>(
  strings: Strings
, ...values: T[]
) => [
  strings: Strings extends TemplateStringsArray
  ? TemplateStringsArray
  : ReadonlyArray<string>
, ...values: U[]
]
```

### array
```ts
function array<T>(strings: TemplateStringsArray, ...values: T[]): Array<string | T>
```

```ts
array`a${1}b${2}c`
// ['a', 1, 'b', 2, 'c']
```

### fromArray
```ts
function fromArray<T>(arr: Array<string | T>): [
  strings: string[]
, ...values: T[]
]
```

```ts
fromArray(array`a${1}b${2}c`)
// [['a', 'b', 'c'], 1, 2]
```

### concat
```ts
function concat(strings: ReadonlyArray<string>, ...values: unknown[]): string
```

It is equivalent to `Array.prototype.concat` for template arguments.

```ts
// It doesn't make sense to use it as a tag function,
// because it equivalent to `a${'b'}c${'d'}e`.
concat`a${'b'}c${'d'}e`
// 'abcde'

concat(strings, ...values)
// 'abcde'
```

### dedent
```ts
function dedent(strings: ReadonlyArray<string>, ...values: unknown[]): string
```

```ts
dedent`
  hello
  world
`
//   'hello' + '\n'
// + 'world'
```

### oneline
```ts
function oneline(
  separator: string
, strings: ReadonlyArray<string>
, ...values: unknown[]
): string
function oneline(
  separator: string
): (strings: ReadonlyArray<string>, ...values: unknown[]) => string
function oneline(strings: ReadonlyArray<string>, ...values: unknown[]): string
```

```ts
oneline(' ')`
  hello
  world
`
// 'hello world'
```

### indentMultilineValues
```ts
function indentMultilineValues<Strings extends ReadonlyArray<string>>(
  strings: Strings
, ...values: string[]
): [strings: Strings, ...values: string[]]
```

```ts
const [strings, ...values] = indentMultilineValues`
  a
  ${'b\nc'}
  d
`
// strings: [
//   '\n'
// + ' '.repeat(2) + 'a' + '\n'
// , '\n'
// + ' '.repeat(2) + 'd' + '\n'
// ]
// values: [
//   'b' + '\n'
// + ' '.repeat(2) + 'c'
// ]
```

### javascript
```ts
type JavaScriptValue =
| string
| number
| boolean
| null
| bigint
| undefined
| ((args: any) => any)
| { [property: string]: JavaScriptValue }
| JavaScriptValue[]

function javascript(strings: ReadonlyArray<string>, ...values: JavaScriptValue[]): string
```

```ts
javascript`
  const text = ${'hello world'}
  console.log(text)
`
// const text = "hello world"
// console.log(text)
```

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