| Index: node_modules/vulcanize/node_modules/update-notifier/node_modules/configstore/node_modules/js-yaml/lib/js-yaml/type/binary.js
|
| diff --git a/node_modules/vulcanize/node_modules/update-notifier/node_modules/configstore/node_modules/js-yaml/lib/js-yaml/type/binary.js b/node_modules/vulcanize/node_modules/update-notifier/node_modules/configstore/node_modules/js-yaml/lib/js-yaml/type/binary.js
|
| index d8617feec93303a9c6280d9304a1bd522cb3827c..1fdf47deb4fd5839faa99c6fba21fe8828252483 100644
|
| --- a/node_modules/vulcanize/node_modules/update-notifier/node_modules/configstore/node_modules/js-yaml/lib/js-yaml/type/binary.js
|
| +++ b/node_modules/vulcanize/node_modules/update-notifier/node_modules/configstore/node_modules/js-yaml/lib/js-yaml/type/binary.js
|
| @@ -1,125 +1,133 @@
|
| -// Modified from:
|
| -// https://raw.github.com/kanaka/noVNC/d890e8640f20fba3215ba7be8e0ff145aeb8c17c/include/base64.js
|
| -
|
| 'use strict';
|
|
|
| +
|
| // A trick for browserified version.
|
| // Since we make browserifier to ignore `buffer` module, NodeBuffer will be undefined
|
| var NodeBuffer = require('buffer').Buffer;
|
| -
|
| var Type = require('../type');
|
|
|
|
|
| +// [ 64, 65, 66 ] -> [ padding, CR, LF ]
|
| +var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r';
|
|
|
| -var BASE64_PADDING = '=';
|
|
|
| -var BASE64_BINTABLE = [
|
| - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
| - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
| - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63,
|
| - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, 0, -1, -1,
|
| - -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
|
| - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1,
|
| - -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
|
| - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1
|
| -];
|
| +function resolveYamlBinary(data) {
|
| + if (null === data) {
|
| + return false;
|
| + }
|
|
|
| -var BASE64_CHARTABLE =
|
| - 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');
|
| + var code, idx, bitlen = 0, len = 0, max = data.length, map = BASE64_MAP;
|
|
|
| + // Convert one by one.
|
| + for (idx = 0; idx < max; idx ++) {
|
| + code = map.indexOf(data.charAt(idx));
|
|
|
| -function resolveYamlBinary(state) {
|
| - var value, code, idx = 0, result = [], leftbits, leftdata,
|
| - object = state.result;
|
| + // Skip CR/LF
|
| + if (code > 64) { continue; }
|
|
|
| - leftbits = 0; // number of bits decoded, but yet to be appended
|
| - leftdata = 0; // bits decoded, but yet to be appended
|
| + // Fail on illegal characters
|
| + if (code < 0) { return false; }
|
|
|
| - // Convert one by one.
|
| - for (idx = 0; idx < object.length; idx += 1) {
|
| - code = object.charCodeAt(idx);
|
| - value = BASE64_BINTABLE[code & 0x7F];
|
| -
|
| - // Skip LF(NL) || CR
|
| - if (0x0A !== code && 0x0D !== code) {
|
| - // Fail on illegal characters
|
| - if (-1 === value) {
|
| - return false;
|
| - }
|
| -
|
| - // Collect data into leftdata, update bitcount
|
| - leftdata = (leftdata << 6) | value;
|
| - leftbits += 6;
|
| -
|
| - // If we have 8 or more bits, append 8 bits to the result
|
| - if (leftbits >= 8) {
|
| - leftbits -= 8;
|
| -
|
| - // Append if not padding.
|
| - if (BASE64_PADDING !== object.charAt(idx)) {
|
| - result.push((leftdata >> leftbits) & 0xFF);
|
| - }
|
| -
|
| - leftdata &= (1 << leftbits) - 1;
|
| - }
|
| - }
|
| + bitlen += 6;
|
| }
|
|
|
| - // If there are any bits left, the base64 string was corrupted
|
| - if (leftbits) {
|
| - return false;
|
| - } else {
|
| - // Wrap into Buffer for NodeJS and leave Array for browser
|
| - if (NodeBuffer) {
|
| - state.result = new NodeBuffer(result);
|
| - } else {
|
| - state.result = result;
|
| + // If there are any bits left, source was corrupted
|
| + return (bitlen % 8) === 0;
|
| +}
|
| +
|
| +function constructYamlBinary(data) {
|
| + var code, idx, tailbits,
|
| + input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan
|
| + max = input.length,
|
| + map = BASE64_MAP,
|
| + bits = 0,
|
| + result = [];
|
| +
|
| + // Collect by 6*4 bits (3 bytes)
|
| +
|
| + for (idx = 0; idx < max; idx++) {
|
| + if ((idx % 4 === 0) && idx) {
|
| + result.push((bits >> 16) & 0xFF);
|
| + result.push((bits >> 8) & 0xFF);
|
| + result.push(bits & 0xFF);
|
| }
|
| - return true;
|
| +
|
| + bits = (bits << 6) | map.indexOf(input.charAt(idx));
|
| }
|
| -}
|
|
|
| + // Dump tail
|
|
|
| -function representYamlBinary(object /*, style*/) {
|
| - var result = '', index, length, rest;
|
| + tailbits = (max % 4)*6;
|
|
|
| - // Convert every three bytes to 4 ASCII characters.
|
| - for (index = 0, length = object.length - 2; index < length; index += 3) {
|
| - result += BASE64_CHARTABLE[object[index + 0] >> 2];
|
| - result += BASE64_CHARTABLE[((object[index + 0] & 0x03) << 4) + (object[index + 1] >> 4)];
|
| - result += BASE64_CHARTABLE[((object[index + 1] & 0x0F) << 2) + (object[index + 2] >> 6)];
|
| - result += BASE64_CHARTABLE[object[index + 2] & 0x3F];
|
| + if (tailbits === 0) {
|
| + result.push((bits >> 16) & 0xFF);
|
| + result.push((bits >> 8) & 0xFF);
|
| + result.push(bits & 0xFF);
|
| + } else if (tailbits === 18) {
|
| + result.push((bits >> 10) & 0xFF);
|
| + result.push((bits >> 2) & 0xFF);
|
| + } else if (tailbits === 12) {
|
| + result.push((bits >> 4) & 0xFF);
|
| }
|
|
|
| - rest = object.length % 3;
|
| + // Wrap into Buffer for NodeJS and leave Array for browser
|
| + if (NodeBuffer) {
|
| + return new NodeBuffer(result);
|
| + }
|
|
|
| - // Convert the remaining 1 or 2 bytes, padding out to 4 characters.
|
| - if (0 !== rest) {
|
| - index = object.length - rest;
|
| - result += BASE64_CHARTABLE[object[index + 0] >> 2];
|
| + return result;
|
| +}
|
|
|
| - if (2 === rest) {
|
| - result += BASE64_CHARTABLE[((object[index + 0] & 0x03) << 4) + (object[index + 1] >> 4)];
|
| - result += BASE64_CHARTABLE[(object[index + 1] & 0x0F) << 2];
|
| - result += BASE64_PADDING;
|
| - } else {
|
| - result += BASE64_CHARTABLE[(object[index + 0] & 0x03) << 4];
|
| - result += BASE64_PADDING + BASE64_PADDING;
|
| +function representYamlBinary(object /*, style*/) {
|
| + var result = '', bits = 0, idx, tail,
|
| + max = object.length,
|
| + map = BASE64_MAP;
|
| +
|
| + // Convert every three bytes to 4 ASCII characters.
|
| +
|
| + for (idx = 0; idx < max; idx++) {
|
| + if ((idx % 3 === 0) && idx) {
|
| + result += map[(bits >> 18) & 0x3F];
|
| + result += map[(bits >> 12) & 0x3F];
|
| + result += map[(bits >> 6) & 0x3F];
|
| + result += map[bits & 0x3F];
|
| }
|
| +
|
| + bits = (bits << 8) + object[idx];
|
| + }
|
| +
|
| + // Dump tail
|
| +
|
| + tail = max % 3;
|
| +
|
| + if (tail === 0) {
|
| + result += map[(bits >> 18) & 0x3F];
|
| + result += map[(bits >> 12) & 0x3F];
|
| + result += map[(bits >> 6) & 0x3F];
|
| + result += map[bits & 0x3F];
|
| + } else if (tail === 2) {
|
| + result += map[(bits >> 10) & 0x3F];
|
| + result += map[(bits >> 4) & 0x3F];
|
| + result += map[(bits << 2) & 0x3F];
|
| + result += map[64];
|
| + } else if (tail === 1) {
|
| + result += map[(bits >> 2) & 0x3F];
|
| + result += map[(bits << 4) & 0x3F];
|
| + result += map[64];
|
| + result += map[64];
|
| }
|
|
|
| return result;
|
| }
|
|
|
| -
|
| function isBinary(object) {
|
| return NodeBuffer && NodeBuffer.isBuffer(object);
|
| }
|
|
|
| -
|
| module.exports = new Type('tag:yaml.org,2002:binary', {
|
| - loadKind: 'scalar',
|
| - loadResolver: resolveYamlBinary,
|
| - dumpPredicate: isBinary,
|
| - dumpRepresenter: representYamlBinary
|
| + kind: 'scalar',
|
| + resolve: resolveYamlBinary,
|
| + construct: constructYamlBinary,
|
| + predicate: isBinary,
|
| + represent: representYamlBinary
|
| });
|
|
|