emailjs-utf7
Advanced tools
Comparing version 3.0.1 to 4.0.0
{ | ||
"name": "emailjs-utf7", | ||
"main": "src/emailjs-utf7.js", | ||
"version": "3.0.1", | ||
"main": "dist/utf7.js", | ||
"version": "4.0.0", | ||
"homepage": "https://github.com/emailjs/emailjs-utf7", | ||
"author": "Konstantin Käfer", | ||
"description": "Converts text to and from UTF-7 (RFC 2152 and IMAP)", | ||
"keywords": ["IMAP", "RFC2152", "UTF7"], | ||
"keywords": [ | ||
"IMAP", | ||
"RFC2152", | ||
"UTF7" | ||
], | ||
"scripts": { | ||
"test": "grunt" | ||
"build": "./scripts/build.sh", | ||
"release": "./scripts/release.sh", | ||
"lint": "$(npm bin)/standard", | ||
"test": "npm run lint && npm run unit", | ||
"unit": "$(npm bin)/mocha './src/*-unit.js' --reporter spec --require babel-register testutils.js", | ||
"test-watch": "$(npm bin)/mocha './src/*-unit.js' --reporter spec --require babel-register testutils.js --watch" | ||
}, | ||
@@ -17,14 +26,29 @@ "repository": { | ||
"license": "MIT", | ||
"dependencies": {}, | ||
"dependencies": { | ||
"emailjs-base64": "^1.0.3" | ||
}, | ||
"devDependencies": { | ||
"chai": "~1.8.1", | ||
"grunt": "~0.4.1", | ||
"grunt-mocha-phantomjs": "~0.4.0", | ||
"grunt-contrib-connect": "~0.6.0", | ||
"grunt-contrib-jshint": "~0.8.0", | ||
"grunt-mocha-test": "~0.8.1", | ||
"mocha": "~1.16.2", | ||
"phantomjs": "~1.9.7-1", | ||
"requirejs": "~2.1.10" | ||
"babel-cli": "^6.26.0", | ||
"babel-preset-es2015": "^6.24.1", | ||
"babel-register": "^6.26.0", | ||
"chai": "^4.1.2", | ||
"mocha": "^4.0.1", | ||
"nodemon": "^1.12.1", | ||
"pre-commit": "^1.2.2", | ||
"standard": "^10.0.3" | ||
}, | ||
"standard": { | ||
"globals": [ | ||
"describe", | ||
"it", | ||
"before", | ||
"beforeAll", | ||
"afterAll", | ||
"after", | ||
"expect" | ||
], | ||
"ignore": [ | ||
"dist" | ||
] | ||
} | ||
} |
# UTF-7 | ||
UMD module that encodes and decodes JavaScript (Unicode/UCS-2) strings to UTF-7 ASCII strings. It supports two modes: UTF-7 as defined in [RFC 2152](http://tools.ietf.org/html/rfc2152) and Modified UTF-7 as defined by the IMAP standard in [RFC 3501, section 5.1.3](http://tools.ietf.org/html/rfc3501#section-5.1.3) | ||
[![Greenkeeper badge](https://badges.greenkeeper.io/emailjs/emailjs-utf7.svg)](https://greenkeeper.io/) [![Build Status](https://travis-ci.org/emailjs/emailjs-utf7.png?branch=master)](https://travis-ci.org/emailjs/emailjs-utf7) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) [![ES6+](https://camo.githubusercontent.com/567e52200713e0f0c05a5238d91e1d096292b338/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f65732d362b2d627269676874677265656e2e737667)](https://kangax.github.io/compat-table/es6/) | ||
Encodes and decodes JavaScript (Unicode/UCS-2) strings to UTF-7 ASCII strings. It supports two modes: UTF-7 as defined in [RFC 2152](http://tools.ietf.org/html/rfc2152) and Modified UTF-7 as defined by the IMAP standard in [RFC 3501, section 5.1.3](http://tools.ietf.org/html/rfc3501#section-5.1.3) | ||
## Usage | ||
[bower | npm] install emailjs-utf7 | ||
``` | ||
npm install --save emailjs-utf7 | ||
``` | ||
### node.js | ||
```javascript | ||
import { encode, encodeAll, decode, imapEncode, imapDecode } from 'emailjs-utf7' | ||
``` | ||
var utf7 = require('emailjs-utf7'); | ||
### Browser | ||
Require [utf7.js](src/utf7.js) either as a AMD module include it globally in your markup like a regular ```<script>``` (exposes utf7). | ||
### RFC 2152 | ||
var encoded = utf7.encode('Jyväskylä'); | ||
'Jyv+AOQ-skyl+AOQ-' === encoded; // true | ||
```javascript | ||
encode('Jyväskylä') // -> 'Jyv+AOQ-skyl+AOQ-' | ||
decode(encoded); // -> 'Jyväskylä' | ||
``` | ||
var decoded = utf7.decode(encoded); | ||
'Jyväskylä' === decoded; // true | ||
By default, `encode()` only encodes the default characeters defined in RFC 2152. To also encode optional characters, use `encodeAll()` or specify the characters you want to encode as the second argument to `.encode()`. | ||
By default, `.encode()` only encodes the default characeters defined in RFC 2152. To also encode optional characters, use `.encodeAll()` or specify the characters you want to encode as the second argument to `.encode()`. | ||
### IMAP (RFC 3501) | ||
var encoded = utf7.imap.encode('"你好" heißt "Hallo"'); | ||
'"&T2BZfQ-" hei&AN8-t "Hallo"' === encoded; | ||
```javascript | ||
imapEncode('"你好" heißt "Hallo"') // -> '"&T2BZfQ-" hei&AN8-t "Hallo"' | ||
imapDecode(encoded) // -> '"你好" heißt "Hallo"' | ||
``` | ||
var decoded = utf7.imap.decode(encoded); | ||
'"你好" heißt "Hallo"' === decoded; | ||
## License | ||
@@ -61,2 +60,2 @@ | ||
UMD fork licensed under MIT by Andris Reinman | ||
Fork licensed under MIT by Andris Reinman |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
26021
8
13
0
1
285
61
1
+ Addedemailjs-base64@^1.0.3
+ Addedemailjs-base64@1.1.4(transitive)