From 2ec185d7f04bd5ba44cf2ee3117be32181f6e74b Mon Sep 17 00:00:00 2001
From: Siddhesh Rane <kingsid911@gmail.com>
Date: Wed, 1 Feb 2017 15:31:01 +0000
Subject: [PATCH] Added some build deps for browserify and uglify

---
 debian/control                                |   2 +
 debian/debhelper-build-stamp                  |   1 +
 debian/files                                  |   2 +
 debian/node-base64-js.debhelper.log           |  19 +++
 debian/node-base64-js.substvars               |   2 +
 debian/node-base64-js/DEBIAN/control          |  13 ++
 debian/node-base64-js/DEBIAN/md5sums          |   8 ++
 .../usr/lib/nodejs/base64-js/index.js         | 114 ++++++++++++++++++
 .../usr/lib/nodejs/base64-js/package.json     |  37 ++++++
 .../usr/lib/nodejs/base64-js/test/big-data.js |  24 ++++
 .../usr/lib/nodejs/base64-js/test/convert.js  |  48 ++++++++
 .../usr/lib/nodejs/base64-js/test/url-safe.js |  18 +++
 .../usr/share/doc/node-base64-js/README.md    |  32 +++++
 .../doc/node-base64-js/changelog.Debian.gz    | Bin 0 -> 184 bytes
 .../usr/share/doc/node-base64-js/copyright    |  36 ++++++
 debian/rules                                  |   1 -
 16 files changed, 356 insertions(+), 1 deletion(-)
 create mode 100644 debian/debhelper-build-stamp
 create mode 100644 debian/files
 create mode 100644 debian/node-base64-js.debhelper.log
 create mode 100644 debian/node-base64-js.substvars
 create mode 100644 debian/node-base64-js/DEBIAN/control
 create mode 100644 debian/node-base64-js/DEBIAN/md5sums
 create mode 100644 debian/node-base64-js/usr/lib/nodejs/base64-js/index.js
 create mode 100644 debian/node-base64-js/usr/lib/nodejs/base64-js/package.json
 create mode 100644 debian/node-base64-js/usr/lib/nodejs/base64-js/test/big-data.js
 create mode 100644 debian/node-base64-js/usr/lib/nodejs/base64-js/test/convert.js
 create mode 100644 debian/node-base64-js/usr/lib/nodejs/base64-js/test/url-safe.js
 create mode 100644 debian/node-base64-js/usr/share/doc/node-base64-js/README.md
 create mode 100644 debian/node-base64-js/usr/share/doc/node-base64-js/changelog.Debian.gz
 create mode 100644 debian/node-base64-js/usr/share/doc/node-base64-js/copyright

diff --git a/debian/control b/debian/control
index 4b25dea..0b016c0 100644
--- a/debian/control
+++ b/debian/control
@@ -7,6 +7,8 @@ Build-Depends:
  debhelper (>= 9)
  , dh-buildinfo
  , nodejs
+ , node-browserify-lite
+ , node-uglify
 Standards-Version: 3.9.8
 Homepage: https://github.com/beatgammit/base64-js
 Vcs-Git: https://anonscm.debian.org/git/pkg-javascript/node-base64-js.git
diff --git a/debian/debhelper-build-stamp b/debian/debhelper-build-stamp
new file mode 100644
index 0000000..6a68678
--- /dev/null
+++ b/debian/debhelper-build-stamp
@@ -0,0 +1 @@
+node-base64-js
diff --git a/debian/files b/debian/files
new file mode 100644
index 0000000..1e629b7
--- /dev/null
+++ b/debian/files
@@ -0,0 +1,2 @@
+node-base64-js_1.2.0+dfsg-1_all.deb web optional
+node-base64-js_1.2.0+dfsg-1_amd64.buildinfo web optional
diff --git a/debian/node-base64-js.debhelper.log b/debian/node-base64-js.debhelper.log
new file mode 100644
index 0000000..73fb7fd
--- /dev/null
+++ b/debian/node-base64-js.debhelper.log
@@ -0,0 +1,19 @@
+dh_update_autotools_config
+dh_auto_configure
+dh_auto_build
+dh_auto_test
+dh_prep
+dh_auto_install
+dh_install
+dh_installdocs
+dh_installchangelogs
+dh_perl
+dh_link
+dh_strip_nondeterminism
+dh_compress
+dh_fixperms
+dh_installdeb
+dh_gencontrol
+dh_md5sums
+dh_builddeb
+dh_builddeb
diff --git a/debian/node-base64-js.substvars b/debian/node-base64-js.substvars
new file mode 100644
index 0000000..978fc8b
--- /dev/null
+++ b/debian/node-base64-js.substvars
@@ -0,0 +1,2 @@
+misc:Depends=
+misc:Pre-Depends=
diff --git a/debian/node-base64-js/DEBIAN/control b/debian/node-base64-js/DEBIAN/control
new file mode 100644
index 0000000..93106f1
--- /dev/null
+++ b/debian/node-base64-js/DEBIAN/control
@@ -0,0 +1,13 @@
+Package: node-base64-js
+Version: 1.2.0+dfsg-1
+Architecture: all
+Maintainer: Debian Javascript Maintainers <pkg-javascript-devel@lists.alioth.debian.org>
+Installed-Size: 23
+Depends: nodejs
+Section: web
+Priority: optional
+Homepage: https://github.com/beatgammit/base64-js
+Description: Base64 encoding/decoding in pure JS
+ Converts a byte array into base64 string and vice versa.
+ .
+ Node.js is an event-based server-side JavaScript engine.
diff --git a/debian/node-base64-js/DEBIAN/md5sums b/debian/node-base64-js/DEBIAN/md5sums
new file mode 100644
index 0000000..07ed0e4
--- /dev/null
+++ b/debian/node-base64-js/DEBIAN/md5sums
@@ -0,0 +1,8 @@
+6ac57d0f47e5b192af40d84a342360e6  usr/lib/nodejs/base64-js/index.js
+3bbccfa79ddc9d4f979e0cedab719fb1  usr/lib/nodejs/base64-js/package.json
+b67b61be87add195972574cad069d1e4  usr/lib/nodejs/base64-js/test/big-data.js
+27cd3d7774bb2a20117e59d2d2dd49f8  usr/lib/nodejs/base64-js/test/convert.js
+40801ea421243ba376db105c725d39b7  usr/lib/nodejs/base64-js/test/url-safe.js
+66315e9a00cdae3ae0327c3fbcf9bd78  usr/share/doc/node-base64-js/README.md
+161e9b71d75b97a1a1bd0961e7f55083  usr/share/doc/node-base64-js/changelog.Debian.gz
+917888027a96367eabca2ebf42a27177  usr/share/doc/node-base64-js/copyright
diff --git a/debian/node-base64-js/usr/lib/nodejs/base64-js/index.js b/debian/node-base64-js/usr/lib/nodejs/base64-js/index.js
new file mode 100644
index 0000000..8e806ac
--- /dev/null
+++ b/debian/node-base64-js/usr/lib/nodejs/base64-js/index.js
@@ -0,0 +1,114 @@
+'use strict'
+
+exports.byteLength = byteLength
+exports.toByteArray = toByteArray
+exports.fromByteArray = fromByteArray
+
+var lookup = []
+var revLookup = []
+var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
+
+var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
+for (var i = 0, len = code.length; i < len; ++i) {
+  lookup[i] = code[i]
+  revLookup[code.charCodeAt(i)] = i
+}
+
+revLookup['-'.charCodeAt(0)] = 62
+revLookup['_'.charCodeAt(0)] = 63
+
+function placeHoldersCount (b64) {
+  var len = b64.length
+  if (len % 4 > 0) {
+    throw new Error('Invalid string. Length must be a multiple of 4')
+  }
+
+  // the number of equal signs (place holders)
+  // if there are two placeholders, than the two characters before it
+  // represent one byte
+  // if there is only one, then the three characters before it represent 2 bytes
+  // this is just a cheap hack to not do indexOf twice
+  return b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0
+}
+
+function byteLength (b64) {
+  // base64 is 4/3 + up to two characters of the original data
+  return b64.length * 3 / 4 - placeHoldersCount(b64)
+}
+
+function toByteArray (b64) {
+  var i, j, l, tmp, placeHolders, arr
+  var len = b64.length
+  placeHolders = placeHoldersCount(b64)
+
+  arr = new Arr(len * 3 / 4 - placeHolders)
+
+  // if there are placeholders, only get up to the last complete 4 chars
+  l = placeHolders > 0 ? len - 4 : len
+
+  var L = 0
+
+  for (i = 0, j = 0; i < l; i += 4, j += 3) {
+    tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)]
+    arr[L++] = (tmp >> 16) & 0xFF
+    arr[L++] = (tmp >> 8) & 0xFF
+    arr[L++] = tmp & 0xFF
+  }
+
+  if (placeHolders === 2) {
+    tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4)
+    arr[L++] = tmp & 0xFF
+  } else if (placeHolders === 1) {
+    tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2)
+    arr[L++] = (tmp >> 8) & 0xFF
+    arr[L++] = tmp & 0xFF
+  }
+
+  return arr
+}
+
+function tripletToBase64 (num) {
+  return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]
+}
+
+function encodeChunk (uint8, start, end) {
+  var tmp
+  var output = []
+  for (var i = start; i < end; i += 3) {
+    tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])
+    output.push(tripletToBase64(tmp))
+  }
+  return output.join('')
+}
+
+function fromByteArray (uint8) {
+  var tmp
+  var len = uint8.length
+  var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
+  var output = ''
+  var parts = []
+  var maxChunkLength = 16383 // must be multiple of 3
+
+  // go through the array every three bytes, we'll deal with trailing stuff later
+  for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
+    parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
+  }
+
+  // pad the end with zeros, but make sure to not forget the extra bytes
+  if (extraBytes === 1) {
+    tmp = uint8[len - 1]
+    output += lookup[tmp >> 2]
+    output += lookup[(tmp << 4) & 0x3F]
+    output += '=='
+  } else if (extraBytes === 2) {
+    tmp = (uint8[len - 2] << 8) + (uint8[len - 1])
+    output += lookup[tmp >> 10]
+    output += lookup[(tmp >> 4) & 0x3F]
+    output += lookup[(tmp << 2) & 0x3F]
+    output += '='
+  }
+
+  parts.push(output)
+
+  return parts.join('')
+}
diff --git a/debian/node-base64-js/usr/lib/nodejs/base64-js/package.json b/debian/node-base64-js/usr/lib/nodejs/base64-js/package.json
new file mode 100644
index 0000000..bf015d8
--- /dev/null
+++ b/debian/node-base64-js/usr/lib/nodejs/base64-js/package.json
@@ -0,0 +1,37 @@
+{
+  "name": "base64-js",
+  "version": "1.2.0",
+  "description": "Base64 encoding/decoding in pure JS",
+  "keywords": [
+    "base64"
+  ],
+  "homepage": "https://github.com/beatgammit/base64-js",
+  "bugs": {
+    "url": "https://github.com/beatgammit/base64-js/issues"
+  },
+  "license": "MIT",
+  "author": "T. Jameson Little <t.jameson.little@gmail.com>",
+  "files": [
+    "test",
+    "index.js",
+    "base64js.min.js"
+  ],
+  "main": "index.js",
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/beatgammit/base64-js.git"
+  },
+  "scripts": {
+    "build": "browserify -s base64js -r ./ | uglifyjs -m > base64js.min.js",
+    "lint": "standard",
+    "test": "npm run lint && npm run unit",
+    "unit": "tape test/*.js"
+  },
+  "devDependencies": {
+    "benchmark": "^2.1.0",
+    "browserify": "^13.0.0",
+    "standard": "*",
+    "tape": "4.x",
+    "uglify-js": "^2.6.2"
+  }
+}
diff --git a/debian/node-base64-js/usr/lib/nodejs/base64-js/test/big-data.js b/debian/node-base64-js/usr/lib/nodejs/base64-js/test/big-data.js
new file mode 100644
index 0000000..be16ebe
--- /dev/null
+++ b/debian/node-base64-js/usr/lib/nodejs/base64-js/test/big-data.js
@@ -0,0 +1,24 @@
+var test = require('tape')
+var b64 = require('../')
+
+test('convert big data to base64', function (t) {
+  var b64str, arr, i, length
+  var big = new Uint8Array(64 * 1024 * 1024)
+  for (i = 0, length = big.length; i < length; ++i) {
+    big[i] = i % 256
+  }
+  b64str = b64.fromByteArray(big)
+  arr = b64.toByteArray(b64str)
+  t.ok(equal(arr, big))
+  t.end()
+})
+
+function equal (a, b) {
+  var i
+  var length = a.length
+  if (length !== b.length) return false
+  for (i = 0; i < length; ++i) {
+    if (a[i] !== b[i]) return false
+  }
+  return true
+}
diff --git a/debian/node-base64-js/usr/lib/nodejs/base64-js/test/convert.js b/debian/node-base64-js/usr/lib/nodejs/base64-js/test/convert.js
new file mode 100644
index 0000000..d68e105
--- /dev/null
+++ b/debian/node-base64-js/usr/lib/nodejs/base64-js/test/convert.js
@@ -0,0 +1,48 @@
+var test = require('tape')
+var b64 = require('../')
+var checks = [
+  'a',
+  'aa',
+  'aaa',
+  'hi',
+  'hi!',
+  'hi!!',
+  'sup',
+  'sup?',
+  'sup?!'
+]
+
+test('convert to base64 and back', function (t) {
+  t.plan(checks.length * 2)
+
+  for (var i = 0; i < checks.length; i++) {
+    var check = checks[i]
+    var b64Str, arr, str
+
+    b64Str = b64.fromByteArray(map(check, function (char) { return char.charCodeAt(0) }))
+
+    arr = b64.toByteArray(b64Str)
+    str = map(arr, function (byte) { return String.fromCharCode(byte) }).join('')
+
+    t.equal(check, str, 'Checked ' + check)
+    t.equal(b64.byteLength(b64Str), arr.length, 'Checked length for ' + check)
+  }
+})
+
+function map (arr, callback) {
+  var res = []
+  var kValue, mappedValue
+
+  for (var k = 0, len = arr.length; k < len; k++) {
+    if ((typeof arr === 'string' && !!arr.charAt(k))) {
+      kValue = arr.charAt(k)
+      mappedValue = callback(kValue, k, arr)
+      res[k] = mappedValue
+    } else if (typeof arr !== 'string' && k in arr) {
+      kValue = arr[k]
+      mappedValue = callback(kValue, k, arr)
+      res[k] = mappedValue
+    }
+  }
+  return res
+}
diff --git a/debian/node-base64-js/usr/lib/nodejs/base64-js/test/url-safe.js b/debian/node-base64-js/usr/lib/nodejs/base64-js/test/url-safe.js
new file mode 100644
index 0000000..3203b33
--- /dev/null
+++ b/debian/node-base64-js/usr/lib/nodejs/base64-js/test/url-safe.js
@@ -0,0 +1,18 @@
+var test = require('tape')
+var b64 = require('../')
+
+test('decode url-safe style base64 strings', function (t) {
+  var expected = [0xff, 0xff, 0xbe, 0xff, 0xef, 0xbf, 0xfb, 0xef, 0xff]
+
+  var actual = b64.toByteArray('//++/++/++//')
+  for (var i = 0; i < actual.length; i++) {
+    t.equal(actual[i], expected[i])
+  }
+
+  actual = b64.toByteArray('__--_--_--__')
+  for (i = 0; i < actual.length; i++) {
+    t.equal(actual[i], expected[i])
+  }
+
+  t.end()
+})
diff --git a/debian/node-base64-js/usr/share/doc/node-base64-js/README.md b/debian/node-base64-js/usr/share/doc/node-base64-js/README.md
new file mode 100644
index 0000000..e546d86
--- /dev/null
+++ b/debian/node-base64-js/usr/share/doc/node-base64-js/README.md
@@ -0,0 +1,32 @@
+base64-js
+=========
+
+`base64-js` does basic base64 encoding/decoding in pure JS.
+
+[![build status](https://secure.travis-ci.org/beatgammit/base64-js.png)](http://travis-ci.org/beatgammit/base64-js)
+
+[![testling badge](https://ci.testling.com/beatgammit/base64-js.png)](https://ci.testling.com/beatgammit/base64-js)
+
+Many browsers already have base64 encoding/decoding functionality, but it is for text data, not all-purpose binary data.
+
+Sometimes encoding/decoding binary data in the browser is useful, and that is what this module does.
+
+## install
+
+With [npm](https://npmjs.org) do:
+
+`npm install base64-js`
+
+## methods
+
+`var base64 = require('base64-js')`
+
+`base64` has three exposed functions, `byteLength`, `toByteArray` and `fromByteArray`, which both take a single argument.
+
+* `byteLength` - Takes a base64 string and returns length of byte array
+* `toByteArray` - Takes a base64 string and returns a byte array
+* `fromByteArray` - Takes a byte array and returns a base64 string
+
+## license
+
+MIT
diff --git a/debian/node-base64-js/usr/share/doc/node-base64-js/changelog.Debian.gz b/debian/node-base64-js/usr/share/doc/node-base64-js/changelog.Debian.gz
new file mode 100644
index 0000000000000000000000000000000000000000..aafb0c82f0b1231923e9ea9b1c07e4366f22684b
GIT binary patch
literal 184
zcmV;p07w5HiwFP!0000212v303&JoMMfd)S3oceoN!0qN4+KGQanQjzHJ>q>rX^{q
z{(Fny;g07XS1Mw;3^bdvXFy*h<Ae{@J!mFk(7PgU3UalyD>Pn{yL~pcY@-Mm;OI<k
zq=hF-T>|~REdzxNy+u0d7XPdhwP>nPdy>Up?f#76Vw8GNc;GA@Vf`{r2cwok>~tZG
mO>Ske1+Jt<-~tEAG3H_pG0D<dCOC$?Bl-di%}sv80001VG)}t!

literal 0
HcmV?d00001

diff --git a/debian/node-base64-js/usr/share/doc/node-base64-js/copyright b/debian/node-base64-js/usr/share/doc/node-base64-js/copyright
new file mode 100644
index 0000000..6369f3f
--- /dev/null
+++ b/debian/node-base64-js/usr/share/doc/node-base64-js/copyright
@@ -0,0 +1,36 @@
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: base64-js
+Upstream-Contact: https://github.com/beatgammit/base64-js/issues
+Source: https://github.com/beatgammit/base64-js
+Files-Excluded: base64js.min.js
+Comment: minified source
+
+Files: *
+Copyright: T. Jameson Little <t.jameson.little@gmail.com>
+License: Expat
+
+Files: debian/*
+Copyright: 2017 Siddhesh Rane <kingsid911@gmail.com>
+License: Expat
+
+License: Expat
+ 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.
+
diff --git a/debian/rules b/debian/rules
index de57af0..c0fe46c 100755
--- a/debian/rules
+++ b/debian/rules
@@ -8,7 +8,6 @@
 	dh $@
 
 #override_dh_auto_build:
-
 #override_dh_auto_test:
 
 
-- 
GitLab