# vega-functions

> Custom functions for the Vega expression language.

Latest version **6.2.0** (published 2026-08-14) · BSD-3-Clause license · 0 weekly downloads

## Install

```sh
npm install vega-functions
pnpm add vega-functions
yarn add vega-functions
bun add vega-functions
```

## Health

**Score 65/100 (B)** — status: active.

Positive: esm support; no vulnerabilities; recently updated; high maintenance score; popular repo.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 6.2.0 |
| Published | 2026-08-14 |
| First published | 2019-02-18 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | none |
| Module format | ESM |
| Dependencies | 12 |
| Unpacked size | 133.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 12009 |
| Author | Vega |
| Maintainers | domoritz, hydrosquall, jheer, arvindsatya1, lhermann |
| Keywords | vega, expression, functions |

## Links

- npm: https://www.npmjs.com/package/vega-functions
- Repository: https://github.com/vega/vega
- Homepage: https://github.com/vega/vega/tree/main/packages/vega-functions#readme
- Issues: https://github.com/vega/vega/issues
- npm.io page: https://npm.io/package/vega-functions

## Dependencies (12)

- [d3-geo](https://npm.io/package/d3-geo.md) ^3.1.1
- [d3-ease](https://npm.io/package/d3-ease.md) ^3.0.1
- [d3-array](https://npm.io/package/d3-array.md) ^3.2.4
- [d3-color](https://npm.io/package/d3-color.md) ^3.1.0
- [vega-time](https://npm.io/package/vega-time.md) ^3.3.0
- [vega-util](https://npm.io/package/vega-util.md) ^2.1.3
- [vega-scale](https://npm.io/package/vega-scale.md) ^8.1.3
- [vega-dataflow](https://npm.io/package/vega-dataflow.md) ^6.1.3
- [vega-expression](https://npm.io/package/vega-expression.md) ^6.2.2
- [vega-scenegraph](https://npm.io/package/vega-scenegraph.md) ^5.3.0
- [vega-selections](https://npm.io/package/vega-selections.md) ^6.1.5
- [vega-statistics](https://npm.io/package/vega-statistics.md) ^2.0.0

## Recent versions

- 6.2.0 (latest) — 2026-08-14
- 6.1.3 — 2026-07-22
- 6.1.2 — 2026-07-21
- 6.1.1 — 2025-12-05
- 5.18.1 — 2025-10-23
- 6.1.0 — 2025-09-16
- 6.0.0 — 2025-03-27
- 5.18.0 — 2025-03-16
- 5.17.0 — 2025-02-25
- 5.16.0 — 2025-01-24
- 5.15.0 — 2024-06-14
- 5.14.0 — 2023-11-07
- 5.13.2 — 2023-04-26
- 5.13.1 — 2023-03-01
- 5.13.0 — 2022-03-11
- … 23 more at https://npm.io/package/vega-functions/versions

## README

# vega-functions

Function implementations for the [Vega expression language](https://vega.github.io/vega/docs/expressions/). Unlike the basic utility functions included in the [vega-expression](https://github.com/vega/vega/tree/master/packages/vega-expression) package, this package includes custom expression functions, many of which are specific to Vega dataflows.

## Provided Functions

This package provides the following expression functions. All other constants and functions are provided by the base [vega-expression](https://github.com/vega/vega/tree/master/packages/vega-expression) package.

**Type Checking Functions**

- [isArray](https://vega.github.io/vega/docs/expressions/#isArray)
- [isBoolean](https://vega.github.io/vega/docs/expressions/#isBoolean)
- [isDate](https://vega.github.io/vega/docs/expressions/#isDate)
- [isNumber](https://vega.github.io/vega/docs/expressions/#isNumber)
- [isObject](https://vega.github.io/vega/docs/expressions/#isObject)
- [isRegExp](https://vega.github.io/vega/docs/expressions/#isRegExp)
- [isString](https://vega.github.io/vega/docs/expressions/#isString)
- [isTuple](https://vega.github.io/vega/docs/expressions/#isTuple)

**Type Coercion Functions**

- [toBoolean](https://vega.github.io/vega/docs/expressions/#toBoolean)
- [toDate](https://vega.github.io/vega/docs/expressions/#toDate)
- [toNumber](https://vega.github.io/vega/docs/expressions/#toNumber)
- [toString](https://vega.github.io/vega/docs/expressions/#toString)

**Math Functions**

- [random](https://vega.github.io/vega/docs/expressions/#random)

**Easing Functions**

Each family below is also provided in `In`, `Out` and `InOut` variants (for example, `easeQuadIn`), except for `easeLinear`.

- [easeLinear](https://vega.github.io/vega/docs/expressions/#easeLinear)
- [easeQuad](https://vega.github.io/vega/docs/expressions/#easeQuad)
- [easeCubic](https://vega.github.io/vega/docs/expressions/#easeCubic)
- [easePoly](https://vega.github.io/vega/docs/expressions/#easePoly)
- [easeSin](https://vega.github.io/vega/docs/expressions/#easeSin)
- [easeExp](https://vega.github.io/vega/docs/expressions/#easeExp)
- [easeCircle](https://vega.github.io/vega/docs/expressions/#easeCircle)
- [easeBounce](https://vega.github.io/vega/docs/expressions/#easeBounce)
- [easeBack](https://vega.github.io/vega/docs/expressions/#easeBack)
- [easeElastic](https://vega.github.io/vega/docs/expressions/#easeElastic)

**Date/Time Functions**

- [quarter](https://vega.github.io/vega/docs/expressions/#quarter)
- [utcquarter](https://vega.github.io/vega/docs/expressions/#utcquarter)

**Array Functions**

- [clampRange](https://vega.github.io/vega/docs/expressions/#clampRange)
- [extent](https://vega.github.io/vega/docs/expressions/#extent)
- [inrange](https://vega.github.io/vega/docs/expressions/#inrange)
- [interpolateLinear](https://vega.github.io/vega/docs/expressions/#interpolateLinear)
- [lerp](https://vega.github.io/vega/docs/expressions/#lerp)
- [peek](https://vega.github.io/vega/docs/expressions/#peek)
- [sequence](https://vega.github.io/vega/docs/expressions/#sequence)
- [span](https://vega.github.io/vega/docs/expressions/#span)

**String Functions**

- [pad](https://vega.github.io/vega/docs/expressions/#pad)
- [truncate](https://vega.github.io/vega/docs/expressions/#truncate)

**Object Functions**

- [merge](https://vega.github.io/vega/docs/expressions/#merge)

**Formatting Functions**

- [format](https://vega.github.io/vega/docs/expressions/#format)
- [utcFormat](https://vega.github.io/vega/docs/expressions/#utcFormat)
- [utcParse](https://vega.github.io/vega/docs/expressions/#utcParse)
- [timeFormat](https://vega.github.io/vega/docs/expressions/#timeFormat)
- [timeParse](https://vega.github.io/vega/docs/expressions/#timeParse)
- [monthFormat](https://vega.github.io/vega/docs/expressions/#monthFormat)
- [monthAbbrevFormat](https://vega.github.io/vega/docs/expressions/#monthAbbrevFormat)
- [dayFormat](https://vega.github.io/vega/docs/expressions/#dayFormat)
- [dayAbbrevFormat](https://vega.github.io/vega/docs/expressions/#dayAbbrevFormat)

**Color Functions**

- [rgb](https://vega.github.io/vega/docs/expressions/#rgb)
- [lab](https://vega.github.io/vega/docs/expressions/#lab)
- [hcl](https://vega.github.io/vega/docs/expressions/#hcl)
- [hsl](https://vega.github.io/vega/docs/expressions/#hsl)

**Event Functions**

- [pinchDistance](https://vega.github.io/vega/docs/expressions/#pinchDistance)
- [pinchAngle](https://vega.github.io/vega/docs/expressions/#pinchAngle)
- [inScope](https://vega.github.io/vega/docs/expressions/#inScope)

**Scale and Projection Functions**

- [bandspace](https://vega.github.io/vega/docs/expressions/#bandspace)
- [bandwidth](https://vega.github.io/vega/docs/expressions/#bandwidth)
- [copy](https://vega.github.io/vega/docs/expressions/#copy)
- [domain](https://vega.github.io/vega/docs/expressions/#domain)
- [gradient](https://vega.github.io/vega/docs/expressions/#gradient)
- [invert](https://vega.github.io/vega/docs/expressions/#invert)
- [range](https://vega.github.io/vega/docs/expressions/#range)
- [scale](https://vega.github.io/vega/docs/expressions/#scale)
- [panLinear](https://vega.github.io/vega/docs/expressions/#panLinear)
- [panLog](https://vega.github.io/vega/docs/expressions/#panLog)
- [panPow](https://vega.github.io/vega/docs/expressions/#panPow)
- [panSymlog](https://vega.github.io/vega/docs/expressions/#panSymlog)
- [zoomLinear](https://vega.github.io/vega/docs/expressions/#zoomLinear)
- [zoomLog](https://vega.github.io/vega/docs/expressions/#zoomLog)
- [zoomPow](https://vega.github.io/vega/docs/expressions/#zoomPow)
- [zoomSymlog](https://vega.github.io/vega/docs/expressions/#zoomSymlog)
- flush (used internally for axis and legend label layout)

**Geographic Functions**

- [geoArea](https://vega.github.io/vega/docs/expressions/#geoArea)
- [geoBounds](https://vega.github.io/vega/docs/expressions/#geoBounds)
- [geoCentroid](https://vega.github.io/vega/docs/expressions/#geoCentroid)
- [geoScale](https://vega.github.io/vega/docs/expressions/#geoScale)
- [geoTranslate](https://vega.github.io/vega/docs/expressions/#geoTranslate)

**Shape Functions**

- geoShape (used internally for mark clipping)
- pathShape (used internally for mark clipping)

**Data Functions**

- [indata](https://vega.github.io/vega/docs/expressions/#indata)
- [data](https://vega.github.io/vega/docs/expressions/#data)
- setdata (used internally for scale domain data)
- modify (used internally for trigger updates)

**Dataflow Functions**

- encode (used internally for signal updates)

**Tree (Hierarchy) Functions**

- [treePath](https://vega.github.io/vega/docs/expressions/#treePath)
- [treeAncestors](https://vega.github.io/vega/docs/expressions/#treeAncestors)

**Browser Functions**

- [screen](https://vega.github.io/vega/docs/expressions/#screen)
- [containerSize](https://vega.github.io/vega/docs/expressions/#containerSize)
- [windowSize](https://vega.github.io/vega/docs/expressions/#windowSize)

**Logging Functions**

- [warn](https://vega.github.io/vega/docs/expressions/#warn)
- [info](https://vega.github.io/vega/docs/expressions/#info)
- [debug](https://vega.github.io/vega/docs/expressions/#debug)

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