PHPackages                             arraypress/wp-mdash - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. arraypress/wp-mdash

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

arraypress/wp-mdash
===================

Minimal WordPress polyfill for handling empty values with mdash

07PHP

Since Jan 31Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/arraypress/wp-mdash)[ Packagist](https://packagist.org/packages/arraypress/wp-mdash)[ RSS](/packages/arraypress-wp-mdash/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

WordPress MDash Polyfill
========================

[](#wordpress-mdash-polyfill)

Minimal WordPress polyfill for handling empty values with em dashes.

Installation
------------

[](#installation)

```
composer require arraypress/wp-mdash
```

Functions
---------

[](#functions)

### `mdash( $value ): string`

[](#mdash-value--string)

Return an em dash if value is empty, otherwise return the value.

```
mdash( '' );         // '&mdash;'
mdash( null );       // '&mdash;'
mdash( false );      // '&mdash;'
mdash( 0 );          // '&mdash;'
mdash( 'Hello' );    // 'Hello'
mdash( 42 );         // '42'
```

### `mdash_esc( $value ): string`

[](#mdash_esc-value--string)

Return an em dash if value is empty, otherwise return the escaped value.

```
mdash_esc( '' );                    // '&mdash;'
mdash_esc( 'Hello' );               // 'Hello'
mdash_esc( 'alert()' );  // '&lt;script&gt;alert()&lt;/script&gt;'
```

Usage
-----

[](#usage)

### Admin Tables

[](#admin-tables)

```

```

### Settings Pages

[](#settings-pages)

```

    API Key
