endianness
Advanced tools
Comparing version 5.0.0-alpha.2 to 5.0.0-alpha.3
@@ -1,2 +0,2 @@ | ||
window.endianness=function(d){function c(a){if(e[a])return e[a].a;var b=e[a]={m:a,f:!1,a:{}};d[a].call(b.a,b,b.a,c);b.f=!0;return b.a}var e={};c.l=d;c.h=e;c.b=function(a,b){c.c(a)||Object.defineProperty(a,"a",{configurable:!1,enumerable:!0,get:b})};c.i=function(a){var b=a&&a.g?function(){return a["default"]}:function(){return a};c.b(b,b);return b};c.c=function(a){return Object.prototype.hasOwnProperty.call(a,"a")};c.j="";return c(c.o=0)}([function(d){d.a=function(c,e){for(var a=c.length,b=0;b<a;){for(var d= | ||
c,f=b,g=0,h=e-1,k=parseInt(e/2,10);g<k;){var l=d[f+g];d[f+g]=d[f+h];d[f+h]=l;g++;h--}b+=e}}}]); | ||
window.endianness=function(d){function c(a){if(e[a])return e[a].a;var b=e[a]={m:a,f:!1,a:{}};d[a].call(b.a,b,b.a,c);b.f=!0;return b.a}var e={};c.l=d;c.h=e;c.b=function(a,b){c.c(a)||Object.defineProperty(a,"a",{configurable:!1,enumerable:!0,get:b})};c.i=function(a){var b=a&&a.g?function(){return a["default"]}:function(){return a};c.b(b,b);return b};c.c=function(a){return Object.prototype.hasOwnProperty.call(a,"a")};c.j="";return c(c.o=0)}([function(d){d.a=function(c,e){var a=c.length;if(a%e)throw Error("Not enough bytes."); | ||
for(var b=0;b<a;){for(var d=c,f=b,g=0,h=e-1,k=parseInt(e/2,10);g<k;){var l=d[f+g];d[f+g]=d[f+h];d[f+h]=l;g++;h--}b+=e}}}]); |
29
index.js
/* | ||
* endianness | ||
* Swap endianness in byte arrays. | ||
* Copyright (c) 2017 Rafael da Silva Rocha. | ||
* endianness: Swap endianness in byte arrays. | ||
* https://github.com/rochars/endianness | ||
* | ||
* Copyright (c) 2017-2018 Rafael da Silva Rocha. | ||
* | ||
* 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. | ||
* | ||
*/ | ||
@@ -17,2 +36,5 @@ | ||
let len = bytes.length; | ||
if (len % offset) { | ||
throw new Error("Not enough bytes."); | ||
} | ||
let i = 0; | ||
@@ -31,2 +53,3 @@ while (i < len) { | ||
* @param {number} index The start index of the unit of information. | ||
* @private | ||
*/ | ||
@@ -33,0 +56,0 @@ function swap(bytes, offset, index) { |
{ | ||
"name": "endianness", | ||
"version": "5.0.0-alpha.2", | ||
"version": "5.0.0-alpha.3", | ||
"description": "Swap endianness in byte arrays.", | ||
@@ -25,2 +25,5 @@ "homepage": "https://github.com/rochars/endianness", | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/rochars/endianness/issues" | ||
}, | ||
"scripts": { | ||
@@ -37,2 +40,3 @@ "lint": "jshint index.js", | ||
"browser-env": "^3.2.5", | ||
"chai": "^4.1.2", | ||
"codecov": "^3.0.0", | ||
@@ -39,0 +43,0 @@ "docdash": "^0.4.0", |
# endianness | ||
Swap endianness in byte arrays. | ||
Copyright (c) 2017 Rafael da Silva Rocha. | ||
Copyright (c) 2017-2018 Rafael da Silva Rocha. | ||
https://github.com/rochars/endianness | ||
[![NPM version](https://img.shields.io/npm/v/endianness.svg?style=for-the-badge)](https://www.npmjs.com/package/endianness) [![Docs](https://img.shields.io/badge/docs-online-blue.svg?style=for-the-badge)](https://rochars.github.io/endianness/index.html) | ||
[![Codecov](https://img.shields.io/codecov/c/github/rochars/endianness.svg?style=flat-square)](https://codecov.io/gh/rochars/endianness) [![Unix Build](https://img.shields.io/travis/rochars/endianness.svg?style=flat-square)](https://travis-ci.org/rochars/endianness) [![Windows Build](https://img.shields.io/appveyor/ci/rochars/endianness.svg?style=flat-square&logo=appveyor)](https://ci.appveyor.com/project/rochars/endianness) [![Scrutinizer](https://img.shields.io/scrutinizer/g/rochars/endianness.svg?style=flat-square&logo=scrutinizer)](https://scrutinizer-ci.com/g/rochars/endianness/) | ||
@@ -30,3 +30,3 @@ Swap endianness in byte arrays. The input array is modified in-place. | ||
```html | ||
<script src="https://cdn.jsdelivr.net/npm/endianness@5"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/endianness@5/dist/endianness.min.js"></script> | ||
``` | ||
@@ -59,3 +59,3 @@ | ||
## LICENSE | ||
Copyright (c) 2017 Rafael da Silva Rocha. | ||
Copyright (c) 2017-2018 Rafael da Silva Rocha. | ||
@@ -62,0 +62,0 @@ Permission is hereby granted, free of charge, to any person obtaining |
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
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
9012
67
11