123456789101112131415161718192021222324252627 |
- /*!
- * strip-tags <https://github.com/jonschlinkert/strip-tags>
- *
- * Copyright (c) 2015 Jon Schlinkert, contributors.
- * Licensed under the MIT license.
- */
- 'use strict';
- var cheerio = require('cheerio');
- module.exports = function(str, tags) {
- var $ = cheerio.load(str, {decodeEntities: false});
- if (!tags || tags.length === 0) {
- return str;
- }
- tags = !Array.isArray(tags) ? [tags] : tags;
- var len = tags.length;
- while (len--) {
- $(tags[len]).remove();
- }
- return $.html();
- };
|