# shape2path **Repository Path**: mirrors_mapbox/shape2path ## Basic Information - **Project Name**: shape2path - **Description**: Convert SVG shapes to SVG paths - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-09 - **Last Updated**: 2025-11-08 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # shape2path [![Build Status](https://travis-ci.org/HarryStevens/shape2path.svg?branch=master)](https://travis-ci.org/HarryStevens/shape2path) [![Coverage Status](https://coveralls.io/repos/github/HarryStevens/shape2path/badge.svg)](https://coveralls.io/github/HarryStevens/shape2path) Convert SVG [shapes](https://developer.mozilla.org/en-US/docs/Web/SVG/Element#Basic_shapes) to SVG [paths](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/path). Check out [this demo](https://bl.ocks.org/HarryStevens/944fc151f210ddf6bd6ebaeda12c3d05). ## Installation ### npm ```bash npm install shape2path --save ``` ```js var shape2path = require("shape2path"); ``` ### Web browser You can use the CDN from unpkg. ```html ``` If you'd rather host it yourself, download `shape2path.js` or `shape2path.min.js` from the [`build` directory](https://github.com/HarryStevens/shape2path/tree/master/build). ```html ``` ## API shape2path's functions all take a single argument: an options object whose properties correspond to the attributes of an SVG shape. Likewise, they all return a single string: an SVG path's `d` attribute. # shape2path.**circle**(*options*) Draw a path shaped like a [circle](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/circle). # shape2path.**ellipse**(*options*) Draw a path shaped like an [ellipse](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/ellipse). # shape2path.**line**(*options*) Draw a path shaped like a [line](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/line). # shape2path.**polygon**(*options*) Draw a path shaped like a [polygon](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/polygon). # shape2path.**polyline**(*options*) Draw a path shaped like a [polyline](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/polyline). # shape2path.**rect**(*options*) Draw a path shaped like a [rectangle](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/rect). Add `rx` or `ry` properties to the options to round the corners.