Compare commits
	
		
			16 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 712ae72156 | |||
|  | c5a3340a13 | ||
|  | 49f9469bfd | ||
|  | c54fef010f | ||
|  | 8b84926984 | ||
|  | ed4674f721 | ||
|  | 545cae0f21 | ||
|  | c439d0a170 | ||
| 68b8abc469 | |||
|  | df97310b71 | ||
|  | 76cb135585 | ||
|  | a109259e10 | ||
|  | c4626055ff | ||
|  | 20bed84814 | ||
|  | e7c9b79676 | ||
|  | 66ab9f25b4 | 
							
								
								
									
										32
									
								
								LICENSE
									
									
									
									
									
								
							
							
						
						
									
										32
									
								
								LICENSE
									
									
									
									
									
								
							| @ -1,3 +1,32 @@ | |||||||
|  | At your option you may choose either of the following licenses: | ||||||
|  | 
 | ||||||
|  |   * The MIT License (MIT) | ||||||
|  |   * The Apache License 2.0 (Apache-2.0) | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | The MIT License (MIT) | ||||||
|  | 
 | ||||||
|  | Copyright (c) 2015 AJ ONeal | ||||||
|  | 
 | ||||||
|  | Permission is hereby granted, free of charge, to any person obtaining a copy | ||||||
|  | of this software and associated documentation files (the "Software"), to deal | ||||||
|  | in the Software without restriction, including without limitation the rights | ||||||
|  | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||||||
|  | copies of the Software, and to permit persons to whom the Software is | ||||||
|  | furnished to do so, subject to the following conditions: | ||||||
|  | 
 | ||||||
|  | The above copyright notice and this permission notice shall be included in all | ||||||
|  | copies or substantial portions of the Software. | ||||||
|  | 
 | ||||||
|  | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||||||
|  | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||||
|  | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||||||
|  | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||||||
|  | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||||||
|  | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||||||
|  | SOFTWARE. | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|                                  Apache License |                                  Apache License | ||||||
|                            Version 2.0, January 2004 |                            Version 2.0, January 2004 | ||||||
|                         http://www.apache.org/licenses/ |                         http://www.apache.org/licenses/ | ||||||
| @ -186,7 +215,7 @@ | |||||||
|       same "printed page" as the copyright notice for easier |       same "printed page" as the copyright notice for easier | ||||||
|       identification within third-party archives. |       identification within third-party archives. | ||||||
| 
 | 
 | ||||||
|    Copyright {yyyy} {name of copyright owner} |    Copyright 2015 AJ ONeal | ||||||
| 
 | 
 | ||||||
|    Licensed under the Apache License, Version 2.0 (the "License"); |    Licensed under the Apache License, Version 2.0 (the "License"); | ||||||
|    you may not use this file except in compliance with the License. |    you may not use this file except in compliance with the License. | ||||||
| @ -199,4 +228,3 @@ | |||||||
|    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||||
|    See the License for the specific language governing permissions and |    See the License for the specific language governing permissions and | ||||||
|    limitations under the License. |    limitations under the License. | ||||||
| 
 |  | ||||||
|  | |||||||
							
								
								
									
										27
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										27
									
								
								README.md
									
									
									
									
									
								
							| @ -14,9 +14,11 @@ See also | |||||||
|   * [TextEncoderLite (based on text-encoding)](https://github.com/coolaj86/TextEncoderLite/tree/lite) |   * [TextEncoderLite (based on text-encoding)](https://github.com/coolaj86/TextEncoderLite/tree/lite) | ||||||
|   * [Beatgammit's base64-js](https://github.com/beatgammit/base64-js) |   * [Beatgammit's base64-js](https://github.com/beatgammit/base64-js) | ||||||
| 
 | 
 | ||||||
| Quick Note to Node.js Users | Are you in the right place? | ||||||
| ------------------------ | ------------------------ | ||||||
| 
 | 
 | ||||||
|  | Dear Node.js Users: | ||||||
|  | 
 | ||||||
| You SHOULD NOT use this module. You already have [`Buffer`](https://nodejs.org/api/buffer.html) and [`thirty-two`](https://github.com/chrisumbel/thirty-two): | You SHOULD NOT use this module. You already have [`Buffer`](https://nodejs.org/api/buffer.html) and [`thirty-two`](https://github.com/chrisumbel/thirty-two): | ||||||
| 
 | 
 | ||||||
| ```javascript | ```javascript | ||||||
| @ -28,6 +30,25 @@ buf.toString('utf8'); | |||||||
| buf.toString('binary'); // deprecated, do not use | buf.toString('binary'); // deprecated, do not use | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
|  | Install | ||||||
|  | ------- | ||||||
|  | 
 | ||||||
|  | You just include the `index.js` in a lovely script tag. | ||||||
|  | 
 | ||||||
|  | ```bash | ||||||
|  | bower install --save unibabel | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | ```html | ||||||
|  | <script src="/bower_components/unibabel/index.js"></script> | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | Dear WebPack / Broccoli, Gulp / Grunt Users: | ||||||
|  | 
 | ||||||
|  | I don't know how your build systems work these days, | ||||||
|  | but Unibabel is exported as `Unibabel` | ||||||
|  | and you can access it as `window.Unibabel`. | ||||||
|  | 
 | ||||||
| API | API | ||||||
| === | === | ||||||
| 
 | 
 | ||||||
| @ -43,12 +64,12 @@ var uint8Array = Unibabel.base64ToArr(base64) | |||||||
| 
 | 
 | ||||||
| **Normal APIs** | **Normal APIs** | ||||||
| 
 | 
 | ||||||
|  | `index.js` | ||||||
|  | 
 | ||||||
| * utf8ToBuffer(utf8str) => array | * utf8ToBuffer(utf8str) => array | ||||||
| * bufferToUtf8(array) => string | * bufferToUtf8(array) => string | ||||||
| 
 |  | ||||||
| * utf8ToBase64(utf8str) => base64 | * utf8ToBase64(utf8str) => base64 | ||||||
| * base64ToUtf8(base64) => string | * base64ToUtf8(base64) => string | ||||||
| 
 |  | ||||||
| * bufferToBase64(array) => base64 | * bufferToBase64(array) => base64 | ||||||
| * base64ToBuffer(base64) => array | * base64ToBuffer(base64) => array | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -1,10 +1,9 @@ | |||||||
| { | { | ||||||
|   "name": "unibabel", |   "name": "unibabel", | ||||||
|   "main": "index.js", |   "main": "index.js", | ||||||
|   "version": "2.1.3", |   "homepage": "https://git.coolaj86.com/coolaj86/unibabel.js", | ||||||
|   "homepage": "https://github.com/coolaj86/unibabel-js", |  | ||||||
|   "authors": [ |   "authors": [ | ||||||
|     "AJ ONeal <awesome@coolaj86.com>" |     "AJ ONeal <coolaj86@gmail.com>" | ||||||
|   ], |   ], | ||||||
|   "description": "Convert between UTF8, TypedArrays, and Base64", |   "description": "Convert between UTF8, TypedArrays, and Base64", | ||||||
|   "moduleType": [ |   "moduleType": [ | ||||||
|  | |||||||
| @ -4,9 +4,9 @@ | |||||||
| </head> | </head> | ||||||
| <body> | <body> | ||||||
|   This is for testing. Look in the console. |   This is for testing. Look in the console. | ||||||
|   <script src="./index.js"></script> |   <script src="../index.js"></script> | ||||||
|   <script src="./unibabel.hex.js"></script> |   <script src="../unibabel.hex.js"></script> | ||||||
|   <script src="./unibabel.base32.js"></script> |   <script src="../unibabel.base32.js"></script> | ||||||
|   <script src="./test.js"></script> |   <script src="./test.js"></script> | ||||||
| </body> | </body> | ||||||
| </html> | </html> | ||||||
							
								
								
									
										6
									
								
								index.js
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								index.js
									
									
									
									
									
								
							| @ -1,4 +1,4 @@ | |||||||
| (function () { | (function (exports) { | ||||||
| 'use strict'; | 'use strict'; | ||||||
| 
 | 
 | ||||||
| function utf8ToBinaryString(str) { | function utf8ToBinaryString(str) { | ||||||
| @ -82,7 +82,7 @@ function base64ToBuffer(base64) { | |||||||
|   return buf; |   return buf; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| window.Unibabel = { | exports.Unibabel = { | ||||||
|   utf8ToBinaryString: utf8ToBinaryString |   utf8ToBinaryString: utf8ToBinaryString | ||||||
| , utf8ToBuffer: utf8ToBuffer | , utf8ToBuffer: utf8ToBuffer | ||||||
| , utf8ToBase64: utf8ToBase64 | , utf8ToBase64: utf8ToBase64 | ||||||
| @ -101,4 +101,4 @@ window.Unibabel = { | |||||||
| , base64ToArr: base64ToBuffer | , base64ToArr: base64ToBuffer | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| }()); | }('undefined' !== typeof exports && exports || 'undefined' !== typeof window && window || global)); | ||||||
|  | |||||||
							
								
								
									
										2
									
								
								node.js
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								node.js
									
									
									
									
									
								
							| @ -1,6 +1,6 @@ | |||||||
| 'use strict'; | 'use strict'; | ||||||
| 
 | 
 | ||||||
| console.warn("Please don't use Unibabel in node.js. If you think you really think you have a valid use case please report it at https://github.com/coolaj86/unibabel-js/issues/new"); | console.warn("Please don't use Unibabel in node.js. If you think you really think you have a valid use case please report it at https://git.coolaj86.com/coolaj86/unibabel.js/issues/new"); | ||||||
| throw new Error("[unibabel] you're doing it wrong"); | throw new Error("[unibabel] you're doing it wrong"); | ||||||
| 
 | 
 | ||||||
| /* | /* | ||||||
|  | |||||||
							
								
								
									
										14
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								package.json
									
									
									
									
									
								
							| @ -1,17 +1,17 @@ | |||||||
| { | { | ||||||
|   "name": "unibabel", |   "name": "unibabel", | ||||||
|   "version": "2.1.3", |   "version": "2.1.8", | ||||||
|   "description": "Base64, TypedArrays, and UTF-8 / Unicode conversions in Browser (and Node) JavaScript", |   "description": "Base64, TypedArrays, and UTF-8 / Unicode conversions in Browser (and Node) JavaScript", | ||||||
|   "main": "node.js", |   "main": "node.js", | ||||||
|   "browser": { |   "browser": { | ||||||
|     "./node.js": "./index.js" |     "./node.js": "./index.js" | ||||||
|   } |   }, | ||||||
|   "scripts": { |   "scripts": { | ||||||
|     "test": "echo \"Error: no test specified\" && exit 1" |     "test": "echo \"Error: no test specified\" && exit 1" | ||||||
|   }, |   }, | ||||||
|   "repository": { |   "repository": { | ||||||
|     "type": "git", |     "type": "git", | ||||||
|     "url": "git+https://github.com/coolaj86/unibabel-js.git" |     "url": "https://git.coolaj86.com/coolaj86/unibabel.js.git" | ||||||
|   }, |   }, | ||||||
|   "keywords": [ |   "keywords": [ | ||||||
|     "ascii", |     "ascii", | ||||||
| @ -28,10 +28,10 @@ | |||||||
|     "Base32", |     "Base32", | ||||||
|     "b32" |     "b32" | ||||||
|   ], |   ], | ||||||
|   "author": "AJ ONeal <coolaj86@gmail.com> (http://coolaj86.com/)", |   "author": "AJ ONeal <coolaj86@gmail.com> (https://coolaj86.com/)", | ||||||
|   "license": "Apache-2.0", |   "license": "(MIT OR Apache-2.0)", | ||||||
|   "bugs": { |   "bugs": { | ||||||
|     "url": "https://github.com/coolaj86/unibabel-js/issues" |     "url": "https://git.coolaj86.com/coolaj86/unibabel.js/issues" | ||||||
|   }, |   }, | ||||||
|   "homepage": "https://github.com/coolaj86/unibabel-js#readme" |   "homepage": "https://git.coolaj86.com/coolaj86/unibabel.js#readme" | ||||||
| } | } | ||||||
|  | |||||||
| @ -1 +0,0 @@ | |||||||
| index.js |  | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user