endianness
Advanced tools
Comparing version 8.0.0 to 8.0.1
# CHANGELOG | ||
## version 8.0.1 (2018-08-03) | ||
- compatible with IE6+ | ||
- iife UMD | ||
## version 8.0.0 (2018-07-29) | ||
@@ -4,0 +8,0 @@ - compatible with IE8+ |
@@ -1,5 +0,1 @@ | ||
/*! | ||
* https://github.com/rochars/endianness | ||
* Copyright (c) 2017-2018 Rafael da Silva Rocha. MIT License. | ||
*/ | ||
function endianness(d,c,a,b){b=void 0===b?d.length:b;if(b%c)throw Error("Bad buffer length.");for(a=void 0===a?0:a;a<b;a+=c)swap(d,c,a)}function swap(d,c,a){c--;for(var b=0;b<c;b++){var e=d[a+b];d[a+b]=d[a+c];d[a+c]=e;c--}};typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = endianness :typeof define === 'function' && define.amd ? define(['exports'], endianness) :typeof global !== 'undefined' ? global.endianness = endianness : null; | ||
;var endianness=(function(exports){function endianness(d,c,a,b){b=void 0===b?d.length:b;if(b%c)throw Error("Bad buffer length.");for(a=void 0===a?0:a;a<b;a+=c)swap(d,c,a)}function swap(d,c,a){c--;for(var b=0;b<c;b++){var e=d[a+b];d[a+b]=d[a+c];d[a+c]=e;c--}};var exports = exports || {}; exports = endianness; exports.endianness = endianness; exports['default'] = endianness;typeof module !== 'undefined' ? module.exports = endianness :typeof define === 'function' && define.amd ? define(['exports'], endianness) :typeof global !== 'undefined' ? global.endianness = endianness : null; return endianness;})(); |
{ | ||
"name": "endianness", | ||
"version": "8.0.0", | ||
"version": "8.0.1", | ||
"description": "Swap endianness in byte arrays.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/rochars/endianness", |
@@ -10,6 +10,9 @@ # endianness | ||
- Use it everywhere, server and browser | ||
- Use it with any byte offset | ||
- Swap only parts of the buffer | ||
- Compatible with IE8+ | ||
- **MIT licensed** | ||
- **Compatible with IE6+ and browsers that support ES3/ES5/ES6+** | ||
- **Use it out of the box in Node.js** | ||
- **Use it out of the box with [TypeScript](https://www.typescriptlang.org/)** | ||
- **Use it with any byte offset** | ||
- **Swap only a slice of the buffer** | ||
- **Less than 1kb minified!** | ||
@@ -23,20 +26,2 @@ ## Install | ||
### Node | ||
Require or import **endianness** from **endianness**: | ||
```javascript | ||
import endianness from 'endianness'; | ||
// Swap endianness of one 64-bit value: | ||
let bytes = [64, 9, 33, 251, 84, 68, 45, 24]; | ||
endianness(bytes, 8); | ||
``` | ||
```javascript | ||
const endianness = require("endianness"); | ||
// Swap endianness of two 24-bit values: | ||
let bytes = new Uint8Array(["00", "00", "80", "ff", "ff", "7f"]); | ||
endianness(bytes, 3), | ||
``` | ||
### Browser | ||
@@ -63,2 +48,26 @@ Use **endianness.umd.js**: | ||
#### Browser compatibility | ||
**endianness.umd.js** is transpiled to ES3 and compatible with IE6+. Should work in all modern browsers that support ES3/ES5/ES6+. | ||
Cross-browser tests powered by | ||
<a href="https://www.browserstack.com"><img src="https://rochars.github.io/endianness/docs/Browserstack-logo@2x.png" width="150px"/></a> | ||
### Node | ||
Require or import **endianness** from **endianness**: | ||
```javascript | ||
import endianness from 'endianness'; | ||
// Swap endianness of one 64-bit value: | ||
let bytes = [64, 9, 33, 251, 84, 68, 45, 24]; | ||
endianness(bytes, 8); | ||
``` | ||
```javascript | ||
const endianness = require("endianness"); | ||
// Swap endianness of two 24-bit values: | ||
let bytes = new Uint8Array(["00", "00", "80", "ff", "ff", "7f"]); | ||
endianness(bytes, 3), | ||
``` | ||
## API | ||
@@ -65,0 +74,0 @@ ```javascript |
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
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
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
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
12088
104
81