UNPKG

@wordpress/editor

Version:
38 lines (36 loc) 1.3 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.cleanForSlug = cleanForSlug; var _url = require("@wordpress/url"); var _deprecated = _interopRequireDefault(require("@wordpress/deprecated")); /** * WordPress dependencies */ /** * Performs some basic cleanup of a string for use as a post slug * * This replicates some of what sanitize_title() does in WordPress core, but * is only designed to approximate what the slug will be. * * Converts Latin-1 Supplement and Latin Extended-A letters to basic Latin letters. * Removes combining diacritical marks. Converts whitespace, periods, * and forward slashes to hyphens. Removes any remaining non-word characters * except hyphens and underscores. Converts remaining string to lowercase. * It does not account for octets, HTML entities, or other encoded characters. * * @param {string} string Title or slug to be processed * * @return {string} Processed string */ function cleanForSlug(string) { (0, _deprecated.default)('wp.editor.cleanForSlug', { since: '12.7', plugin: 'Gutenberg', alternative: 'wp.url.cleanForSlug' }); return (0, _url.cleanForSlug)(string); } //# sourceMappingURL=url.js.map