unescape
Advanced tools
Comparing version 0.1.1 to 0.2.0
19
index.js
@@ -1,11 +0,4 @@ | ||
/*! | ||
* unescape <https://github.com/jonschlinkert/unescape> | ||
* | ||
* Copyright (c) 2014 Jon Schlinkert, contributors. | ||
* Licensed under the MIT License | ||
*/ | ||
'use strict'; | ||
var cache; | ||
@@ -19,9 +12,7 @@ /** | ||
var unescape = module.exports = function (str) { | ||
var unescape = module.exports = function(str) { | ||
if (str == null) return ''; | ||
var re = new RegExp('(' + Object.keys(chars) | ||
.join('|') + ')', 'g'); | ||
return String(str).replace(re, function (match) { | ||
var re = cache || (cache = new RegExp('(' + Object.keys(chars).join('|') + ')', 'g')); | ||
return String(str).replace(re, function(match) { | ||
return chars[match]; | ||
@@ -31,4 +22,4 @@ }); | ||
var chars = unescape.chars = { | ||
''': '\'', | ||
''': '\'', | ||
@@ -35,0 +26,0 @@ '&': '&', |
{ | ||
"name": "unescape", | ||
"description": "Convert the HTML entities in a string to their corresponding HTML characters, e.g. `>` converts to `>`.", | ||
"version": "0.1.1", | ||
"description": "Convert HTML entities to HTML characters, e.g. `>` converts to `>`.", | ||
"version": "0.2.0", | ||
"homepage": "https://github.com/jonschlinkert/unescape", | ||
"author": { | ||
"name": "Jon Schlinkert", | ||
"url": "https://github.com/jonschlinkert" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/jonschlinkert/unescape.git" | ||
}, | ||
"author": "Jon Schlinkert (https://github.com/jonschlinkert)", | ||
"repository": "jonschlinkert/unescape", | ||
"bugs": { | ||
"url": "https://github.com/jonschlinkert/unescape/issues" | ||
}, | ||
"licenses": [ | ||
{ | ||
"type": "MIT", | ||
"url": "https://github.com/jonschlinkert/unescape/blob/master/LICENSE-MIT" | ||
} | ||
"license": "MIT", | ||
"files": [ | ||
"index.js" | ||
], | ||
@@ -28,22 +20,41 @@ "main": "index.js", | ||
"scripts": { | ||
"test": "mocha -R spec" | ||
"test": "mocha" | ||
}, | ||
"devDependencies": { | ||
"verb-tag-jscomments": ">= 0.2.0", | ||
"verb": ">= 0.2.6", | ||
"mocha": "*" | ||
"gulp-format-md": "^0.1.11", | ||
"mocha": "^3.2.0" | ||
}, | ||
"keywords": [ | ||
"string", | ||
"entity", | ||
"entities", | ||
"char", | ||
"character", | ||
"characters", | ||
"character", | ||
"entities", | ||
"entity", | ||
"escape", | ||
"html", | ||
"xml", | ||
"escape", | ||
"string", | ||
"un-escape", | ||
"unescape", | ||
"un-escape" | ||
] | ||
"xml" | ||
], | ||
"verb": { | ||
"toc": false, | ||
"layout": "default", | ||
"tasks": [ | ||
"readme" | ||
], | ||
"plugins": [ | ||
"gulp-format-md" | ||
], | ||
"lint": { | ||
"reflinks": true | ||
}, | ||
"related": { | ||
"list": [] | ||
}, | ||
"reflinks": [ | ||
"verb", | ||
"verb-generate-readme" | ||
] | ||
} | ||
} |
@@ -1,17 +0,11 @@ | ||
# unescape [![NPM version](https://badge.fury.io/js/unescape.svg)](http://badge.fury.io/js/unescape) | ||
# unescape [![NPM version](https://img.shields.io/npm/v/unescape.svg?style=flat)](https://www.npmjs.com/package/unescape) [![NPM monthly downloads](https://img.shields.io/npm/dm/unescape.svg?style=flat)](https://npmjs.org/package/unescape) [![NPM total downloads](https://img.shields.io/npm/dt/unescape.svg?style=flat)](https://npmjs.org/package/unescape) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/unescape.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/unescape) | ||
> Convert HTML entities to HTML characters, e.g. `>` converts to `>`. | ||
> Convert the HTML entities in a string to their corresponding HTML characters, e.g. `>` converts to `>`. | ||
## Install | ||
#### Install with [npm](npmjs.org): | ||
```bash | ||
npm i unescape --save-dev | ||
``` | ||
Install with [npm](https://www.npmjs.com/): | ||
## Run tests | ||
```bash | ||
npm test | ||
```sh | ||
$ npm install --save unescape | ||
``` | ||
@@ -51,15 +45,40 @@ | ||
## Author | ||
## About | ||
### Contributing | ||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). | ||
### Building docs | ||
_(This document was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme) (a [verb](https://github.com/verbose/verb) generator), please don't edit the readme directly. Any changes to the readme must be made in [.verb.md](.verb.md).)_ | ||
To generate the readme and API documentation with [verb](https://github.com/verbose/verb): | ||
```sh | ||
$ npm install -g verb verb-generate-readme && verb | ||
``` | ||
### Running tests | ||
Install dev dependencies: | ||
```sh | ||
$ npm install -d && npm test | ||
``` | ||
### Author | ||
**Jon Schlinkert** | ||
+ [github/jonschlinkert](https://github.com/jonschlinkert) | ||
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) | ||
## License | ||
Copyright (c) 2014 Jon Schlinkert, contributors. | ||
Released under the MIT license | ||
* [github/jonschlinkert](https://github.com/jonschlinkert) | ||
* [twitter/jonschlinkert](http://twitter.com/jonschlinkert) | ||
### License | ||
Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert). | ||
Released under the [MIT license](https://github.com/jonschlinkert/unescape/blob/master/LICENSE). | ||
*** | ||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on September 14, 2014._ | ||
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.2.0, on November 27, 2016._ |
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
2
83
5004
4
23
1