new license file version [CI SKIP]
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
var from = require('from')
|
||||
var through = require('../')
|
||||
|
||||
var tape = require('tape')
|
||||
|
||||
tape('simple async example', function (t) {
|
||||
|
||||
var n = 0, expected = [1,2,3,4,5], actual = []
|
||||
from(expected)
|
||||
.pipe(through(function(data) {
|
||||
this.pause()
|
||||
n ++
|
||||
setTimeout(function(){
|
||||
console.log('pushing data', data)
|
||||
this.push(data)
|
||||
this.resume()
|
||||
}.bind(this), 300)
|
||||
})).pipe(through(function(data) {
|
||||
console.log('pushing data second time', data);
|
||||
this.push(data)
|
||||
})).on('data', function (d) {
|
||||
actual.push(d)
|
||||
}).on('end', function() {
|
||||
t.deepEqual(actual, expected)
|
||||
t.end()
|
||||
})
|
||||
|
||||
})
|
||||
@@ -0,0 +1,406 @@
|
||||
/* eslint-disable node/no-deprecated-api */
|
||||
|
||||
'use strict'
|
||||
|
||||
var test = require('tape')
|
||||
|
||||
var buffer = require('buffer')
|
||||
|
||||
var index = require('./')
|
||||
var safer = require('./safer')
|
||||
var dangerous = require('./dangerous')
|
||||
|
||||
/* Inheritance tests */
|
||||
|
||||
test('Default is Safer', function (t) {
|
||||
t.equal(index, safer)
|
||||
t.notEqual(safer, dangerous)
|
||||
t.notEqual(index, dangerous)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('Is not a function', function (t) {
|
||||
[index, safer, dangerous].forEach(function (impl) {
|
||||
t.equal(typeof impl, 'object')
|
||||
t.equal(typeof impl.Buffer, 'object')
|
||||
});
|
||||
[buffer].forEach(function (impl) {
|
||||
t.equal(typeof impl, 'object')
|
||||
t.equal(typeof impl.Buffer, 'function')
|
||||
})
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('Constructor throws', function (t) {
|
||||
[index, safer, dangerous].forEach(function (impl) {
|
||||
t.throws(function () { impl.Buffer() })
|
||||
t.throws(function () { impl.Buffer(0) })
|
||||
t.throws(function () { impl.Buffer('a') })
|
||||
t.throws(function () { impl.Buffer('a', 'utf-8') })
|
||||
t.throws(function () { return new impl.Buffer() })
|
||||
t.throws(function () { return new impl.Buffer(0) })
|
||||
t.throws(function () { return new impl.Buffer('a') })
|
||||
t.throws(function () { return new impl.Buffer('a', 'utf-8') })
|
||||
})
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('Safe methods exist', function (t) {
|
||||
[index, safer, dangerous].forEach(function (impl) {
|
||||
t.equal(typeof impl.Buffer.alloc, 'function', 'alloc')
|
||||
t.equal(typeof impl.Buffer.from, 'function', 'from')
|
||||
})
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('Unsafe methods exist only in Dangerous', function (t) {
|
||||
[index, safer].forEach(function (impl) {
|
||||
t.equal(typeof impl.Buffer.allocUnsafe, 'undefined')
|
||||
t.equal(typeof impl.Buffer.allocUnsafeSlow, 'undefined')
|
||||
});
|
||||
[dangerous].forEach(function (impl) {
|
||||
t.equal(typeof impl.Buffer.allocUnsafe, 'function')
|
||||
t.equal(typeof impl.Buffer.allocUnsafeSlow, 'function')
|
||||
})
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('Generic methods/properties are defined and equal', function (t) {
|
||||
['poolSize', 'isBuffer', 'concat', 'byteLength'].forEach(function (method) {
|
||||
[index, safer, dangerous].forEach(function (impl) {
|
||||
t.equal(impl.Buffer[method], buffer.Buffer[method], method)
|
||||
t.notEqual(typeof impl.Buffer[method], 'undefined', method)
|
||||
})
|
||||
})
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('Built-in buffer static methods/properties are inherited', function (t) {
|
||||
Object.keys(buffer).forEach(function (method) {
|
||||
if (method === 'SlowBuffer' || method === 'Buffer') return;
|
||||
[index, safer, dangerous].forEach(function (impl) {
|
||||
t.equal(impl[method], buffer[method], method)
|
||||
t.notEqual(typeof impl[method], 'undefined', method)
|
||||
})
|
||||
})
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('Built-in Buffer static methods/properties are inherited', function (t) {
|
||||
Object.keys(buffer.Buffer).forEach(function (method) {
|
||||
if (method === 'allocUnsafe' || method === 'allocUnsafeSlow') return;
|
||||
[index, safer, dangerous].forEach(function (impl) {
|
||||
t.equal(impl.Buffer[method], buffer.Buffer[method], method)
|
||||
t.notEqual(typeof impl.Buffer[method], 'undefined', method)
|
||||
})
|
||||
})
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('.prototype property of Buffer is inherited', function (t) {
|
||||
[index, safer, dangerous].forEach(function (impl) {
|
||||
t.equal(impl.Buffer.prototype, buffer.Buffer.prototype, 'prototype')
|
||||
t.notEqual(typeof impl.Buffer.prototype, 'undefined', 'prototype')
|
||||
})
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('All Safer methods are present in Dangerous', function (t) {
|
||||
Object.keys(safer).forEach(function (method) {
|
||||
if (method === 'Buffer') return;
|
||||
[index, safer, dangerous].forEach(function (impl) {
|
||||
t.equal(impl[method], safer[method], method)
|
||||
if (method !== 'kStringMaxLength') {
|
||||
t.notEqual(typeof impl[method], 'undefined', method)
|
||||
}
|
||||
})
|
||||
})
|
||||
Object.keys(safer.Buffer).forEach(function (method) {
|
||||
[index, safer, dangerous].forEach(function (impl) {
|
||||
t.equal(impl.Buffer[method], safer.Buffer[method], method)
|
||||
t.notEqual(typeof impl.Buffer[method], 'undefined', method)
|
||||
})
|
||||
})
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('Safe methods from Dangerous methods are present in Safer', function (t) {
|
||||
Object.keys(dangerous).forEach(function (method) {
|
||||
if (method === 'Buffer') return;
|
||||
[index, safer, dangerous].forEach(function (impl) {
|
||||
t.equal(impl[method], dangerous[method], method)
|
||||
if (method !== 'kStringMaxLength') {
|
||||
t.notEqual(typeof impl[method], 'undefined', method)
|
||||
}
|
||||
})
|
||||
})
|
||||
Object.keys(dangerous.Buffer).forEach(function (method) {
|
||||
if (method === 'allocUnsafe' || method === 'allocUnsafeSlow') return;
|
||||
[index, safer, dangerous].forEach(function (impl) {
|
||||
t.equal(impl.Buffer[method], dangerous.Buffer[method], method)
|
||||
t.notEqual(typeof impl.Buffer[method], 'undefined', method)
|
||||
})
|
||||
})
|
||||
t.end()
|
||||
})
|
||||
|
||||
/* Behaviour tests */
|
||||
|
||||
test('Methods return Buffers', function (t) {
|
||||
[index, safer, dangerous].forEach(function (impl) {
|
||||
t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(0)))
|
||||
t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(0, 10)))
|
||||
t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(0, 'a')))
|
||||
t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(10)))
|
||||
t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(10, 'x')))
|
||||
t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(9, 'ab')))
|
||||
t.ok(buffer.Buffer.isBuffer(impl.Buffer.from('')))
|
||||
t.ok(buffer.Buffer.isBuffer(impl.Buffer.from('string')))
|
||||
t.ok(buffer.Buffer.isBuffer(impl.Buffer.from('string', 'utf-8')))
|
||||
t.ok(buffer.Buffer.isBuffer(impl.Buffer.from('b25ldHdvdGhyZWU=', 'base64')))
|
||||
t.ok(buffer.Buffer.isBuffer(impl.Buffer.from([0, 42, 3])))
|
||||
t.ok(buffer.Buffer.isBuffer(impl.Buffer.from(new Uint8Array([0, 42, 3]))))
|
||||
t.ok(buffer.Buffer.isBuffer(impl.Buffer.from([])))
|
||||
});
|
||||
['allocUnsafe', 'allocUnsafeSlow'].forEach(function (method) {
|
||||
t.ok(buffer.Buffer.isBuffer(dangerous.Buffer[method](0)))
|
||||
t.ok(buffer.Buffer.isBuffer(dangerous.Buffer[method](10)))
|
||||
})
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('Constructor is buffer.Buffer', function (t) {
|
||||
[index, safer, dangerous].forEach(function (impl) {
|
||||
t.equal(impl.Buffer.alloc(0).constructor, buffer.Buffer)
|
||||
t.equal(impl.Buffer.alloc(0, 10).constructor, buffer.Buffer)
|
||||
t.equal(impl.Buffer.alloc(0, 'a').constructor, buffer.Buffer)
|
||||
t.equal(impl.Buffer.alloc(10).constructor, buffer.Buffer)
|
||||
t.equal(impl.Buffer.alloc(10, 'x').constructor, buffer.Buffer)
|
||||
t.equal(impl.Buffer.alloc(9, 'ab').constructor, buffer.Buffer)
|
||||
t.equal(impl.Buffer.from('').constructor, buffer.Buffer)
|
||||
t.equal(impl.Buffer.from('string').constructor, buffer.Buffer)
|
||||
t.equal(impl.Buffer.from('string', 'utf-8').constructor, buffer.Buffer)
|
||||
t.equal(impl.Buffer.from('b25ldHdvdGhyZWU=', 'base64').constructor, buffer.Buffer)
|
||||
t.equal(impl.Buffer.from([0, 42, 3]).constructor, buffer.Buffer)
|
||||
t.equal(impl.Buffer.from(new Uint8Array([0, 42, 3])).constructor, buffer.Buffer)
|
||||
t.equal(impl.Buffer.from([]).constructor, buffer.Buffer)
|
||||
});
|
||||
[0, 10, 100].forEach(function (arg) {
|
||||
t.equal(dangerous.Buffer.allocUnsafe(arg).constructor, buffer.Buffer)
|
||||
t.equal(dangerous.Buffer.allocUnsafeSlow(arg).constructor, buffer.SlowBuffer(0).constructor)
|
||||
})
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('Invalid calls throw', function (t) {
|
||||
[index, safer, dangerous].forEach(function (impl) {
|
||||
t.throws(function () { impl.Buffer.from(0) })
|
||||
t.throws(function () { impl.Buffer.from(10) })
|
||||
t.throws(function () { impl.Buffer.from(10, 'utf-8') })
|
||||
t.throws(function () { impl.Buffer.from('string', 'invalid encoding') })
|
||||
t.throws(function () { impl.Buffer.from(-10) })
|
||||
t.throws(function () { impl.Buffer.from(1e90) })
|
||||
t.throws(function () { impl.Buffer.from(Infinity) })
|
||||
t.throws(function () { impl.Buffer.from(-Infinity) })
|
||||
t.throws(function () { impl.Buffer.from(NaN) })
|
||||
t.throws(function () { impl.Buffer.from(null) })
|
||||
t.throws(function () { impl.Buffer.from(undefined) })
|
||||
t.throws(function () { impl.Buffer.from() })
|
||||
t.throws(function () { impl.Buffer.from({}) })
|
||||
t.throws(function () { impl.Buffer.alloc('') })
|
||||
t.throws(function () { impl.Buffer.alloc('string') })
|
||||
t.throws(function () { impl.Buffer.alloc('string', 'utf-8') })
|
||||
t.throws(function () { impl.Buffer.alloc('b25ldHdvdGhyZWU=', 'base64') })
|
||||
t.throws(function () { impl.Buffer.alloc(-10) })
|
||||
t.throws(function () { impl.Buffer.alloc(1e90) })
|
||||
t.throws(function () { impl.Buffer.alloc(2 * (1 << 30)) })
|
||||
t.throws(function () { impl.Buffer.alloc(Infinity) })
|
||||
t.throws(function () { impl.Buffer.alloc(-Infinity) })
|
||||
t.throws(function () { impl.Buffer.alloc(null) })
|
||||
t.throws(function () { impl.Buffer.alloc(undefined) })
|
||||
t.throws(function () { impl.Buffer.alloc() })
|
||||
t.throws(function () { impl.Buffer.alloc([]) })
|
||||
t.throws(function () { impl.Buffer.alloc([0, 42, 3]) })
|
||||
t.throws(function () { impl.Buffer.alloc({}) })
|
||||
});
|
||||
['allocUnsafe', 'allocUnsafeSlow'].forEach(function (method) {
|
||||
t.throws(function () { dangerous.Buffer[method]('') })
|
||||
t.throws(function () { dangerous.Buffer[method]('string') })
|
||||
t.throws(function () { dangerous.Buffer[method]('string', 'utf-8') })
|
||||
t.throws(function () { dangerous.Buffer[method](2 * (1 << 30)) })
|
||||
t.throws(function () { dangerous.Buffer[method](Infinity) })
|
||||
if (dangerous.Buffer[method] === buffer.Buffer.allocUnsafe) {
|
||||
t.skip('Skipping, older impl of allocUnsafe coerced negative sizes to 0')
|
||||
} else {
|
||||
t.throws(function () { dangerous.Buffer[method](-10) })
|
||||
t.throws(function () { dangerous.Buffer[method](-1e90) })
|
||||
t.throws(function () { dangerous.Buffer[method](-Infinity) })
|
||||
}
|
||||
t.throws(function () { dangerous.Buffer[method](null) })
|
||||
t.throws(function () { dangerous.Buffer[method](undefined) })
|
||||
t.throws(function () { dangerous.Buffer[method]() })
|
||||
t.throws(function () { dangerous.Buffer[method]([]) })
|
||||
t.throws(function () { dangerous.Buffer[method]([0, 42, 3]) })
|
||||
t.throws(function () { dangerous.Buffer[method]({}) })
|
||||
})
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('Buffers have appropriate lengths', function (t) {
|
||||
[index, safer, dangerous].forEach(function (impl) {
|
||||
t.equal(impl.Buffer.alloc(0).length, 0)
|
||||
t.equal(impl.Buffer.alloc(10).length, 10)
|
||||
t.equal(impl.Buffer.from('').length, 0)
|
||||
t.equal(impl.Buffer.from('string').length, 6)
|
||||
t.equal(impl.Buffer.from('string', 'utf-8').length, 6)
|
||||
t.equal(impl.Buffer.from('b25ldHdvdGhyZWU=', 'base64').length, 11)
|
||||
t.equal(impl.Buffer.from([0, 42, 3]).length, 3)
|
||||
t.equal(impl.Buffer.from(new Uint8Array([0, 42, 3])).length, 3)
|
||||
t.equal(impl.Buffer.from([]).length, 0)
|
||||
});
|
||||
['allocUnsafe', 'allocUnsafeSlow'].forEach(function (method) {
|
||||
t.equal(dangerous.Buffer[method](0).length, 0)
|
||||
t.equal(dangerous.Buffer[method](10).length, 10)
|
||||
})
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('Buffers have appropriate lengths (2)', function (t) {
|
||||
t.equal(index.Buffer.alloc, safer.Buffer.alloc)
|
||||
t.equal(index.Buffer.alloc, dangerous.Buffer.alloc)
|
||||
var ok = true;
|
||||
[ safer.Buffer.alloc,
|
||||
dangerous.Buffer.allocUnsafe,
|
||||
dangerous.Buffer.allocUnsafeSlow
|
||||
].forEach(function (method) {
|
||||
for (var i = 0; i < 1e2; i++) {
|
||||
var length = Math.round(Math.random() * 1e5)
|
||||
var buf = method(length)
|
||||
if (!buffer.Buffer.isBuffer(buf)) ok = false
|
||||
if (buf.length !== length) ok = false
|
||||
}
|
||||
})
|
||||
t.ok(ok)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('.alloc(size) is zero-filled and has correct length', function (t) {
|
||||
t.equal(index.Buffer.alloc, safer.Buffer.alloc)
|
||||
t.equal(index.Buffer.alloc, dangerous.Buffer.alloc)
|
||||
var ok = true
|
||||
for (var i = 0; i < 1e2; i++) {
|
||||
var length = Math.round(Math.random() * 2e6)
|
||||
var buf = index.Buffer.alloc(length)
|
||||
if (!buffer.Buffer.isBuffer(buf)) ok = false
|
||||
if (buf.length !== length) ok = false
|
||||
var j
|
||||
for (j = 0; j < length; j++) {
|
||||
if (buf[j] !== 0) ok = false
|
||||
}
|
||||
buf.fill(1)
|
||||
for (j = 0; j < length; j++) {
|
||||
if (buf[j] !== 1) ok = false
|
||||
}
|
||||
}
|
||||
t.ok(ok)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('.allocUnsafe / .allocUnsafeSlow are fillable and have correct lengths', function (t) {
|
||||
['allocUnsafe', 'allocUnsafeSlow'].forEach(function (method) {
|
||||
var ok = true
|
||||
for (var i = 0; i < 1e2; i++) {
|
||||
var length = Math.round(Math.random() * 2e6)
|
||||
var buf = dangerous.Buffer[method](length)
|
||||
if (!buffer.Buffer.isBuffer(buf)) ok = false
|
||||
if (buf.length !== length) ok = false
|
||||
buf.fill(0, 0, length)
|
||||
var j
|
||||
for (j = 0; j < length; j++) {
|
||||
if (buf[j] !== 0) ok = false
|
||||
}
|
||||
buf.fill(1, 0, length)
|
||||
for (j = 0; j < length; j++) {
|
||||
if (buf[j] !== 1) ok = false
|
||||
}
|
||||
}
|
||||
t.ok(ok, method)
|
||||
})
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('.alloc(size, fill) is `fill`-filled', function (t) {
|
||||
t.equal(index.Buffer.alloc, safer.Buffer.alloc)
|
||||
t.equal(index.Buffer.alloc, dangerous.Buffer.alloc)
|
||||
var ok = true
|
||||
for (var i = 0; i < 1e2; i++) {
|
||||
var length = Math.round(Math.random() * 2e6)
|
||||
var fill = Math.round(Math.random() * 255)
|
||||
var buf = index.Buffer.alloc(length, fill)
|
||||
if (!buffer.Buffer.isBuffer(buf)) ok = false
|
||||
if (buf.length !== length) ok = false
|
||||
for (var j = 0; j < length; j++) {
|
||||
if (buf[j] !== fill) ok = false
|
||||
}
|
||||
}
|
||||
t.ok(ok)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('.alloc(size, fill) is `fill`-filled', function (t) {
|
||||
t.equal(index.Buffer.alloc, safer.Buffer.alloc)
|
||||
t.equal(index.Buffer.alloc, dangerous.Buffer.alloc)
|
||||
var ok = true
|
||||
for (var i = 0; i < 1e2; i++) {
|
||||
var length = Math.round(Math.random() * 2e6)
|
||||
var fill = Math.round(Math.random() * 255)
|
||||
var buf = index.Buffer.alloc(length, fill)
|
||||
if (!buffer.Buffer.isBuffer(buf)) ok = false
|
||||
if (buf.length !== length) ok = false
|
||||
for (var j = 0; j < length; j++) {
|
||||
if (buf[j] !== fill) ok = false
|
||||
}
|
||||
}
|
||||
t.ok(ok)
|
||||
t.deepEqual(index.Buffer.alloc(9, 'a'), index.Buffer.alloc(9, 97))
|
||||
t.notDeepEqual(index.Buffer.alloc(9, 'a'), index.Buffer.alloc(9, 98))
|
||||
|
||||
var tmp = new buffer.Buffer(2)
|
||||
tmp.fill('ok')
|
||||
if (tmp[1] === tmp[0]) {
|
||||
// Outdated Node.js
|
||||
t.deepEqual(index.Buffer.alloc(5, 'ok'), index.Buffer.from('ooooo'))
|
||||
} else {
|
||||
t.deepEqual(index.Buffer.alloc(5, 'ok'), index.Buffer.from('okoko'))
|
||||
}
|
||||
t.notDeepEqual(index.Buffer.alloc(5, 'ok'), index.Buffer.from('kokok'))
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('safer.Buffer.from returns results same as Buffer constructor', function (t) {
|
||||
[index, safer, dangerous].forEach(function (impl) {
|
||||
t.deepEqual(impl.Buffer.from(''), new buffer.Buffer(''))
|
||||
t.deepEqual(impl.Buffer.from('string'), new buffer.Buffer('string'))
|
||||
t.deepEqual(impl.Buffer.from('string', 'utf-8'), new buffer.Buffer('string', 'utf-8'))
|
||||
t.deepEqual(impl.Buffer.from('b25ldHdvdGhyZWU=', 'base64'), new buffer.Buffer('b25ldHdvdGhyZWU=', 'base64'))
|
||||
t.deepEqual(impl.Buffer.from([0, 42, 3]), new buffer.Buffer([0, 42, 3]))
|
||||
t.deepEqual(impl.Buffer.from(new Uint8Array([0, 42, 3])), new buffer.Buffer(new Uint8Array([0, 42, 3])))
|
||||
t.deepEqual(impl.Buffer.from([]), new buffer.Buffer([]))
|
||||
})
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('safer.Buffer.from returns consistent results', function (t) {
|
||||
[index, safer, dangerous].forEach(function (impl) {
|
||||
t.deepEqual(impl.Buffer.from(''), impl.Buffer.alloc(0))
|
||||
t.deepEqual(impl.Buffer.from([]), impl.Buffer.alloc(0))
|
||||
t.deepEqual(impl.Buffer.from(new Uint8Array([])), impl.Buffer.alloc(0))
|
||||
t.deepEqual(impl.Buffer.from('string', 'utf-8'), impl.Buffer.from('string'))
|
||||
t.deepEqual(impl.Buffer.from('string'), impl.Buffer.from([115, 116, 114, 105, 110, 103]))
|
||||
t.deepEqual(impl.Buffer.from('string'), impl.Buffer.from(impl.Buffer.from('string')))
|
||||
t.deepEqual(impl.Buffer.from('b25ldHdvdGhyZWU=', 'base64'), impl.Buffer.from('onetwothree'))
|
||||
t.notDeepEqual(impl.Buffer.from('b25ldHdvdGhyZWU='), impl.Buffer.from('onetwothree'))
|
||||
})
|
||||
t.end()
|
||||
})
|
||||
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-2020 Teambition
|
||||
|
||||
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.
|
||||
@@ -0,0 +1,80 @@
|
||||
var acorn = require('acorn-node');
|
||||
var walk = require('acorn-node/walk');
|
||||
var defined = require('defined');
|
||||
|
||||
var requireRe = /\brequire\b/;
|
||||
|
||||
function parse (src, opts) {
|
||||
if (!opts) opts = {};
|
||||
var acornOpts = {
|
||||
ranges: defined(opts.ranges, opts.range),
|
||||
locations: defined(opts.locations, opts.loc),
|
||||
allowReserved: defined(opts.allowReserved, true),
|
||||
allowImportExportEverywhere: defined(opts.allowImportExportEverywhere, false)
|
||||
};
|
||||
|
||||
// Use acorn-node's defaults for the rest.
|
||||
if (opts.ecmaVersion != null) acornOpts.ecmaVersion = opts.ecmaVersion;
|
||||
if (opts.sourceType != null) acornOpts.sourceType = opts.sourceType;
|
||||
if (opts.allowHashBang != null) acornOpts.allowHashBang = opts.allowHashBang;
|
||||
if (opts.allowReturnOutsideFunction != null) acornOpts.allowReturnOutsideFunction = opts.allowReturnOutsideFunction;
|
||||
|
||||
return acorn.parse(src, acornOpts);
|
||||
}
|
||||
|
||||
var exports = module.exports = function (src, opts) {
|
||||
return exports.find(src, opts).strings;
|
||||
};
|
||||
|
||||
exports.find = function (src, opts) {
|
||||
if (!opts) opts = {};
|
||||
|
||||
var word = opts.word === undefined ? 'require' : opts.word;
|
||||
if (typeof src !== 'string') src = String(src);
|
||||
|
||||
var isRequire = opts.isRequire || function (node) {
|
||||
return node.callee.type === 'Identifier'
|
||||
&& node.callee.name === word
|
||||
;
|
||||
};
|
||||
|
||||
var modules = { strings : [], expressions : [] };
|
||||
if (opts.nodes) modules.nodes = [];
|
||||
|
||||
var wordRe = word === 'require' ? requireRe : RegExp('\\b' + word + '\\b');
|
||||
if (!wordRe.test(src)) return modules;
|
||||
|
||||
var ast = parse(src, opts.parse);
|
||||
|
||||
function visit(node, st, c) {
|
||||
var hasRequire = wordRe.test(src.slice(node.start, node.end));
|
||||
if (!hasRequire) return;
|
||||
walk.base[node.type](node, st, c);
|
||||
if (node.type !== 'CallExpression') return;
|
||||
if (isRequire(node)) {
|
||||
if (node.arguments.length) {
|
||||
var arg = node.arguments[0];
|
||||
if (arg.type === 'Literal') {
|
||||
modules.strings.push(arg.value);
|
||||
}
|
||||
else if (arg.type === 'TemplateLiteral'
|
||||
&& arg.quasis.length === 1
|
||||
&& arg.expressions.length === 0) {
|
||||
|
||||
modules.strings.push(arg.quasis[0].value.raw);
|
||||
}
|
||||
else {
|
||||
modules.expressions.push(src.slice(arg.start, arg.end));
|
||||
}
|
||||
}
|
||||
if (opts.nodes) modules.nodes.push(node);
|
||||
}
|
||||
}
|
||||
|
||||
walk.recursive(ast, null, {
|
||||
Statement: visit,
|
||||
Expression: visit
|
||||
});
|
||||
|
||||
return modules;
|
||||
};
|
||||
@@ -0,0 +1,120 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for csv2json/src/util.ts</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="../../prettify.css" />
|
||||
<link rel="stylesheet" href="../../base.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style type='text/css'>
|
||||
.coverage-summary .sorter {
|
||||
background-image: url(../../sort-arrow-sprite.png);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='wrapper'>
|
||||
<div class='pad1'>
|
||||
<h1>
|
||||
<a href="../../index.html">All files</a> / <a href="index.html">csv2json/src</a> util.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>3/3</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">50% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>1/2</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>0/0</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>2/2</span>
|
||||
</div>
|
||||
</div>
|
||||
<p class="quiet">
|
||||
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
|
||||
</p>
|
||||
</div>
|
||||
<div class='status-line high'></div>
|
||||
<pre><table class="coverage">
|
||||
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
|
||||
<a name='L2'></a><a href='#L2'>2</a>
|
||||
<a name='L3'></a><a href='#L3'>3</a>
|
||||
<a name='L4'></a><a href='#L4'>4</a>
|
||||
<a name='L5'></a><a href='#L5'>5</a>
|
||||
<a name='L6'></a><a href='#L6'>6</a>
|
||||
<a name='L7'></a><a href='#L7'>7</a>
|
||||
<a name='L8'></a><a href='#L8'>8</a>
|
||||
<a name='L9'></a><a href='#L9'>9</a>
|
||||
<a name='L10'></a><a href='#L10'>10</a>
|
||||
<a name='L11'></a><a href='#L11'>11</a>
|
||||
<a name='L12'></a><a href='#L12'>12</a>
|
||||
<a name='L13'></a><a href='#L13'>13</a>
|
||||
<a name='L14'></a><a href='#L14'>14</a>
|
||||
<a name='L15'></a><a href='#L15'>15</a>
|
||||
<a name='L16'></a><a href='#L16'>16</a>
|
||||
<a name='L17'></a><a href='#L17'>17</a>
|
||||
<a name='L18'></a><a href='#L18'>18</a></td><td class="line-coverage quiet"><span class="cline-any cline-yes">290x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">22x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">export function bufFromString(str: string): Buffer {
|
||||
const length = Buffer.byteLength(str);
|
||||
<span class="branch-1 cbranch-no" title="branch not covered" > const buffer = Buffer.a</span>llocUnsafe
|
||||
? Buffer.allocUnsafe(length)
|
||||
: new Buffer(length);
|
||||
buffer.write(str);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
export function filterArray(arr: any[], filter: number[]): any[] {
|
||||
const rtn: any[] = [];
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
if (filter.indexOf(i) > -1) {
|
||||
rtn.push(arr[i]);
|
||||
}
|
||||
}
|
||||
return rtn;
|
||||
}</pre></td></tr>
|
||||
</table></pre>
|
||||
<div class='push'></div><!-- for sticky footer -->
|
||||
</div><!-- /wrapper -->
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage
|
||||
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Fri May 11 2018 21:20:20 GMT+0100 (IST)
|
||||
</div>
|
||||
</div>
|
||||
<script src="../../prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="../../sorter.js"></script>
|
||||
<script src="../../block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,11 @@
|
||||
'use strict';
|
||||
|
||||
var Day = require('./Day');
|
||||
var DayFromYear = require('./DayFromYear');
|
||||
var YearFromTime = require('./YearFromTime');
|
||||
|
||||
// https://262.ecma-international.org/5.1/#sec-15.9.1.4
|
||||
|
||||
module.exports = function DayWithinYear(t) {
|
||||
return Day(t) - DayFromYear(YearFromTime(t));
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"xdg-basedir","version":"5.1.0","files":{"license":{"checkedAt":1678883669302,"integrity":"sha512-0fM2/ycrxrltyaBKfQ748Ck23VlPUUBgNAR47ldf4B1V/HoXTfWBSk+vcshGKwEpmOynu4mOP5o+hyBfuRNa8g==","mode":420,"size":1117},"index.js":{"checkedAt":1678883673455,"integrity":"sha512-Td6artkfwQzRIEmua8N8pgRQ/umsYRvOdYymjeNcrrqZP8Jso6son0hKtepvO0S21IqBxfkxgL22II88Hmkd4Q==","mode":420,"size":946},"package.json":{"checkedAt":1678883673455,"integrity":"sha512-Q90OutgM072DaPE1Z1Me9cs0a/j3HM5A/oaYEyywBQu2kETwb16XcrUY9UHZLGoq1rmvDtDpHf3+C5qAS5TDJQ==","mode":420,"size":783},"readme.md":{"checkedAt":1678883673455,"integrity":"sha512-oU9rNPDmDwjBKztLY6E+aP7JDCYgFBmPVxSSYiWRuR5e8SImAtw3PwTZqBGu+d5nCZ1ZuG3X0vJutP3s3aWMoA==","mode":420,"size":2178},"index.d.ts":{"checkedAt":1678883673455,"integrity":"sha512-VkhKUar+SmWdEHAWxyaZDFT7QWcXn8GTkaO1NoqgblVjw0SaV0K8Cd4tknqSE5RGy8T9jKNIMyTBF5yEKZvjGg==","mode":420,"size":1789}}}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"takeWhile.js","sourceRoot":"","sources":["../../../../src/internal/operators/takeWhile.ts"],"names":[],"mappings":";;;AACA,qCAAuC;AACvC,2DAAgE;AAoDhE,SAAgB,SAAS,CAAI,SAA+C,EAAE,SAAiB;IAAjB,0BAAA,EAAA,iBAAiB;IAC7F,OAAO,cAAO,CAAC,UAAC,MAAM,EAAE,UAAU;QAChC,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,MAAM,CAAC,SAAS,CACd,6CAAwB,CAAC,UAAU,EAAE,UAAC,KAAK;YACzC,IAAM,MAAM,GAAG,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;YACzC,CAAC,MAAM,IAAI,SAAS,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAChD,CAAC,MAAM,IAAI,UAAU,CAAC,QAAQ,EAAE,CAAC;QACnC,CAAC,CAAC,CACH,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAXD,8BAWC"}
|
||||
@@ -0,0 +1,52 @@
|
||||
'use strict';
|
||||
|
||||
var assign = require('../');
|
||||
assign.shim();
|
||||
|
||||
var test = require('tape');
|
||||
var defineProperties = require('define-properties');
|
||||
var isEnumerable = Object.prototype.propertyIsEnumerable;
|
||||
var functionsHaveNames = require('functions-have-names')();
|
||||
|
||||
var runTests = require('./tests');
|
||||
|
||||
test('shimmed', function (t) {
|
||||
t.equal(Object.assign.length, 2, 'Object.assign has a length of 2');
|
||||
t.test('Function name', { skip: !functionsHaveNames }, function (st) {
|
||||
st.equal(Object.assign.name, 'assign', 'Object.assign has name "assign"');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) {
|
||||
et.equal(false, isEnumerable.call(Object, 'assign'), 'Object.assign is not enumerable');
|
||||
et.end();
|
||||
});
|
||||
|
||||
var supportsStrictMode = (function () { return typeof this === 'undefined'; }());
|
||||
|
||||
t.test('bad object value', { skip: !supportsStrictMode }, function (st) {
|
||||
st['throws'](function () { return Object.assign(undefined); }, TypeError, 'undefined is not an object');
|
||||
st['throws'](function () { return Object.assign(null); }, TypeError, 'null is not an object');
|
||||
st.end();
|
||||
});
|
||||
|
||||
// v8 in node 0.8 and 0.10 have non-enumerable string properties
|
||||
var stringCharsAreEnumerable = isEnumerable.call('xy', 0);
|
||||
t.test('when Object.assign is present and has pending exceptions', { skip: !stringCharsAreEnumerable || !Object.preventExtensions }, function (st) {
|
||||
/*
|
||||
* Firefox 37 still has "pending exception" logic in its Object.assign implementation,
|
||||
* which is 72% slower than our shim, and Firefox 40's native implementation.
|
||||
*/
|
||||
var thrower = Object.preventExtensions({ 1: '2' });
|
||||
var error;
|
||||
try { Object.assign(thrower, 'xy'); } catch (e) { error = e; }
|
||||
st.equal(error instanceof TypeError, true, 'error is TypeError');
|
||||
st.equal(thrower[1], '2', 'thrower[1] === "2"');
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
runTests(Object.assign, t);
|
||||
|
||||
t.end();
|
||||
});
|
||||
@@ -0,0 +1,3 @@
|
||||
const compare = require('./compare')
|
||||
const eq = (a, b, loose) => compare(a, b, loose) === 0
|
||||
module.exports = eq
|
||||
@@ -0,0 +1,636 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for csv2json/src/Converter.ts</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="../../prettify.css" />
|
||||
<link rel="stylesheet" href="../../base.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style type='text/css'>
|
||||
.coverage-summary .sorter {
|
||||
background-image: url(../../sort-arrow-sprite.png);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='wrapper'>
|
||||
<div class='pad1'>
|
||||
<h1>
|
||||
<a href="../../index.html">All files</a> / <a href="index.html">csv2json/src</a> Converter.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">94% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>94/100</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">84.62% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>22/26</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">96.43% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>27/28</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">93.62% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>88/94</span>
|
||||
</div>
|
||||
</div>
|
||||
<p class="quiet">
|
||||
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
|
||||
</p>
|
||||
</div>
|
||||
<div class='status-line high'></div>
|
||||
<pre><table class="coverage">
|
||||
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
|
||||
<a name='L2'></a><a href='#L2'>2</a>
|
||||
<a name='L3'></a><a href='#L3'>3</a>
|
||||
<a name='L4'></a><a href='#L4'>4</a>
|
||||
<a name='L5'></a><a href='#L5'>5</a>
|
||||
<a name='L6'></a><a href='#L6'>6</a>
|
||||
<a name='L7'></a><a href='#L7'>7</a>
|
||||
<a name='L8'></a><a href='#L8'>8</a>
|
||||
<a name='L9'></a><a href='#L9'>9</a>
|
||||
<a name='L10'></a><a href='#L10'>10</a>
|
||||
<a name='L11'></a><a href='#L11'>11</a>
|
||||
<a name='L12'></a><a href='#L12'>12</a>
|
||||
<a name='L13'></a><a href='#L13'>13</a>
|
||||
<a name='L14'></a><a href='#L14'>14</a>
|
||||
<a name='L15'></a><a href='#L15'>15</a>
|
||||
<a name='L16'></a><a href='#L16'>16</a>
|
||||
<a name='L17'></a><a href='#L17'>17</a>
|
||||
<a name='L18'></a><a href='#L18'>18</a>
|
||||
<a name='L19'></a><a href='#L19'>19</a>
|
||||
<a name='L20'></a><a href='#L20'>20</a>
|
||||
<a name='L21'></a><a href='#L21'>21</a>
|
||||
<a name='L22'></a><a href='#L22'>22</a>
|
||||
<a name='L23'></a><a href='#L23'>23</a>
|
||||
<a name='L24'></a><a href='#L24'>24</a>
|
||||
<a name='L25'></a><a href='#L25'>25</a>
|
||||
<a name='L26'></a><a href='#L26'>26</a>
|
||||
<a name='L27'></a><a href='#L27'>27</a>
|
||||
<a name='L28'></a><a href='#L28'>28</a>
|
||||
<a name='L29'></a><a href='#L29'>29</a>
|
||||
<a name='L30'></a><a href='#L30'>30</a>
|
||||
<a name='L31'></a><a href='#L31'>31</a>
|
||||
<a name='L32'></a><a href='#L32'>32</a>
|
||||
<a name='L33'></a><a href='#L33'>33</a>
|
||||
<a name='L34'></a><a href='#L34'>34</a>
|
||||
<a name='L35'></a><a href='#L35'>35</a>
|
||||
<a name='L36'></a><a href='#L36'>36</a>
|
||||
<a name='L37'></a><a href='#L37'>37</a>
|
||||
<a name='L38'></a><a href='#L38'>38</a>
|
||||
<a name='L39'></a><a href='#L39'>39</a>
|
||||
<a name='L40'></a><a href='#L40'>40</a>
|
||||
<a name='L41'></a><a href='#L41'>41</a>
|
||||
<a name='L42'></a><a href='#L42'>42</a>
|
||||
<a name='L43'></a><a href='#L43'>43</a>
|
||||
<a name='L44'></a><a href='#L44'>44</a>
|
||||
<a name='L45'></a><a href='#L45'>45</a>
|
||||
<a name='L46'></a><a href='#L46'>46</a>
|
||||
<a name='L47'></a><a href='#L47'>47</a>
|
||||
<a name='L48'></a><a href='#L48'>48</a>
|
||||
<a name='L49'></a><a href='#L49'>49</a>
|
||||
<a name='L50'></a><a href='#L50'>50</a>
|
||||
<a name='L51'></a><a href='#L51'>51</a>
|
||||
<a name='L52'></a><a href='#L52'>52</a>
|
||||
<a name='L53'></a><a href='#L53'>53</a>
|
||||
<a name='L54'></a><a href='#L54'>54</a>
|
||||
<a name='L55'></a><a href='#L55'>55</a>
|
||||
<a name='L56'></a><a href='#L56'>56</a>
|
||||
<a name='L57'></a><a href='#L57'>57</a>
|
||||
<a name='L58'></a><a href='#L58'>58</a>
|
||||
<a name='L59'></a><a href='#L59'>59</a>
|
||||
<a name='L60'></a><a href='#L60'>60</a>
|
||||
<a name='L61'></a><a href='#L61'>61</a>
|
||||
<a name='L62'></a><a href='#L62'>62</a>
|
||||
<a name='L63'></a><a href='#L63'>63</a>
|
||||
<a name='L64'></a><a href='#L64'>64</a>
|
||||
<a name='L65'></a><a href='#L65'>65</a>
|
||||
<a name='L66'></a><a href='#L66'>66</a>
|
||||
<a name='L67'></a><a href='#L67'>67</a>
|
||||
<a name='L68'></a><a href='#L68'>68</a>
|
||||
<a name='L69'></a><a href='#L69'>69</a>
|
||||
<a name='L70'></a><a href='#L70'>70</a>
|
||||
<a name='L71'></a><a href='#L71'>71</a>
|
||||
<a name='L72'></a><a href='#L72'>72</a>
|
||||
<a name='L73'></a><a href='#L73'>73</a>
|
||||
<a name='L74'></a><a href='#L74'>74</a>
|
||||
<a name='L75'></a><a href='#L75'>75</a>
|
||||
<a name='L76'></a><a href='#L76'>76</a>
|
||||
<a name='L77'></a><a href='#L77'>77</a>
|
||||
<a name='L78'></a><a href='#L78'>78</a>
|
||||
<a name='L79'></a><a href='#L79'>79</a>
|
||||
<a name='L80'></a><a href='#L80'>80</a>
|
||||
<a name='L81'></a><a href='#L81'>81</a>
|
||||
<a name='L82'></a><a href='#L82'>82</a>
|
||||
<a name='L83'></a><a href='#L83'>83</a>
|
||||
<a name='L84'></a><a href='#L84'>84</a>
|
||||
<a name='L85'></a><a href='#L85'>85</a>
|
||||
<a name='L86'></a><a href='#L86'>86</a>
|
||||
<a name='L87'></a><a href='#L87'>87</a>
|
||||
<a name='L88'></a><a href='#L88'>88</a>
|
||||
<a name='L89'></a><a href='#L89'>89</a>
|
||||
<a name='L90'></a><a href='#L90'>90</a>
|
||||
<a name='L91'></a><a href='#L91'>91</a>
|
||||
<a name='L92'></a><a href='#L92'>92</a>
|
||||
<a name='L93'></a><a href='#L93'>93</a>
|
||||
<a name='L94'></a><a href='#L94'>94</a>
|
||||
<a name='L95'></a><a href='#L95'>95</a>
|
||||
<a name='L96'></a><a href='#L96'>96</a>
|
||||
<a name='L97'></a><a href='#L97'>97</a>
|
||||
<a name='L98'></a><a href='#L98'>98</a>
|
||||
<a name='L99'></a><a href='#L99'>99</a>
|
||||
<a name='L100'></a><a href='#L100'>100</a>
|
||||
<a name='L101'></a><a href='#L101'>101</a>
|
||||
<a name='L102'></a><a href='#L102'>102</a>
|
||||
<a name='L103'></a><a href='#L103'>103</a>
|
||||
<a name='L104'></a><a href='#L104'>104</a>
|
||||
<a name='L105'></a><a href='#L105'>105</a>
|
||||
<a name='L106'></a><a href='#L106'>106</a>
|
||||
<a name='L107'></a><a href='#L107'>107</a>
|
||||
<a name='L108'></a><a href='#L108'>108</a>
|
||||
<a name='L109'></a><a href='#L109'>109</a>
|
||||
<a name='L110'></a><a href='#L110'>110</a>
|
||||
<a name='L111'></a><a href='#L111'>111</a>
|
||||
<a name='L112'></a><a href='#L112'>112</a>
|
||||
<a name='L113'></a><a href='#L113'>113</a>
|
||||
<a name='L114'></a><a href='#L114'>114</a>
|
||||
<a name='L115'></a><a href='#L115'>115</a>
|
||||
<a name='L116'></a><a href='#L116'>116</a>
|
||||
<a name='L117'></a><a href='#L117'>117</a>
|
||||
<a name='L118'></a><a href='#L118'>118</a>
|
||||
<a name='L119'></a><a href='#L119'>119</a>
|
||||
<a name='L120'></a><a href='#L120'>120</a>
|
||||
<a name='L121'></a><a href='#L121'>121</a>
|
||||
<a name='L122'></a><a href='#L122'>122</a>
|
||||
<a name='L123'></a><a href='#L123'>123</a>
|
||||
<a name='L124'></a><a href='#L124'>124</a>
|
||||
<a name='L125'></a><a href='#L125'>125</a>
|
||||
<a name='L126'></a><a href='#L126'>126</a>
|
||||
<a name='L127'></a><a href='#L127'>127</a>
|
||||
<a name='L128'></a><a href='#L128'>128</a>
|
||||
<a name='L129'></a><a href='#L129'>129</a>
|
||||
<a name='L130'></a><a href='#L130'>130</a>
|
||||
<a name='L131'></a><a href='#L131'>131</a>
|
||||
<a name='L132'></a><a href='#L132'>132</a>
|
||||
<a name='L133'></a><a href='#L133'>133</a>
|
||||
<a name='L134'></a><a href='#L134'>134</a>
|
||||
<a name='L135'></a><a href='#L135'>135</a>
|
||||
<a name='L136'></a><a href='#L136'>136</a>
|
||||
<a name='L137'></a><a href='#L137'>137</a>
|
||||
<a name='L138'></a><a href='#L138'>138</a>
|
||||
<a name='L139'></a><a href='#L139'>139</a>
|
||||
<a name='L140'></a><a href='#L140'>140</a>
|
||||
<a name='L141'></a><a href='#L141'>141</a>
|
||||
<a name='L142'></a><a href='#L142'>142</a>
|
||||
<a name='L143'></a><a href='#L143'>143</a>
|
||||
<a name='L144'></a><a href='#L144'>144</a>
|
||||
<a name='L145'></a><a href='#L145'>145</a>
|
||||
<a name='L146'></a><a href='#L146'>146</a>
|
||||
<a name='L147'></a><a href='#L147'>147</a>
|
||||
<a name='L148'></a><a href='#L148'>148</a>
|
||||
<a name='L149'></a><a href='#L149'>149</a>
|
||||
<a name='L150'></a><a href='#L150'>150</a>
|
||||
<a name='L151'></a><a href='#L151'>151</a>
|
||||
<a name='L152'></a><a href='#L152'>152</a>
|
||||
<a name='L153'></a><a href='#L153'>153</a>
|
||||
<a name='L154'></a><a href='#L154'>154</a>
|
||||
<a name='L155'></a><a href='#L155'>155</a>
|
||||
<a name='L156'></a><a href='#L156'>156</a>
|
||||
<a name='L157'></a><a href='#L157'>157</a>
|
||||
<a name='L158'></a><a href='#L158'>158</a>
|
||||
<a name='L159'></a><a href='#L159'>159</a>
|
||||
<a name='L160'></a><a href='#L160'>160</a>
|
||||
<a name='L161'></a><a href='#L161'>161</a>
|
||||
<a name='L162'></a><a href='#L162'>162</a>
|
||||
<a name='L163'></a><a href='#L163'>163</a>
|
||||
<a name='L164'></a><a href='#L164'>164</a>
|
||||
<a name='L165'></a><a href='#L165'>165</a>
|
||||
<a name='L166'></a><a href='#L166'>166</a>
|
||||
<a name='L167'></a><a href='#L167'>167</a>
|
||||
<a name='L168'></a><a href='#L168'>168</a>
|
||||
<a name='L169'></a><a href='#L169'>169</a>
|
||||
<a name='L170'></a><a href='#L170'>170</a>
|
||||
<a name='L171'></a><a href='#L171'>171</a>
|
||||
<a name='L172'></a><a href='#L172'>172</a>
|
||||
<a name='L173'></a><a href='#L173'>173</a>
|
||||
<a name='L174'></a><a href='#L174'>174</a>
|
||||
<a name='L175'></a><a href='#L175'>175</a>
|
||||
<a name='L176'></a><a href='#L176'>176</a>
|
||||
<a name='L177'></a><a href='#L177'>177</a>
|
||||
<a name='L178'></a><a href='#L178'>178</a>
|
||||
<a name='L179'></a><a href='#L179'>179</a>
|
||||
<a name='L180'></a><a href='#L180'>180</a>
|
||||
<a name='L181'></a><a href='#L181'>181</a>
|
||||
<a name='L182'></a><a href='#L182'>182</a>
|
||||
<a name='L183'></a><a href='#L183'>183</a>
|
||||
<a name='L184'></a><a href='#L184'>184</a>
|
||||
<a name='L185'></a><a href='#L185'>185</a>
|
||||
<a name='L186'></a><a href='#L186'>186</a>
|
||||
<a name='L187'></a><a href='#L187'>187</a>
|
||||
<a name='L188'></a><a href='#L188'>188</a>
|
||||
<a name='L189'></a><a href='#L189'>189</a>
|
||||
<a name='L190'></a><a href='#L190'>190</a></td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">17x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">17x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">25x</span>
|
||||
<span class="cline-any cline-yes">25x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">16x</span>
|
||||
<span class="cline-any cline-yes">16x</span>
|
||||
<span class="cline-any cline-yes">16x</span>
|
||||
<span class="cline-any cline-yes">16x</span>
|
||||
<span class="cline-any cline-yes">37x</span>
|
||||
<span class="cline-any cline-yes">16x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">21x</span>
|
||||
<span class="cline-any cline-yes">21x</span>
|
||||
<span class="cline-any cline-yes">21x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">16x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">49x</span>
|
||||
<span class="cline-any cline-yes">49x</span>
|
||||
<span class="cline-any cline-yes">49x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">46x</span>
|
||||
<span class="cline-any cline-yes">46x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">165734x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">436312x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">217x</span>
|
||||
<span class="cline-any cline-yes">73x</span>
|
||||
<span class="cline-any cline-yes">73x</span>
|
||||
<span class="cline-any cline-yes">73x</span>
|
||||
<span class="cline-any cline-yes">73x</span>
|
||||
<span class="cline-any cline-yes">73x</span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">73x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">73x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">6x</span>
|
||||
<span class="cline-any cline-yes">6x</span>
|
||||
<span class="cline-any cline-yes">6x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">73x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">124x</span>
|
||||
<span class="cline-any cline-yes">124x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">122x</span>
|
||||
<span class="cline-any cline-yes">70x</span>
|
||||
<span class="cline-any cline-yes">70x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">122x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">65x</span>
|
||||
<span class="cline-any cline-yes">65x</span>
|
||||
<span class="cline-any cline-yes">28x</span>
|
||||
<span class="cline-any cline-yes">28x</span>
|
||||
<span class="cline-any cline-yes">28x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">28x</span>
|
||||
<span class="cline-any cline-yes">24x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">28x</span>
|
||||
<span class="cline-any cline-yes">4x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">24x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">37x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">61x</span>
|
||||
<span class="cline-any cline-yes">61x</span>
|
||||
<span class="cline-any cline-yes">61x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">4x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">import { Transform, TransformOptions, Readable } from "stream";
|
||||
import { CSVParseParam, mergeParams } from "./Parameters";
|
||||
import { ParseRuntime, initParseRuntime } from "./ParseRuntime";
|
||||
import P from "bluebird";
|
||||
import { Worker } from "./Worker";
|
||||
import { stringToLines } from "./fileline";
|
||||
import { map } from "lodash/map";
|
||||
import { RowSplit, RowSplitResult } from "./rowSplit";
|
||||
import getEol from "./getEol";
|
||||
import lineToJson, { JSONResult } from "./lineToJson";
|
||||
import { Processor, ProcessLineResult } from "./Processor";
|
||||
import { ProcessorFork } from "./ProcessFork";
|
||||
import { ProcessorLocal } from "./ProcessorLocal";
|
||||
import { Result } from "./Result";
|
||||
import CSVError from "./CSVError";
|
||||
import { bufFromString } from "./util";
|
||||
export class Converter extends Transform {
|
||||
preRawData(onRawData: PreRawDataCallback) {
|
||||
this.runtime.preRawDataHook = onRawData;
|
||||
}
|
||||
preFileLine(onFileLine: PreFileLineCallback) {
|
||||
this.runtime.preFileLineHook = onFileLine;
|
||||
}
|
||||
subscribe(
|
||||
onNext?: (data: any, lineNumber: number) => void | PromiseLike<void>,
|
||||
onError?: (err: CSVError) => void,
|
||||
onCompleted?: () => void): Converter {
|
||||
this.parseRuntime.subscribe = {
|
||||
onNext,
|
||||
onError,
|
||||
onCompleted
|
||||
}
|
||||
return this;
|
||||
}
|
||||
fromFile(filePath: string, options?: string | CreateReadStreamOption | undefined): Converter {
|
||||
const fs = require("fs");
|
||||
// var rs = null;
|
||||
// this.wrapCallback(cb, function () {
|
||||
// if (rs && rs.destroy) {
|
||||
// rs.destroy();
|
||||
// }
|
||||
// });
|
||||
fs.exists(filePath, (exist) => {
|
||||
<span class="missing-if-branch" title="else path not taken" >E</span>if (exist) {
|
||||
const rs = fs.createReadStream(filePath, options);
|
||||
rs.pipe(this);
|
||||
} else {
|
||||
<span class="cstat-no" title="statement not covered" > this.emit('error', new Error("File does not exist. Check to make sure the file path to your csv is correct."));</span>
|
||||
}
|
||||
});
|
||||
return this;
|
||||
}
|
||||
fromStream(readStream: Readable): Converter {
|
||||
readStream.pipe(this);
|
||||
return this;
|
||||
}
|
||||
fromString(csvString: string): Converter {
|
||||
const csv = csvString.toString();
|
||||
const read = new Readable();
|
||||
let idx = 0;
|
||||
read._read = function (size) {
|
||||
if (idx >= csvString.length) {
|
||||
this.push(null);
|
||||
} else {
|
||||
const str = csvString.substr(idx, size);
|
||||
this.push(str);
|
||||
idx += size;
|
||||
}
|
||||
}
|
||||
return this.fromStream(read);
|
||||
}
|
||||
then<TResult1 = any[], TResult2 = never>(onfulfilled?: (value: any[]) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>): PromiseLike<TResult1 | TResult2> {
|
||||
return new P((resolve, reject) => {
|
||||
this.parseRuntime.then = {
|
||||
onfulfilled: (value: any[]) => {
|
||||
<span class="missing-if-branch" title="else path not taken" >E</span>if (onfulfilled) {
|
||||
resolve(onfulfilled(value));
|
||||
} else {
|
||||
<span class="cstat-no" title="statement not covered" > resolve(value as any);</span>
|
||||
}
|
||||
},
|
||||
onrejected: (err: Error) => {
|
||||
<span class="missing-if-branch" title="else path not taken" >E</span>if (onrejected) {
|
||||
resolve(onrejected(err));
|
||||
} else {
|
||||
<span class="cstat-no" title="statement not covered" > reject(err);</span>
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
public get parseParam(): CSVParseParam {
|
||||
return this.params;
|
||||
}
|
||||
public get parseRuntime(): ParseRuntime {
|
||||
return this.runtime;
|
||||
}
|
||||
private params: CSVParseParam;
|
||||
private runtime: ParseRuntime;
|
||||
private processor: Processor;
|
||||
private result: Result;
|
||||
constructor(param?: Partial<CSVParseParam>, public options: TransformOptions = {}) {
|
||||
super(options);
|
||||
this.params = mergeParams(param);
|
||||
this.runtime = initParseRuntime(this);
|
||||
this.result = new Result(this);
|
||||
<span class="missing-if-branch" title="if path not taken" >I</span>if (this.params.fork) {
|
||||
<span class="cstat-no" title="statement not covered" > this.processor = new ProcessorFork(this);</span>
|
||||
} else {
|
||||
this.processor = new ProcessorLocal(this);
|
||||
}
|
||||
this.once("error", (err: any) => {
|
||||
// console.log("BBB");
|
||||
this.result.processError(err);
|
||||
setTimeout(() => {
|
||||
this.emit("done", err);
|
||||
},0);
|
||||
|
||||
});
|
||||
|
||||
return this;
|
||||
}
|
||||
_transform(chunk: any, encoding: string, cb: Function) {
|
||||
this.processor.process(chunk)
|
||||
.then((result) => {
|
||||
if (result.length > 0) {
|
||||
this.runtime.started = true;
|
||||
return this.result.processResult(result);
|
||||
}
|
||||
})
|
||||
.then(() => {
|
||||
cb();
|
||||
}, (error) => {
|
||||
this.runtime.hasError = true;
|
||||
this.runtime.error = error;
|
||||
this.emit("error", error);
|
||||
cb();
|
||||
});
|
||||
}
|
||||
_flush(cb: Function) {
|
||||
if (this.runtime.csvLineBuffer && this.runtime.csvLineBuffer.length > 0) {
|
||||
const buf = this.runtime.csvLineBuffer;
|
||||
this.runtime.csvLineBuffer = undefined;
|
||||
this.processor.process(buf, true)
|
||||
.then((result) => {
|
||||
if (result.length > 0) {
|
||||
return this.result.processResult(result);
|
||||
}
|
||||
})
|
||||
.then(() => {
|
||||
if (this.runtime.csvLineBuffer && this.runtime.csvLineBuffer.length > 0) {
|
||||
this.emit("error", CSVError.unclosed_quote(this.parsedLineNumber, this.runtime.csvLineBuffer.toString()));
|
||||
} else {
|
||||
this.processEnd(cb);
|
||||
}
|
||||
// cb();
|
||||
|
||||
}, <span class="fstat-no" title="function not covered" >(</span>err) => {
|
||||
<span class="cstat-no" title="statement not covered" > this.emit("error", err);</span>
|
||||
<span class="cstat-no" title="statement not covered" > cb();</span>
|
||||
})
|
||||
} else {
|
||||
this.processEnd(cb);
|
||||
}
|
||||
}
|
||||
private processEnd(cb) {
|
||||
this.result.endProcess();
|
||||
this.emit("done");
|
||||
cb();
|
||||
}
|
||||
get parsedLineNumber(): number {
|
||||
return this.runtime.parsedLineNumber;
|
||||
}
|
||||
}
|
||||
export interface CreateReadStreamOption {
|
||||
flags?: string;
|
||||
encoding?: string;
|
||||
fd?: number;
|
||||
mode?: number;
|
||||
autoClose?: boolean;
|
||||
start?: number;
|
||||
end?: number;
|
||||
highWaterMark?: number;
|
||||
}
|
||||
export type CallBack = (err: Error, data: Array<any>) => void;
|
||||
|
||||
|
||||
export type PreFileLineCallback = (line: string, lineNumber: number) => string | PromiseLike<string>;
|
||||
export type PreRawDataCallback = (csvString: string) => string | PromiseLike<string>;
|
||||
</pre></td></tr>
|
||||
</table></pre>
|
||||
<div class='push'></div><!-- for sticky footer -->
|
||||
</div><!-- /wrapper -->
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage
|
||||
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Fri May 11 2018 21:36:07 GMT+0100 (IST)
|
||||
</div>
|
||||
</div>
|
||||
<script src="../../prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="../../sorter.js"></script>
|
||||
<script src="../../block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,22 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2017-2021 Luke Childs
|
||||
Copyright (c) 2022 Jared Wray
|
||||
|
||||
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.
|
||||
@@ -0,0 +1,20 @@
|
||||
Copyright (c) 2018 Chris O'Hara <cohara87@gmail.com>
|
||||
|
||||
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.
|
||||
@@ -0,0 +1,35 @@
|
||||
import { invariant } from './utils';
|
||||
/**
|
||||
* https://tc39.es/ecma402/#sec-partitionpattern
|
||||
* @param pattern
|
||||
*/
|
||||
export function PartitionPattern(pattern) {
|
||||
var result = [];
|
||||
var beginIndex = pattern.indexOf('{');
|
||||
var endIndex = 0;
|
||||
var nextIndex = 0;
|
||||
var length = pattern.length;
|
||||
while (beginIndex < pattern.length && beginIndex > -1) {
|
||||
endIndex = pattern.indexOf('}', beginIndex);
|
||||
invariant(endIndex > beginIndex, "Invalid pattern ".concat(pattern));
|
||||
if (beginIndex > nextIndex) {
|
||||
result.push({
|
||||
type: 'literal',
|
||||
value: pattern.substring(nextIndex, beginIndex),
|
||||
});
|
||||
}
|
||||
result.push({
|
||||
type: pattern.substring(beginIndex + 1, endIndex),
|
||||
value: undefined,
|
||||
});
|
||||
nextIndex = endIndex + 1;
|
||||
beginIndex = pattern.indexOf('{', nextIndex);
|
||||
}
|
||||
if (nextIndex < length) {
|
||||
result.push({
|
||||
type: 'literal',
|
||||
value: pattern.substring(nextIndex, length),
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"FormatNumericToParts.d.ts","sourceRoot":"","sources":["../../../../../../../packages/ecma402-abstract/NumberFormat/FormatNumericToParts.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,oBAAoB,EAAE,gBAAgB,EAAC,MAAM,iBAAiB,CAAA;AAEtE,wBAAgB,oBAAoB,CAClC,EAAE,EAAE,IAAI,CAAC,YAAY,EACrB,CAAC,EAAE,MAAM,EACT,WAAW,EAAE;IACX,gBAAgB,CAAC,EAAE,EAAE,IAAI,CAAC,YAAY,GAAG,oBAAoB,CAAA;CAC9D,GACA,gBAAgB,EAAE,CAWpB"}
|
||||
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = require('./async').setImmediate;
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,15 @@
|
||||
import { operate } from '../util/lift';
|
||||
import { createOperatorSubscriber } from './OperatorSubscriber';
|
||||
export function pairwise() {
|
||||
return operate(function (source, subscriber) {
|
||||
var prev;
|
||||
var hasPrev = false;
|
||||
source.subscribe(createOperatorSubscriber(subscriber, function (value) {
|
||||
var p = prev;
|
||||
prev = value;
|
||||
hasPrev && subscriber.next([p, value]);
|
||||
hasPrev = true;
|
||||
}));
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=pairwise.js.map
|
||||
@@ -0,0 +1,8 @@
|
||||
import Node from './Node';
|
||||
import Expression from './Expression';
|
||||
export default class Tag extends Node {
|
||||
type: 'MustacheTag' | 'RawMustacheTag';
|
||||
expression: Expression;
|
||||
should_cache: boolean;
|
||||
constructor(component: any, parent: any, scope: any, info: any);
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
<p align="center">
|
||||
<a href="https://rollupjs.org/"><img src="https://rollupjs.org/logo.svg" width="150" /></a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://www.npmjs.com/package/rollup">
|
||||
<img src="https://img.shields.io/npm/v/rollup.svg" alt="npm version" >
|
||||
</a>
|
||||
<a href="https://packagephobia.now.sh/result?p=rollup">
|
||||
<img src="https://packagephobia.now.sh/badge?p=rollup" alt="install size" >
|
||||
</a>
|
||||
<a href="https://codecov.io/gh/rollup/rollup">
|
||||
<img src="https://codecov.io/gh/rollup/rollup/graph/badge.svg" alt="code coverage" >
|
||||
</a>
|
||||
<a href="#backers" alt="sponsors on Open Collective">
|
||||
<img src="https://opencollective.com/rollup/backers/badge.svg" alt="backers" >
|
||||
</a>
|
||||
<a href="#sponsors" alt="Sponsors on Open Collective">
|
||||
<img src="https://opencollective.com/rollup/sponsors/badge.svg" alt="sponsors" >
|
||||
</a>
|
||||
<a href="https://github.com/rollup/rollup/blob/master/LICENSE.md">
|
||||
<img src="https://img.shields.io/npm/l/rollup.svg" alt="license">
|
||||
</a>
|
||||
|
||||
<a href='https://is.gd/rollup_chat?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge'>
|
||||
<img src='https://img.shields.io/discord/466787075518365708?color=778cd1&label=chat' alt='Join the chat at https://is.gd/rollup_chat'>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<h1 align="center">Rollup</h1>
|
||||
|
||||
## Overview
|
||||
|
||||
Rollup is a module bundler for JavaScript which compiles small pieces of code into something larger and more complex, such as a library or application. It uses the standardized ES module format for code, instead of previous idiosyncratic solutions such as CommonJS and AMD. ES modules let you freely and seamlessly combine the most useful individual functions from your favorite libraries. Rollup can optimize ES modules for faster native loading in modern browsers, or output a legacy module format allowing ES module workflows today.
|
||||
|
||||
## Quick Start Guide
|
||||
|
||||
Install with `npm install --global rollup`. Rollup can be used either through a [command line interface](https://rollupjs.org/#command-line-reference) with an optional configuration file or else through its [JavaScript API](https://rollupjs.org/guide/en/#javascript-api). Run `rollup --help` to see the available options and parameters. The starter project templates, [rollup-starter-lib](https://github.com/rollup/rollup-starter-lib) and [rollup-starter-app](https://github.com/rollup/rollup-starter-app), demonstrate common configuration options, and more detailed instructions are available throughout the [user guide](https://rollupjs.org/).
|
||||
|
||||
### Commands
|
||||
|
||||
These commands assume the entry point to your application is named main.js, and that you'd like all imports compiled into a single file named bundle.js.
|
||||
|
||||
For browsers:
|
||||
|
||||
```bash
|
||||
# compile to a <script> containing a self-executing function
|
||||
rollup main.js --format iife --name "myBundle" --file bundle.js
|
||||
```
|
||||
|
||||
For Node.js:
|
||||
|
||||
```bash
|
||||
# compile to a CommonJS module
|
||||
rollup main.js --format cjs --file bundle.js
|
||||
```
|
||||
|
||||
For both browsers and Node.js:
|
||||
|
||||
```bash
|
||||
# UMD format requires a bundle name
|
||||
rollup main.js --format umd --name "myBundle" --file bundle.js
|
||||
```
|
||||
|
||||
## Why
|
||||
|
||||
Developing software is usually easier if you break your project into smaller separate pieces, since that often removes unexpected interactions and dramatically reduces the complexity of the problems you'll need to solve, and simply writing smaller projects in the first place [isn't necessarily the answer](https://medium.com/@Rich_Harris/small-modules-it-s-not-quite-that-simple-3ca532d65de4). Unfortunately, JavaScript has not historically included this capability as a core feature in the language.
|
||||
|
||||
This finally changed with ES modules support in JavaScript, which provides a syntax for importing and exporting functions and data so they can be shared between separate scripts. Most browsers and Node.js support ES modules. However, Node.js releases before 12.17 support ES modules only behind the `--experimental-modules` flag, and older browsers like Internet Explorer do not support ES modules at all. Rollup allows you to write your code using ES modules, and run your application even in environments that do not support ES modules natively. For environments that support them, Rollup can output optimized ES modules; for environments that don't, Rollup can compile your code to other formats such as CommonJS modules, AMD modules, and IIFE-style scripts. This means that you get to _write future-proof code_, and you also get the tremendous benefits of...
|
||||
|
||||
## Tree Shaking
|
||||
|
||||
In addition to enabling the use of ES modules, Rollup also statically analyzes and optimizes the code you are importing, and will exclude anything that isn't actually used. This allows you to build on top of existing tools and modules without adding extra dependencies or bloating the size of your project.
|
||||
|
||||
For example, with CommonJS, the _entire tool or library must be imported_.
|
||||
|
||||
```js
|
||||
// import the entire utils object with CommonJS
|
||||
var utils = require('utils');
|
||||
var query = 'Rollup';
|
||||
// use the ajax method of the utils object
|
||||
utils.ajax('https://api.example.com?search=' + query).then(handleResponse);
|
||||
```
|
||||
|
||||
But with ES modules, instead of importing the whole `utils` object, we can just import the one `ajax` function we need:
|
||||
|
||||
```js
|
||||
// import the ajax function with an ES import statement
|
||||
import { ajax } from 'utils';
|
||||
var query = 'Rollup';
|
||||
// call the ajax function
|
||||
ajax('https://api.example.com?search=' + query).then(handleResponse);
|
||||
```
|
||||
|
||||
Because Rollup includes the bare minimum, it results in lighter, faster, and less complicated libraries and applications. Since this approach is based on explicit `import` and `export` statements, it is vastly more effective than simply running an automated minifier to detect unused variables in the compiled output code.
|
||||
|
||||
## Compatibility
|
||||
|
||||
### Importing CommonJS
|
||||
|
||||
Rollup can import existing CommonJS modules [through a plugin](https://github.com/rollup/plugins/tree/master/packages/commonjs).
|
||||
|
||||
### Publishing ES Modules
|
||||
|
||||
To make sure your ES modules are immediately usable by tools that work with CommonJS such as Node.js and webpack, you can use Rollup to compile to UMD or CommonJS format, and then point to that compiled version with the `main` property in your `package.json` file. If your `package.json` file also has a `module` field, ES-module-aware tools like Rollup and [webpack](https://webpack.js.org/) will [import the ES module version](https://github.com/rollup/rollup/wiki/pkg.module) directly.
|
||||
|
||||
## Contributors
|
||||
|
||||
This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)]. <a href="https://github.com/rollup/rollup/graphs/contributors"><img src="https://opencollective.com/rollup/contributors.svg?width=890" /></a>
|
||||
|
||||
## Backers
|
||||
|
||||
Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/rollup#backer)]
|
||||
|
||||
<a href="https://opencollective.com/rollup#backers" target="_blank"><img src="https://opencollective.com/rollup/backers.svg?width=890"></a>
|
||||
|
||||
## Sponsors
|
||||
|
||||
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/rollup#sponsor)]
|
||||
|
||||
<a href="https://opencollective.com/rollup/sponsor/0/website" target="_blank"><img src="https://opencollective.com/rollup/sponsor/0/avatar.svg"></a> <a href="https://opencollective.com/rollup/sponsor/1/website" target="_blank"><img src="https://opencollective.com/rollup/sponsor/1/avatar.svg"></a> <a href="https://opencollective.com/rollup/sponsor/2/website" target="_blank"><img src="https://opencollective.com/rollup/sponsor/2/avatar.svg"></a> <a href="https://opencollective.com/rollup/sponsor/3/website" target="_blank"><img src="https://opencollective.com/rollup/sponsor/3/avatar.svg"></a> <a href="https://opencollective.com/rollup/sponsor/4/website" target="_blank"><img src="https://opencollective.com/rollup/sponsor/4/avatar.svg"></a> <a href="https://opencollective.com/rollup/sponsor/5/website" target="_blank"><img src="https://opencollective.com/rollup/sponsor/5/avatar.svg"></a> <a href="https://opencollective.com/rollup/sponsor/6/website" target="_blank"><img src="https://opencollective.com/rollup/sponsor/6/avatar.svg"></a> <a href="https://opencollective.com/rollup/sponsor/7/website" target="_blank"><img src="https://opencollective.com/rollup/sponsor/7/avatar.svg"></a> <a href="https://opencollective.com/rollup/sponsor/8/website" target="_blank"><img src="https://opencollective.com/rollup/sponsor/8/avatar.svg"></a> <a href="https://opencollective.com/rollup/sponsor/9/website" target="_blank"><img src="https://opencollective.com/rollup/sponsor/9/avatar.svg"></a>
|
||||
|
||||
## License
|
||||
|
||||
[MIT](https://github.com/rollup/rollup/blob/master/LICENSE.md)
|
||||
@@ -0,0 +1,35 @@
|
||||
let crypto = require('crypto')
|
||||
let { urlAlphabet } = require('../url-alphabet/index.cjs')
|
||||
let random = bytes =>
|
||||
new Promise((resolve, reject) => {
|
||||
crypto.randomFill(Buffer.allocUnsafe(bytes), (err, buf) => {
|
||||
if (err) {
|
||||
reject(err)
|
||||
} else {
|
||||
resolve(buf)
|
||||
}
|
||||
})
|
||||
})
|
||||
let customAlphabet = (alphabet, defaultSize = 21) => {
|
||||
let mask = (2 << (31 - Math.clz32((alphabet.length - 1) | 1))) - 1
|
||||
let step = Math.ceil((1.6 * mask * defaultSize) / alphabet.length)
|
||||
let tick = (id, size = defaultSize) =>
|
||||
random(step).then(bytes => {
|
||||
let i = step
|
||||
while (i--) {
|
||||
id += alphabet[bytes[i] & mask] || ''
|
||||
if (id.length === size) return id
|
||||
}
|
||||
return tick(id, size)
|
||||
})
|
||||
return size => tick('', size)
|
||||
}
|
||||
let nanoid = (size = 21) =>
|
||||
random(size).then(bytes => {
|
||||
let id = ''
|
||||
while (size--) {
|
||||
id += urlAlphabet[bytes[size] & 63]
|
||||
}
|
||||
return id
|
||||
})
|
||||
module.exports = { nanoid, customAlphabet, random }
|
||||
@@ -0,0 +1,13 @@
|
||||
import { ConnectableObservable } from '../observable/ConnectableObservable';
|
||||
import { isFunction } from '../util/isFunction';
|
||||
import { connect } from './connect';
|
||||
export function multicast(subjectOrSubjectFactory, selector) {
|
||||
const subjectFactory = isFunction(subjectOrSubjectFactory) ? subjectOrSubjectFactory : () => subjectOrSubjectFactory;
|
||||
if (isFunction(selector)) {
|
||||
return connect(selector, {
|
||||
connector: subjectFactory,
|
||||
});
|
||||
}
|
||||
return (source) => new ConnectableObservable(source, subjectFactory);
|
||||
}
|
||||
//# sourceMappingURL=multicast.js.map
|
||||
@@ -0,0 +1,5 @@
|
||||
var convert = require('./convert'),
|
||||
func = convert('isObjectLike', require('../isObjectLike'), require('./_falseOptions'));
|
||||
|
||||
func.placeholder = require('./placeholder');
|
||||
module.exports = func;
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
Copyright (C) 2013 Yusuke Suzuki <utatane.tea@gmail.com>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
exports.ast = require('./ast');
|
||||
exports.code = require('./code');
|
||||
exports.keyword = require('./keyword');
|
||||
}());
|
||||
/* vim: set sw=4 ts=4 et tw=80 : */
|
||||
@@ -0,0 +1,26 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.scanInternals = void 0;
|
||||
var OperatorSubscriber_1 = require("./OperatorSubscriber");
|
||||
function scanInternals(accumulator, seed, hasSeed, emitOnNext, emitBeforeComplete) {
|
||||
return function (source, subscriber) {
|
||||
var hasState = hasSeed;
|
||||
var state = seed;
|
||||
var index = 0;
|
||||
source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) {
|
||||
var i = index++;
|
||||
state = hasState
|
||||
?
|
||||
accumulator(state, value, i)
|
||||
:
|
||||
((hasState = true), value);
|
||||
emitOnNext && subscriber.next(state);
|
||||
}, emitBeforeComplete &&
|
||||
(function () {
|
||||
hasState && subscriber.next(state);
|
||||
subscriber.complete();
|
||||
})));
|
||||
};
|
||||
}
|
||||
exports.scanInternals = scanInternals;
|
||||
//# sourceMappingURL=scanInternals.js.map
|
||||
@@ -0,0 +1,50 @@
|
||||
import { operate } from '../util/lift';
|
||||
import { createOperatorSubscriber } from './OperatorSubscriber';
|
||||
import { innerFrom } from '../observable/innerFrom';
|
||||
export var defaultThrottleConfig = {
|
||||
leading: true,
|
||||
trailing: false,
|
||||
};
|
||||
export function throttle(durationSelector, config) {
|
||||
if (config === void 0) { config = defaultThrottleConfig; }
|
||||
return operate(function (source, subscriber) {
|
||||
var leading = config.leading, trailing = config.trailing;
|
||||
var hasValue = false;
|
||||
var sendValue = null;
|
||||
var throttled = null;
|
||||
var isComplete = false;
|
||||
var endThrottling = function () {
|
||||
throttled === null || throttled === void 0 ? void 0 : throttled.unsubscribe();
|
||||
throttled = null;
|
||||
if (trailing) {
|
||||
send();
|
||||
isComplete && subscriber.complete();
|
||||
}
|
||||
};
|
||||
var cleanupThrottling = function () {
|
||||
throttled = null;
|
||||
isComplete && subscriber.complete();
|
||||
};
|
||||
var startThrottle = function (value) {
|
||||
return (throttled = innerFrom(durationSelector(value)).subscribe(createOperatorSubscriber(subscriber, endThrottling, cleanupThrottling)));
|
||||
};
|
||||
var send = function () {
|
||||
if (hasValue) {
|
||||
hasValue = false;
|
||||
var value = sendValue;
|
||||
sendValue = null;
|
||||
subscriber.next(value);
|
||||
!isComplete && startThrottle(value);
|
||||
}
|
||||
};
|
||||
source.subscribe(createOperatorSubscriber(subscriber, function (value) {
|
||||
hasValue = true;
|
||||
sendValue = value;
|
||||
!(throttled && !throttled.closed) && (leading ? send() : startThrottle(value));
|
||||
}, function () {
|
||||
isComplete = true;
|
||||
!(trailing && hasValue && throttled && !throttled.closed) && subscriber.complete();
|
||||
}));
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=throttle.js.map
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"root": true,
|
||||
|
||||
"extends": "@ljharb",
|
||||
|
||||
"rules": {
|
||||
"new-cap": ["error", {
|
||||
"capIsNewExceptions": [
|
||||
"GetIntrinsic",
|
||||
],
|
||||
}],
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"throwUnobservableError.d.ts","sourceRoot":"","sources":["../../../../src/internal/util/throwUnobservableError.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,gCAAgC,CAAC,KAAK,EAAE,GAAG,aAO1D"}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"J D E F A B CC"},B:{"1":"M N O P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H","260":"C","514":"K L G"},C:{"1":"EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB","2":"0 1 2 3 4 5 6 7 DC tB I v J D E F A B C K L G M N O w g x y z EC FC","194":"8 9 AB BB CB DB"},D:{"1":"EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB GC","2":"0 1 2 3 4 5 6 7 8 9 I v J D E F A B C K L G M N O w g x y z","260":"AB BB CB DB"},E:{"1":"F A B C K L G LC 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC","2":"I v J D HC zB IC JC","260":"E KC"},F:{"1":"1 2 3 4 5 6 7 8 9 AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e","2":"F B C G M N O w g PC QC RC SC qB AC TC rB","260":"0 x y z"},G:{"1":"ZC aC bC cC dC eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B","2":"zB UC BC VC WC XC","260":"E YC"},H:{"2":"oC"},I:{"1":"f","2":"tB I pC qC rC sC BC tC uC"},J:{"2":"D A"},K:{"1":"h","2":"A B C qB AC rB"},L:{"1":"H"},M:{"1":"H"},N:{"2":"A B"},O:{"1":"vC"},P:{"1":"I g wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C"},Q:{"1":"1B"},R:{"1":"9C"},S:{"1":"AD BD"}},B:1,C:"Srcset and sizes attributes"};
|
||||
@@ -0,0 +1,51 @@
|
||||
import os from 'node:os';
|
||||
import macosRelease from 'macos-release';
|
||||
import windowsRelease from 'windows-release';
|
||||
|
||||
export default function osName(platform, release) {
|
||||
if (!platform && release) {
|
||||
throw new Error('You can\'t specify a `release` without specifying `platform`');
|
||||
}
|
||||
|
||||
platform = platform || os.platform();
|
||||
|
||||
let id;
|
||||
|
||||
if (platform === 'darwin') {
|
||||
if (!release && os.platform() === 'darwin') {
|
||||
release = os.release();
|
||||
}
|
||||
|
||||
const prefix = release ? (Number(release.split('.')[0]) > 15 ? 'macOS' : 'OS X') : 'macOS';
|
||||
|
||||
try {
|
||||
id = release ? macosRelease(release).name : '';
|
||||
|
||||
if (id === 'Unknown') {
|
||||
return prefix;
|
||||
}
|
||||
} catch {}
|
||||
|
||||
return prefix + (id ? ' ' + id : '');
|
||||
}
|
||||
|
||||
if (platform === 'linux') {
|
||||
if (!release && os.platform() === 'linux') {
|
||||
release = os.release();
|
||||
}
|
||||
|
||||
id = release ? release.replace(/^(\d+\.\d+).*/, '$1') : '';
|
||||
return 'Linux' + (id ? ' ' + id : '');
|
||||
}
|
||||
|
||||
if (platform === 'win32') {
|
||||
if (!release && os.platform() === 'win32') {
|
||||
release = os.release();
|
||||
}
|
||||
|
||||
id = release ? windowsRelease(release) : '';
|
||||
return 'Windows' + (id ? ' ' + id : '');
|
||||
}
|
||||
|
||||
return platform;
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
# socks examples
|
||||
|
||||
## Example for SOCKS 'bind' command
|
||||
|
||||
The bind command tells the SOCKS proxy server to bind and listen on a new TCP port for an incoming connection. It communicates the newly opened port back to the origin client. Once a incoming connection is accepted by the SOCKS proxy server it then communicates the remote host that connected to the SOCKS proxy back through the same initial connection via the origin client.
|
||||
|
||||
This can be used for things such as FTP clients which require incoming TCP connections, etc.
|
||||
|
||||
**Connection Steps**
|
||||
|
||||
1. Client -(bind)-> Proxy (Tells the proxy to bind to a new port)
|
||||
2. Client <-(port)- Proxy (Tells the origin client which port it opened)
|
||||
3. Client2 --> Proxy (Other client connects to the proxy on this port)
|
||||
4. Client <--(client2's host info) (Proxy tells the origin client who connected to it)
|
||||
5. Original connection to the proxy is now a full TCP stream between client (you) and client2.
|
||||
6. Client <--> Proxy <--> Client2
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
The 'bind' command can only be used by creating a new SocksClient instance and listening for 'bound' and 'established' events.
|
||||
|
||||
|
||||
```typescript
|
||||
const SocksClient = require('socks').SocksClient;
|
||||
|
||||
const options = {
|
||||
proxy: {
|
||||
host: '104.131.124.203',
|
||||
port: 1081,
|
||||
type: 5
|
||||
},
|
||||
|
||||
// This should be the ip and port of the expected client that will connect to the SOCKS proxy server on the newly bound port.
|
||||
// Most SOCKS servers accept 0.0.0.0 as a wildcard address to accept any client.
|
||||
destination: {
|
||||
host: '0.0.0.0',
|
||||
port: 0
|
||||
},
|
||||
|
||||
command: 'bind'
|
||||
};
|
||||
|
||||
const client = new SocksClient(options);
|
||||
|
||||
// This event is fired when the SOCKS server has started listening on a new port for incoming connections.
|
||||
client.on('bound', (info) => {
|
||||
console.log(info);
|
||||
/*
|
||||
{
|
||||
socket: <Socket ...>,
|
||||
remoteHost: { // This is the remote ip and port of the SOCKS proxy that is now accepting incoming connections.
|
||||
host: '104.131.124.203',
|
||||
port: 49928
|
||||
}
|
||||
}
|
||||
*/
|
||||
});
|
||||
|
||||
// This event is fired when the SOCKS server has accepted an incoming connection on the newly bound port.
|
||||
client.on('established', (info) => {
|
||||
console.log(info);
|
||||
/*
|
||||
{
|
||||
socket: <Socket ...>,
|
||||
remoteHost: { // This is the remote ip and port that connected to the SOCKS proxy on the newly bound port.
|
||||
host: '1.2.3.4',
|
||||
port: 58232
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// At this point info.socket is a regular net.Socket TCP connection between client and client2 (1.2.3.4) (the client which connected to the proxy on the newly bound port.)
|
||||
|
||||
console.log(info.socket);
|
||||
// <Socket ...> (this is a raw net.Socket that is established to the destination host through the given proxy servers)
|
||||
});
|
||||
|
||||
// SOCKS proxy failed to bind.
|
||||
client.on('error', () => {
|
||||
// Handle errors
|
||||
});
|
||||
```
|
||||
@@ -0,0 +1,5 @@
|
||||
var convert = require('./convert'),
|
||||
func = convert('divide', require('../divide'));
|
||||
|
||||
func.placeholder = require('./placeholder');
|
||||
module.exports = func;
|
||||
@@ -0,0 +1,8 @@
|
||||
export type CreateParticipant = {
|
||||
firstname: string;
|
||||
middlename?: string;
|
||||
lastname: string;
|
||||
phone?: string;
|
||||
email?: string;
|
||||
address?: any;
|
||||
};
|
||||
@@ -0,0 +1,15 @@
|
||||
'use strict';
|
||||
|
||||
var implementation = require('./implementation');
|
||||
|
||||
module.exports = function getPolyfill() {
|
||||
if (!String.prototype.trimEnd && !String.prototype.trimRight) {
|
||||
return implementation;
|
||||
}
|
||||
var zeroWidthSpace = '\u200b';
|
||||
var trimmed = zeroWidthSpace.trimEnd ? zeroWidthSpace.trimEnd() : zeroWidthSpace.trimRight();
|
||||
if (trimmed !== zeroWidthSpace) {
|
||||
return implementation;
|
||||
}
|
||||
return String.prototype.trimEnd || String.prototype.trimRight;
|
||||
};
|
||||
@@ -0,0 +1,75 @@
|
||||
'use strict';
|
||||
|
||||
var hasSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol';
|
||||
|
||||
var isPrimitive = require('./helpers/isPrimitive');
|
||||
var isCallable = require('is-callable');
|
||||
var isDate = require('is-date-object');
|
||||
var isSymbol = require('is-symbol');
|
||||
|
||||
var ordinaryToPrimitive = function OrdinaryToPrimitive(O, hint) {
|
||||
if (typeof O === 'undefined' || O === null) {
|
||||
throw new TypeError('Cannot call method on ' + O);
|
||||
}
|
||||
if (typeof hint !== 'string' || (hint !== 'number' && hint !== 'string')) {
|
||||
throw new TypeError('hint must be "string" or "number"');
|
||||
}
|
||||
var methodNames = hint === 'string' ? ['toString', 'valueOf'] : ['valueOf', 'toString'];
|
||||
var method, result, i;
|
||||
for (i = 0; i < methodNames.length; ++i) {
|
||||
method = O[methodNames[i]];
|
||||
if (isCallable(method)) {
|
||||
result = method.call(O);
|
||||
if (isPrimitive(result)) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new TypeError('No default value');
|
||||
};
|
||||
|
||||
var GetMethod = function GetMethod(O, P) {
|
||||
var func = O[P];
|
||||
if (func !== null && typeof func !== 'undefined') {
|
||||
if (!isCallable(func)) {
|
||||
throw new TypeError(func + ' returned for property ' + P + ' of object ' + O + ' is not a function');
|
||||
}
|
||||
return func;
|
||||
}
|
||||
return void 0;
|
||||
};
|
||||
|
||||
// http://www.ecma-international.org/ecma-262/6.0/#sec-toprimitive
|
||||
module.exports = function ToPrimitive(input) {
|
||||
if (isPrimitive(input)) {
|
||||
return input;
|
||||
}
|
||||
var hint = 'default';
|
||||
if (arguments.length > 1) {
|
||||
if (arguments[1] === String) {
|
||||
hint = 'string';
|
||||
} else if (arguments[1] === Number) {
|
||||
hint = 'number';
|
||||
}
|
||||
}
|
||||
|
||||
var exoticToPrim;
|
||||
if (hasSymbols) {
|
||||
if (Symbol.toPrimitive) {
|
||||
exoticToPrim = GetMethod(input, Symbol.toPrimitive);
|
||||
} else if (isSymbol(input)) {
|
||||
exoticToPrim = Symbol.prototype.valueOf;
|
||||
}
|
||||
}
|
||||
if (typeof exoticToPrim !== 'undefined') {
|
||||
var result = exoticToPrim.call(input, hint);
|
||||
if (isPrimitive(result)) {
|
||||
return result;
|
||||
}
|
||||
throw new TypeError('unable to convert exotic object to primitive');
|
||||
}
|
||||
if (hint === 'default' && (isDate(input) || isSymbol(input))) {
|
||||
hint = 'string';
|
||||
}
|
||||
return ordinaryToPrimitive(input, hint === 'default' ? 'number' : hint);
|
||||
};
|
||||
@@ -0,0 +1,42 @@
|
||||
import { readJSON } from './util.js';
|
||||
import Log from './log.js';
|
||||
import runTasks from './index.js';
|
||||
|
||||
const pkg = readJSON(new URL('../package.json', import.meta.url));
|
||||
|
||||
const log = new Log();
|
||||
|
||||
const helpText = `Release It! v${pkg.version}
|
||||
|
||||
Usage: release-it <increment> [options]
|
||||
|
||||
Use e.g. "release-it minor" directly as shorthand for "release-it --increment=minor".
|
||||
|
||||
-c --config Path to local configuration options [default: ".release-it.json"]
|
||||
-d --dry-run Do not touch or write anything, but show the commands
|
||||
-h --help Print this help
|
||||
-i --increment Increment "major", "minor", "patch", or "pre*" version; or specify version [default: "patch"]
|
||||
--ci No prompts, no user interaction; activated automatically in CI environments
|
||||
--only-version Prompt only for version, no further interaction
|
||||
-v --version Print release-it version number
|
||||
--release-version Print version number to be released
|
||||
--changelog Print changelog for the version to be released
|
||||
-V --verbose Verbose output (user hooks output)
|
||||
-VV Extra verbose output (also internal commands output)
|
||||
|
||||
For more details, please see https://github.com/release-it/release-it`;
|
||||
|
||||
export let version = () => log.log(`v${pkg.version}`);
|
||||
|
||||
export let help = () => log.log(helpText);
|
||||
|
||||
export default async options => {
|
||||
if (options.version) {
|
||||
version();
|
||||
} else if (options.help) {
|
||||
help();
|
||||
} else {
|
||||
return runTasks(options);
|
||||
}
|
||||
return Promise.resolve();
|
||||
};
|
||||
@@ -0,0 +1,37 @@
|
||||
import { Subject } from '../Subject';
|
||||
import { Subscription } from '../Subscription';
|
||||
import { SubscriptionLoggable } from './SubscriptionLoggable';
|
||||
import { applyMixins } from '../util/applyMixins';
|
||||
import { observeNotification } from '../Notification';
|
||||
export class HotObservable extends Subject {
|
||||
constructor(messages, scheduler) {
|
||||
super();
|
||||
this.messages = messages;
|
||||
this.subscriptions = [];
|
||||
this.scheduler = scheduler;
|
||||
}
|
||||
_subscribe(subscriber) {
|
||||
const subject = this;
|
||||
const index = subject.logSubscribedFrame();
|
||||
const subscription = new Subscription();
|
||||
subscription.add(new Subscription(() => {
|
||||
subject.logUnsubscribedFrame(index);
|
||||
}));
|
||||
subscription.add(super._subscribe(subscriber));
|
||||
return subscription;
|
||||
}
|
||||
setup() {
|
||||
const subject = this;
|
||||
const messagesLength = subject.messages.length;
|
||||
for (let i = 0; i < messagesLength; i++) {
|
||||
(() => {
|
||||
const { notification, frame } = subject.messages[i];
|
||||
subject.scheduler.schedule(() => {
|
||||
observeNotification(notification, subject);
|
||||
}, frame);
|
||||
})();
|
||||
}
|
||||
}
|
||||
}
|
||||
applyMixins(HotObservable, [SubscriptionLoggable]);
|
||||
//# sourceMappingURL=HotObservable.js.map
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"1":"F A B","16":"CC","132":"J D E"},B:{"1":"C K L G M N O P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H"},C:{"1":"0 1 2 3 4 5 6 7 8 9 DC tB I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB EC FC"},D:{"1":"6 7 8 9 AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB GC","132":"0 1 2 3 4 5 I v J D E F A B C K L G M N O w g x y z"},E:{"1":"D E F A B C K L G JC KC LC 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC","16":"HC","132":"I v J zB IC"},F:{"1":"0 1 2 3 4 5 6 7 8 9 N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e","16":"F PC","132":"B C G M QC RC SC qB AC TC rB"},G:{"1":"E UC BC VC WC XC YC ZC aC bC cC dC eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B","16":"zB"},H:{"2":"oC"},I:{"1":"f tC uC","16":"pC qC","132":"tB I rC sC BC"},J:{"132":"D A"},K:{"1":"h","132":"A B C qB AC rB"},L:{"1":"H"},M:{"1":"H"},N:{"1":"A B"},O:{"1":"vC"},P:{"1":"I g wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C"},Q:{"1":"1B"},R:{"1":"9C"},S:{"1":"AD BD"}},B:2,C:"letter-spacing CSS property"};
|
||||
@@ -0,0 +1,555 @@
|
||||
"use strict";
|
||||
var Buffer = require("safer-buffer").Buffer;
|
||||
|
||||
// Multibyte codec. In this scheme, a character is represented by 1 or more bytes.
|
||||
// Our codec supports UTF-16 surrogates, extensions for GB18030 and unicode sequences.
|
||||
// To save memory and loading time, we read table files only when requested.
|
||||
|
||||
exports._dbcs = DBCSCodec;
|
||||
|
||||
var UNASSIGNED = -1,
|
||||
GB18030_CODE = -2,
|
||||
SEQ_START = -10,
|
||||
NODE_START = -1000,
|
||||
UNASSIGNED_NODE = new Array(0x100),
|
||||
DEF_CHAR = -1;
|
||||
|
||||
for (var i = 0; i < 0x100; i++)
|
||||
UNASSIGNED_NODE[i] = UNASSIGNED;
|
||||
|
||||
|
||||
// Class DBCSCodec reads and initializes mapping tables.
|
||||
function DBCSCodec(codecOptions, iconv) {
|
||||
this.encodingName = codecOptions.encodingName;
|
||||
if (!codecOptions)
|
||||
throw new Error("DBCS codec is called without the data.")
|
||||
if (!codecOptions.table)
|
||||
throw new Error("Encoding '" + this.encodingName + "' has no data.");
|
||||
|
||||
// Load tables.
|
||||
var mappingTable = codecOptions.table();
|
||||
|
||||
|
||||
// Decode tables: MBCS -> Unicode.
|
||||
|
||||
// decodeTables is a trie, encoded as an array of arrays of integers. Internal arrays are trie nodes and all have len = 256.
|
||||
// Trie root is decodeTables[0].
|
||||
// Values: >= 0 -> unicode character code. can be > 0xFFFF
|
||||
// == UNASSIGNED -> unknown/unassigned sequence.
|
||||
// == GB18030_CODE -> this is the end of a GB18030 4-byte sequence.
|
||||
// <= NODE_START -> index of the next node in our trie to process next byte.
|
||||
// <= SEQ_START -> index of the start of a character code sequence, in decodeTableSeq.
|
||||
this.decodeTables = [];
|
||||
this.decodeTables[0] = UNASSIGNED_NODE.slice(0); // Create root node.
|
||||
|
||||
// Sometimes a MBCS char corresponds to a sequence of unicode chars. We store them as arrays of integers here.
|
||||
this.decodeTableSeq = [];
|
||||
|
||||
// Actual mapping tables consist of chunks. Use them to fill up decode tables.
|
||||
for (var i = 0; i < mappingTable.length; i++)
|
||||
this._addDecodeChunk(mappingTable[i]);
|
||||
|
||||
this.defaultCharUnicode = iconv.defaultCharUnicode;
|
||||
|
||||
|
||||
// Encode tables: Unicode -> DBCS.
|
||||
|
||||
// `encodeTable` is array mapping from unicode char to encoded char. All its values are integers for performance.
|
||||
// Because it can be sparse, it is represented as array of buckets by 256 chars each. Bucket can be null.
|
||||
// Values: >= 0 -> it is a normal char. Write the value (if <=256 then 1 byte, if <=65536 then 2 bytes, etc.).
|
||||
// == UNASSIGNED -> no conversion found. Output a default char.
|
||||
// <= SEQ_START -> it's an index in encodeTableSeq, see below. The character starts a sequence.
|
||||
this.encodeTable = [];
|
||||
|
||||
// `encodeTableSeq` is used when a sequence of unicode characters is encoded as a single code. We use a tree of
|
||||
// objects where keys correspond to characters in sequence and leafs are the encoded dbcs values. A special DEF_CHAR key
|
||||
// means end of sequence (needed when one sequence is a strict subsequence of another).
|
||||
// Objects are kept separately from encodeTable to increase performance.
|
||||
this.encodeTableSeq = [];
|
||||
|
||||
// Some chars can be decoded, but need not be encoded.
|
||||
var skipEncodeChars = {};
|
||||
if (codecOptions.encodeSkipVals)
|
||||
for (var i = 0; i < codecOptions.encodeSkipVals.length; i++) {
|
||||
var val = codecOptions.encodeSkipVals[i];
|
||||
if (typeof val === 'number')
|
||||
skipEncodeChars[val] = true;
|
||||
else
|
||||
for (var j = val.from; j <= val.to; j++)
|
||||
skipEncodeChars[j] = true;
|
||||
}
|
||||
|
||||
// Use decode trie to recursively fill out encode tables.
|
||||
this._fillEncodeTable(0, 0, skipEncodeChars);
|
||||
|
||||
// Add more encoding pairs when needed.
|
||||
if (codecOptions.encodeAdd) {
|
||||
for (var uChar in codecOptions.encodeAdd)
|
||||
if (Object.prototype.hasOwnProperty.call(codecOptions.encodeAdd, uChar))
|
||||
this._setEncodeChar(uChar.charCodeAt(0), codecOptions.encodeAdd[uChar]);
|
||||
}
|
||||
|
||||
this.defCharSB = this.encodeTable[0][iconv.defaultCharSingleByte.charCodeAt(0)];
|
||||
if (this.defCharSB === UNASSIGNED) this.defCharSB = this.encodeTable[0]['?'];
|
||||
if (this.defCharSB === UNASSIGNED) this.defCharSB = "?".charCodeAt(0);
|
||||
|
||||
|
||||
// Load & create GB18030 tables when needed.
|
||||
if (typeof codecOptions.gb18030 === 'function') {
|
||||
this.gb18030 = codecOptions.gb18030(); // Load GB18030 ranges.
|
||||
|
||||
// Add GB18030 decode tables.
|
||||
var thirdByteNodeIdx = this.decodeTables.length;
|
||||
var thirdByteNode = this.decodeTables[thirdByteNodeIdx] = UNASSIGNED_NODE.slice(0);
|
||||
|
||||
var fourthByteNodeIdx = this.decodeTables.length;
|
||||
var fourthByteNode = this.decodeTables[fourthByteNodeIdx] = UNASSIGNED_NODE.slice(0);
|
||||
|
||||
for (var i = 0x81; i <= 0xFE; i++) {
|
||||
var secondByteNodeIdx = NODE_START - this.decodeTables[0][i];
|
||||
var secondByteNode = this.decodeTables[secondByteNodeIdx];
|
||||
for (var j = 0x30; j <= 0x39; j++)
|
||||
secondByteNode[j] = NODE_START - thirdByteNodeIdx;
|
||||
}
|
||||
for (var i = 0x81; i <= 0xFE; i++)
|
||||
thirdByteNode[i] = NODE_START - fourthByteNodeIdx;
|
||||
for (var i = 0x30; i <= 0x39; i++)
|
||||
fourthByteNode[i] = GB18030_CODE
|
||||
}
|
||||
}
|
||||
|
||||
DBCSCodec.prototype.encoder = DBCSEncoder;
|
||||
DBCSCodec.prototype.decoder = DBCSDecoder;
|
||||
|
||||
// Decoder helpers
|
||||
DBCSCodec.prototype._getDecodeTrieNode = function(addr) {
|
||||
var bytes = [];
|
||||
for (; addr > 0; addr >>= 8)
|
||||
bytes.push(addr & 0xFF);
|
||||
if (bytes.length == 0)
|
||||
bytes.push(0);
|
||||
|
||||
var node = this.decodeTables[0];
|
||||
for (var i = bytes.length-1; i > 0; i--) { // Traverse nodes deeper into the trie.
|
||||
var val = node[bytes[i]];
|
||||
|
||||
if (val == UNASSIGNED) { // Create new node.
|
||||
node[bytes[i]] = NODE_START - this.decodeTables.length;
|
||||
this.decodeTables.push(node = UNASSIGNED_NODE.slice(0));
|
||||
}
|
||||
else if (val <= NODE_START) { // Existing node.
|
||||
node = this.decodeTables[NODE_START - val];
|
||||
}
|
||||
else
|
||||
throw new Error("Overwrite byte in " + this.encodingName + ", addr: " + addr.toString(16));
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
|
||||
DBCSCodec.prototype._addDecodeChunk = function(chunk) {
|
||||
// First element of chunk is the hex mbcs code where we start.
|
||||
var curAddr = parseInt(chunk[0], 16);
|
||||
|
||||
// Choose the decoding node where we'll write our chars.
|
||||
var writeTable = this._getDecodeTrieNode(curAddr);
|
||||
curAddr = curAddr & 0xFF;
|
||||
|
||||
// Write all other elements of the chunk to the table.
|
||||
for (var k = 1; k < chunk.length; k++) {
|
||||
var part = chunk[k];
|
||||
if (typeof part === "string") { // String, write as-is.
|
||||
for (var l = 0; l < part.length;) {
|
||||
var code = part.charCodeAt(l++);
|
||||
if (0xD800 <= code && code < 0xDC00) { // Decode surrogate
|
||||
var codeTrail = part.charCodeAt(l++);
|
||||
if (0xDC00 <= codeTrail && codeTrail < 0xE000)
|
||||
writeTable[curAddr++] = 0x10000 + (code - 0xD800) * 0x400 + (codeTrail - 0xDC00);
|
||||
else
|
||||
throw new Error("Incorrect surrogate pair in " + this.encodingName + " at chunk " + chunk[0]);
|
||||
}
|
||||
else if (0x0FF0 < code && code <= 0x0FFF) { // Character sequence (our own encoding used)
|
||||
var len = 0xFFF - code + 2;
|
||||
var seq = [];
|
||||
for (var m = 0; m < len; m++)
|
||||
seq.push(part.charCodeAt(l++)); // Simple variation: don't support surrogates or subsequences in seq.
|
||||
|
||||
writeTable[curAddr++] = SEQ_START - this.decodeTableSeq.length;
|
||||
this.decodeTableSeq.push(seq);
|
||||
}
|
||||
else
|
||||
writeTable[curAddr++] = code; // Basic char
|
||||
}
|
||||
}
|
||||
else if (typeof part === "number") { // Integer, meaning increasing sequence starting with prev character.
|
||||
var charCode = writeTable[curAddr - 1] + 1;
|
||||
for (var l = 0; l < part; l++)
|
||||
writeTable[curAddr++] = charCode++;
|
||||
}
|
||||
else
|
||||
throw new Error("Incorrect type '" + typeof part + "' given in " + this.encodingName + " at chunk " + chunk[0]);
|
||||
}
|
||||
if (curAddr > 0xFF)
|
||||
throw new Error("Incorrect chunk in " + this.encodingName + " at addr " + chunk[0] + ": too long" + curAddr);
|
||||
}
|
||||
|
||||
// Encoder helpers
|
||||
DBCSCodec.prototype._getEncodeBucket = function(uCode) {
|
||||
var high = uCode >> 8; // This could be > 0xFF because of astral characters.
|
||||
if (this.encodeTable[high] === undefined)
|
||||
this.encodeTable[high] = UNASSIGNED_NODE.slice(0); // Create bucket on demand.
|
||||
return this.encodeTable[high];
|
||||
}
|
||||
|
||||
DBCSCodec.prototype._setEncodeChar = function(uCode, dbcsCode) {
|
||||
var bucket = this._getEncodeBucket(uCode);
|
||||
var low = uCode & 0xFF;
|
||||
if (bucket[low] <= SEQ_START)
|
||||
this.encodeTableSeq[SEQ_START-bucket[low]][DEF_CHAR] = dbcsCode; // There's already a sequence, set a single-char subsequence of it.
|
||||
else if (bucket[low] == UNASSIGNED)
|
||||
bucket[low] = dbcsCode;
|
||||
}
|
||||
|
||||
DBCSCodec.prototype._setEncodeSequence = function(seq, dbcsCode) {
|
||||
|
||||
// Get the root of character tree according to first character of the sequence.
|
||||
var uCode = seq[0];
|
||||
var bucket = this._getEncodeBucket(uCode);
|
||||
var low = uCode & 0xFF;
|
||||
|
||||
var node;
|
||||
if (bucket[low] <= SEQ_START) {
|
||||
// There's already a sequence with - use it.
|
||||
node = this.encodeTableSeq[SEQ_START-bucket[low]];
|
||||
}
|
||||
else {
|
||||
// There was no sequence object - allocate a new one.
|
||||
node = {};
|
||||
if (bucket[low] !== UNASSIGNED) node[DEF_CHAR] = bucket[low]; // If a char was set before - make it a single-char subsequence.
|
||||
bucket[low] = SEQ_START - this.encodeTableSeq.length;
|
||||
this.encodeTableSeq.push(node);
|
||||
}
|
||||
|
||||
// Traverse the character tree, allocating new nodes as needed.
|
||||
for (var j = 1; j < seq.length-1; j++) {
|
||||
var oldVal = node[uCode];
|
||||
if (typeof oldVal === 'object')
|
||||
node = oldVal;
|
||||
else {
|
||||
node = node[uCode] = {}
|
||||
if (oldVal !== undefined)
|
||||
node[DEF_CHAR] = oldVal
|
||||
}
|
||||
}
|
||||
|
||||
// Set the leaf to given dbcsCode.
|
||||
uCode = seq[seq.length-1];
|
||||
node[uCode] = dbcsCode;
|
||||
}
|
||||
|
||||
DBCSCodec.prototype._fillEncodeTable = function(nodeIdx, prefix, skipEncodeChars) {
|
||||
var node = this.decodeTables[nodeIdx];
|
||||
for (var i = 0; i < 0x100; i++) {
|
||||
var uCode = node[i];
|
||||
var mbCode = prefix + i;
|
||||
if (skipEncodeChars[mbCode])
|
||||
continue;
|
||||
|
||||
if (uCode >= 0)
|
||||
this._setEncodeChar(uCode, mbCode);
|
||||
else if (uCode <= NODE_START)
|
||||
this._fillEncodeTable(NODE_START - uCode, mbCode << 8, skipEncodeChars);
|
||||
else if (uCode <= SEQ_START)
|
||||
this._setEncodeSequence(this.decodeTableSeq[SEQ_START - uCode], mbCode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// == Encoder ==================================================================
|
||||
|
||||
function DBCSEncoder(options, codec) {
|
||||
// Encoder state
|
||||
this.leadSurrogate = -1;
|
||||
this.seqObj = undefined;
|
||||
|
||||
// Static data
|
||||
this.encodeTable = codec.encodeTable;
|
||||
this.encodeTableSeq = codec.encodeTableSeq;
|
||||
this.defaultCharSingleByte = codec.defCharSB;
|
||||
this.gb18030 = codec.gb18030;
|
||||
}
|
||||
|
||||
DBCSEncoder.prototype.write = function(str) {
|
||||
var newBuf = Buffer.alloc(str.length * (this.gb18030 ? 4 : 3)),
|
||||
leadSurrogate = this.leadSurrogate,
|
||||
seqObj = this.seqObj, nextChar = -1,
|
||||
i = 0, j = 0;
|
||||
|
||||
while (true) {
|
||||
// 0. Get next character.
|
||||
if (nextChar === -1) {
|
||||
if (i == str.length) break;
|
||||
var uCode = str.charCodeAt(i++);
|
||||
}
|
||||
else {
|
||||
var uCode = nextChar;
|
||||
nextChar = -1;
|
||||
}
|
||||
|
||||
// 1. Handle surrogates.
|
||||
if (0xD800 <= uCode && uCode < 0xE000) { // Char is one of surrogates.
|
||||
if (uCode < 0xDC00) { // We've got lead surrogate.
|
||||
if (leadSurrogate === -1) {
|
||||
leadSurrogate = uCode;
|
||||
continue;
|
||||
} else {
|
||||
leadSurrogate = uCode;
|
||||
// Double lead surrogate found.
|
||||
uCode = UNASSIGNED;
|
||||
}
|
||||
} else { // We've got trail surrogate.
|
||||
if (leadSurrogate !== -1) {
|
||||
uCode = 0x10000 + (leadSurrogate - 0xD800) * 0x400 + (uCode - 0xDC00);
|
||||
leadSurrogate = -1;
|
||||
} else {
|
||||
// Incomplete surrogate pair - only trail surrogate found.
|
||||
uCode = UNASSIGNED;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else if (leadSurrogate !== -1) {
|
||||
// Incomplete surrogate pair - only lead surrogate found.
|
||||
nextChar = uCode; uCode = UNASSIGNED; // Write an error, then current char.
|
||||
leadSurrogate = -1;
|
||||
}
|
||||
|
||||
// 2. Convert uCode character.
|
||||
var dbcsCode = UNASSIGNED;
|
||||
if (seqObj !== undefined && uCode != UNASSIGNED) { // We are in the middle of the sequence
|
||||
var resCode = seqObj[uCode];
|
||||
if (typeof resCode === 'object') { // Sequence continues.
|
||||
seqObj = resCode;
|
||||
continue;
|
||||
|
||||
} else if (typeof resCode == 'number') { // Sequence finished. Write it.
|
||||
dbcsCode = resCode;
|
||||
|
||||
} else if (resCode == undefined) { // Current character is not part of the sequence.
|
||||
|
||||
// Try default character for this sequence
|
||||
resCode = seqObj[DEF_CHAR];
|
||||
if (resCode !== undefined) {
|
||||
dbcsCode = resCode; // Found. Write it.
|
||||
nextChar = uCode; // Current character will be written too in the next iteration.
|
||||
|
||||
} else {
|
||||
// TODO: What if we have no default? (resCode == undefined)
|
||||
// Then, we should write first char of the sequence as-is and try the rest recursively.
|
||||
// Didn't do it for now because no encoding has this situation yet.
|
||||
// Currently, just skip the sequence and write current char.
|
||||
}
|
||||
}
|
||||
seqObj = undefined;
|
||||
}
|
||||
else if (uCode >= 0) { // Regular character
|
||||
var subtable = this.encodeTable[uCode >> 8];
|
||||
if (subtable !== undefined)
|
||||
dbcsCode = subtable[uCode & 0xFF];
|
||||
|
||||
if (dbcsCode <= SEQ_START) { // Sequence start
|
||||
seqObj = this.encodeTableSeq[SEQ_START-dbcsCode];
|
||||
continue;
|
||||
}
|
||||
|
||||
if (dbcsCode == UNASSIGNED && this.gb18030) {
|
||||
// Use GB18030 algorithm to find character(s) to write.
|
||||
var idx = findIdx(this.gb18030.uChars, uCode);
|
||||
if (idx != -1) {
|
||||
var dbcsCode = this.gb18030.gbChars[idx] + (uCode - this.gb18030.uChars[idx]);
|
||||
newBuf[j++] = 0x81 + Math.floor(dbcsCode / 12600); dbcsCode = dbcsCode % 12600;
|
||||
newBuf[j++] = 0x30 + Math.floor(dbcsCode / 1260); dbcsCode = dbcsCode % 1260;
|
||||
newBuf[j++] = 0x81 + Math.floor(dbcsCode / 10); dbcsCode = dbcsCode % 10;
|
||||
newBuf[j++] = 0x30 + dbcsCode;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 3. Write dbcsCode character.
|
||||
if (dbcsCode === UNASSIGNED)
|
||||
dbcsCode = this.defaultCharSingleByte;
|
||||
|
||||
if (dbcsCode < 0x100) {
|
||||
newBuf[j++] = dbcsCode;
|
||||
}
|
||||
else if (dbcsCode < 0x10000) {
|
||||
newBuf[j++] = dbcsCode >> 8; // high byte
|
||||
newBuf[j++] = dbcsCode & 0xFF; // low byte
|
||||
}
|
||||
else {
|
||||
newBuf[j++] = dbcsCode >> 16;
|
||||
newBuf[j++] = (dbcsCode >> 8) & 0xFF;
|
||||
newBuf[j++] = dbcsCode & 0xFF;
|
||||
}
|
||||
}
|
||||
|
||||
this.seqObj = seqObj;
|
||||
this.leadSurrogate = leadSurrogate;
|
||||
return newBuf.slice(0, j);
|
||||
}
|
||||
|
||||
DBCSEncoder.prototype.end = function() {
|
||||
if (this.leadSurrogate === -1 && this.seqObj === undefined)
|
||||
return; // All clean. Most often case.
|
||||
|
||||
var newBuf = Buffer.alloc(10), j = 0;
|
||||
|
||||
if (this.seqObj) { // We're in the sequence.
|
||||
var dbcsCode = this.seqObj[DEF_CHAR];
|
||||
if (dbcsCode !== undefined) { // Write beginning of the sequence.
|
||||
if (dbcsCode < 0x100) {
|
||||
newBuf[j++] = dbcsCode;
|
||||
}
|
||||
else {
|
||||
newBuf[j++] = dbcsCode >> 8; // high byte
|
||||
newBuf[j++] = dbcsCode & 0xFF; // low byte
|
||||
}
|
||||
} else {
|
||||
// See todo above.
|
||||
}
|
||||
this.seqObj = undefined;
|
||||
}
|
||||
|
||||
if (this.leadSurrogate !== -1) {
|
||||
// Incomplete surrogate pair - only lead surrogate found.
|
||||
newBuf[j++] = this.defaultCharSingleByte;
|
||||
this.leadSurrogate = -1;
|
||||
}
|
||||
|
||||
return newBuf.slice(0, j);
|
||||
}
|
||||
|
||||
// Export for testing
|
||||
DBCSEncoder.prototype.findIdx = findIdx;
|
||||
|
||||
|
||||
// == Decoder ==================================================================
|
||||
|
||||
function DBCSDecoder(options, codec) {
|
||||
// Decoder state
|
||||
this.nodeIdx = 0;
|
||||
this.prevBuf = Buffer.alloc(0);
|
||||
|
||||
// Static data
|
||||
this.decodeTables = codec.decodeTables;
|
||||
this.decodeTableSeq = codec.decodeTableSeq;
|
||||
this.defaultCharUnicode = codec.defaultCharUnicode;
|
||||
this.gb18030 = codec.gb18030;
|
||||
}
|
||||
|
||||
DBCSDecoder.prototype.write = function(buf) {
|
||||
var newBuf = Buffer.alloc(buf.length*2),
|
||||
nodeIdx = this.nodeIdx,
|
||||
prevBuf = this.prevBuf, prevBufOffset = this.prevBuf.length,
|
||||
seqStart = -this.prevBuf.length, // idx of the start of current parsed sequence.
|
||||
uCode;
|
||||
|
||||
if (prevBufOffset > 0) // Make prev buf overlap a little to make it easier to slice later.
|
||||
prevBuf = Buffer.concat([prevBuf, buf.slice(0, 10)]);
|
||||
|
||||
for (var i = 0, j = 0; i < buf.length; i++) {
|
||||
var curByte = (i >= 0) ? buf[i] : prevBuf[i + prevBufOffset];
|
||||
|
||||
// Lookup in current trie node.
|
||||
var uCode = this.decodeTables[nodeIdx][curByte];
|
||||
|
||||
if (uCode >= 0) {
|
||||
// Normal character, just use it.
|
||||
}
|
||||
else if (uCode === UNASSIGNED) { // Unknown char.
|
||||
// TODO: Callback with seq.
|
||||
//var curSeq = (seqStart >= 0) ? buf.slice(seqStart, i+1) : prevBuf.slice(seqStart + prevBufOffset, i+1 + prevBufOffset);
|
||||
i = seqStart; // Try to parse again, after skipping first byte of the sequence ('i' will be incremented by 'for' cycle).
|
||||
uCode = this.defaultCharUnicode.charCodeAt(0);
|
||||
}
|
||||
else if (uCode === GB18030_CODE) {
|
||||
var curSeq = (seqStart >= 0) ? buf.slice(seqStart, i+1) : prevBuf.slice(seqStart + prevBufOffset, i+1 + prevBufOffset);
|
||||
var ptr = (curSeq[0]-0x81)*12600 + (curSeq[1]-0x30)*1260 + (curSeq[2]-0x81)*10 + (curSeq[3]-0x30);
|
||||
var idx = findIdx(this.gb18030.gbChars, ptr);
|
||||
uCode = this.gb18030.uChars[idx] + ptr - this.gb18030.gbChars[idx];
|
||||
}
|
||||
else if (uCode <= NODE_START) { // Go to next trie node.
|
||||
nodeIdx = NODE_START - uCode;
|
||||
continue;
|
||||
}
|
||||
else if (uCode <= SEQ_START) { // Output a sequence of chars.
|
||||
var seq = this.decodeTableSeq[SEQ_START - uCode];
|
||||
for (var k = 0; k < seq.length - 1; k++) {
|
||||
uCode = seq[k];
|
||||
newBuf[j++] = uCode & 0xFF;
|
||||
newBuf[j++] = uCode >> 8;
|
||||
}
|
||||
uCode = seq[seq.length-1];
|
||||
}
|
||||
else
|
||||
throw new Error("iconv-lite internal error: invalid decoding table value " + uCode + " at " + nodeIdx + "/" + curByte);
|
||||
|
||||
// Write the character to buffer, handling higher planes using surrogate pair.
|
||||
if (uCode > 0xFFFF) {
|
||||
uCode -= 0x10000;
|
||||
var uCodeLead = 0xD800 + Math.floor(uCode / 0x400);
|
||||
newBuf[j++] = uCodeLead & 0xFF;
|
||||
newBuf[j++] = uCodeLead >> 8;
|
||||
|
||||
uCode = 0xDC00 + uCode % 0x400;
|
||||
}
|
||||
newBuf[j++] = uCode & 0xFF;
|
||||
newBuf[j++] = uCode >> 8;
|
||||
|
||||
// Reset trie node.
|
||||
nodeIdx = 0; seqStart = i+1;
|
||||
}
|
||||
|
||||
this.nodeIdx = nodeIdx;
|
||||
this.prevBuf = (seqStart >= 0) ? buf.slice(seqStart) : prevBuf.slice(seqStart + prevBufOffset);
|
||||
return newBuf.slice(0, j).toString('ucs2');
|
||||
}
|
||||
|
||||
DBCSDecoder.prototype.end = function() {
|
||||
var ret = '';
|
||||
|
||||
// Try to parse all remaining chars.
|
||||
while (this.prevBuf.length > 0) {
|
||||
// Skip 1 character in the buffer.
|
||||
ret += this.defaultCharUnicode;
|
||||
var buf = this.prevBuf.slice(1);
|
||||
|
||||
// Parse remaining as usual.
|
||||
this.prevBuf = Buffer.alloc(0);
|
||||
this.nodeIdx = 0;
|
||||
if (buf.length > 0)
|
||||
ret += this.write(buf);
|
||||
}
|
||||
|
||||
this.nodeIdx = 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Binary search for GB18030. Returns largest i such that table[i] <= val.
|
||||
function findIdx(table, val) {
|
||||
if (table[0] > val)
|
||||
return -1;
|
||||
|
||||
var l = 0, r = table.length;
|
||||
while (l < r-1) { // always table[l] <= val < table[r]
|
||||
var mid = l + Math.floor((r-l+1)/2);
|
||||
if (table[mid] <= val)
|
||||
l = mid;
|
||||
else
|
||||
r = mid;
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
var baseRest = require('./_baseRest'),
|
||||
pullAll = require('./pullAll');
|
||||
|
||||
/**
|
||||
* Removes all given values from `array` using
|
||||
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
||||
* for equality comparisons.
|
||||
*
|
||||
* **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
|
||||
* to remove elements from an array by predicate.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 2.0.0
|
||||
* @category Array
|
||||
* @param {Array} array The array to modify.
|
||||
* @param {...*} [values] The values to remove.
|
||||
* @returns {Array} Returns `array`.
|
||||
* @example
|
||||
*
|
||||
* var array = ['a', 'b', 'c', 'a', 'b', 'c'];
|
||||
*
|
||||
* _.pull(array, 'a', 'c');
|
||||
* console.log(array);
|
||||
* // => ['b', 'b']
|
||||
*/
|
||||
var pull = baseRest(pullAll);
|
||||
|
||||
module.exports = pull;
|
||||
@@ -0,0 +1,5 @@
|
||||
var convert = require('./convert'),
|
||||
func = convert('indexOfFrom', require('../indexOf'));
|
||||
|
||||
func.placeholder = require('./placeholder');
|
||||
module.exports = func;
|
||||
@@ -0,0 +1,70 @@
|
||||
# has-flag [](https://travis-ci.org/sindresorhus/has-flag)
|
||||
|
||||
> Check if [`argv`](https://nodejs.org/docs/latest/api/process.html#process_process_argv) has a specific flag
|
||||
|
||||
Correctly stops looking after an `--` argument terminator.
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install has-flag
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
// foo.js
|
||||
const hasFlag = require('has-flag');
|
||||
|
||||
hasFlag('unicorn');
|
||||
//=> true
|
||||
|
||||
hasFlag('--unicorn');
|
||||
//=> true
|
||||
|
||||
hasFlag('f');
|
||||
//=> true
|
||||
|
||||
hasFlag('-f');
|
||||
//=> true
|
||||
|
||||
hasFlag('foo=bar');
|
||||
//=> true
|
||||
|
||||
hasFlag('foo');
|
||||
//=> false
|
||||
|
||||
hasFlag('rainbow');
|
||||
//=> false
|
||||
```
|
||||
|
||||
```
|
||||
$ node foo.js -f --unicorn --foo=bar -- --rainbow
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### hasFlag(flag, [argv])
|
||||
|
||||
Returns a boolean for whether the flag exists.
|
||||
|
||||
#### flag
|
||||
|
||||
Type: `string`
|
||||
|
||||
CLI flag to look for. The `--` prefix is optional.
|
||||
|
||||
#### argv
|
||||
|
||||
Type: `string[]`<br>
|
||||
Default: `process.argv`
|
||||
|
||||
CLI arguments.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"name": "is-wsl",
|
||||
"version": "2.2.0",
|
||||
"description": "Check if the process is running inside Windows Subsystem for Linux (Bash on Windows)",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/is-wsl",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"check",
|
||||
"wsl",
|
||||
"windows",
|
||||
"subsystem",
|
||||
"linux",
|
||||
"detect",
|
||||
"bash",
|
||||
"process",
|
||||
"console",
|
||||
"terminal",
|
||||
"is"
|
||||
],
|
||||
"dependencies": {
|
||||
"is-docker": "^2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^1.4.1",
|
||||
"clear-module": "^3.2.0",
|
||||
"proxyquire": "^2.1.0",
|
||||
"tsd": "^0.7.2",
|
||||
"xo": "^0.24.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import { operate } from '../util/lift';
|
||||
import { createOperatorSubscriber } from './OperatorSubscriber';
|
||||
export function pairwise() {
|
||||
return operate((source, subscriber) => {
|
||||
let prev;
|
||||
let hasPrev = false;
|
||||
source.subscribe(createOperatorSubscriber(subscriber, (value) => {
|
||||
const p = prev;
|
||||
prev = value;
|
||||
hasPrev && subscriber.next([p, value]);
|
||||
hasPrev = true;
|
||||
}));
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=pairwise.js.map
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "eastasianwidth",
|
||||
"version": "0.2.0",
|
||||
"description": "Get East Asian Width from a character.",
|
||||
"main": "eastasianwidth.js",
|
||||
"files": [
|
||||
"eastasianwidth.js"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"repository": "git://github.com/komagata/eastasianwidth.git",
|
||||
"author": "Masaki Komagata",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"mocha": "~1.9.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,201 @@
|
||||
name dob address.street address.city address.country guid
|
||||
Edward 09-26-15 155-5699 Lobortis, Street Sauveni<6E>re Guinea 7DEC987B-CD15-2967-BB88-98A9DE869AC2
|
||||
Jason 12-24-14 Ap #394-4852 Lorem, Rd. Barchi Niger F8A268A9-70F9-8298-CADA-22E29CC973E9
|
||||
Colin 04-15-15 Ap #738-1831 Pretium Avenue Lafayette Tuvalu 99C2A67A-82FD-4FD2-B13D-41021A93CD34
|
||||
Ulric 07-13-15 335-3099 Cum St. Aix-en-Provence Mozambique 59844D4F-FB53-E903-67C4-7B0DCA451420
|
||||
Vance 11-08-15 Ap #805-4137 Nulla Road Ligney South Sudan CB3B9B77-12C0-1D8D-96AF-982CFBDC04D8
|
||||
Mason 06-06-15 Ap #750-6911 Aliquam St. Maisi<73>res Benin D5E21534-EF42-0C7C-5761-8D55A418F78C
|
||||
Jesse 08-04-15 P.O. Box 371, 2374 Malesuada Ave Aschersleben Pitcairn Islands FFB87D4C-C25B-8B2A-C65D-0C0CF04ECD19
|
||||
Xenos 01-08-15 P.O. Box 302, 9020 Sed Avenue Ancaster Town Guam 5ACC0483-30D0-194F-8E0A-F2BB9CB7E41C
|
||||
Dalton 04-10-15 Ap #987-4193 Suspendisse Street Bromyard United States E0DE1186-15BD-025A-425E-5A551CB66FCA
|
||||
Maxwell 01-03-15 P.O. Box 297, 2759 Per Avenue Rae-Edzo Namibia 5E880371-EB39-D705-B6BA-B1C47A0FB20F
|
||||
Josiah 12-29-15 481-4517 Justo. Rd. Vreren Ethiopia 6146E324-1713-031D-4A05-00DA9A6E0A72
|
||||
Dillon 01-15-15 903-2925 Sed Rd. Bath Solomon Islands B6784798-C745-6B8B-EFC3-DDB456766B3A
|
||||
Lucas 04-07-16 Ap #212-4291 Non Ave Mount Isa Bermuda 4BF02F00-6543-E955-2CB3-147DB5ACC996
|
||||
Kane 10-27-15 Ap #855-8041 Aliquam Road Bloomington Isle of Man 7D5F7EF0-1DA1-2956-913E-9DD0232FE82B
|
||||
Jermaine 02-08-16 6536 Sollicitudin Rd. Lens-Saint-Servais Laos 98480101-570D-3989-8607-DF037CE2C04D
|
||||
Scott 05-11-16 982-7468 Aliquam Avenue Eckville Wallis and Futuna F9E86E1B-C940-93BC-F269-90120A50A828
|
||||
Ronan 07-02-15 P.O. Box 351, 6427 Sociis St. R<>dermark Kenya 13E31F6C-A4BE-3B63-C208-0F9EDC33231C
|
||||
Paul 09-17-16 4613 Tortor, Av. Riksingen Central African Republic 2830470E-9126-E1F0-EFE7-75E16F47E605
|
||||
Fulton 04-16-16 4351 Elit, Road Sint-Gillis Cape Verde 5B8782C1-12C1-0EE0-5229-5AB14D06BD57
|
||||
Lamar 05-18-16 9263 Mollis. Road Veerle Nepal 4ED58B8B-35D8-732C-C232-4228154A009A
|
||||
Charles 12-27-14 Ap #239-2452 Nec Avenue Saskatoon New Caledonia E7C99399-87EA-F908-59E9-CCB1B40AF168
|
||||
Kaseem 09-28-16 Ap #958-9657 Cursus Road Sunset Point Ukraine 5BAA6A09-9E8C-8AEA-962D-B7371368DB8C
|
||||
Baxter 09-14-15 P.O. Box 566, 4372 Feugiat Av. LaSalle Serbia 8190712E-A2AD-3CC9-89B4-2301F9570595
|
||||
Lionel 05-12-16 3005 Suspendisse St. Zuienkerke Mali 2CD8B4BB-6CD5-2D4C-9074-FBBF5462E471
|
||||
Quinn 12-20-15 P.O. Box 799, 2708 Augue Ave Chapadinha Mongolia 9BDB232A-24B6-4020-CF05-2195FCC7A683
|
||||
Channing 10-12-15 P.O. Box 263, 6647 Eleifend Road Ajaccio Botswana 88C7710E-4B0A-739A-CCFA-68656D352511
|
||||
Evan 10-12-15 877-3353 In St. Torella del Sannio Togo 936FDD4C-7489-285F-B391-28F15291FA15
|
||||
Deacon 01-01-15 P.O. Box 896, 2131 Mollis. Rd. San Pietro al Tanagro Niue D0489775-4C8B-B6A4-B13F-69F1EFE6A2BB
|
||||
Hyatt 08-09-15 Ap #628-8427 Semper Street Northallerton Ireland 1645C905-04E6-3187-05FD-FF3EF3B1909C
|
||||
Mason 03-08-15 1919 Rhoncus. Road La Matap<61>dia Latvia 948764BD-0D67-8193-7F71-DB8B75405BB8
|
||||
Aquila 07-16-16 Ap #367-5036 Lobortis Street Wasseiges Christmas Island 9D78ECF4-D785-16F6-1506-EFEC7A2E680C
|
||||
Jesse 12-09-14 Ap #524-1274 Nec Rd. Elgin Faroe Islands 4A4F0E32-EFF6-B1C7-7FE6-8701C4849DAD
|
||||
Norman 06-08-16 365-7493 Proin Ave Pitlochry Norfolk Island C4002F4B-703A-356B-3B52-EF349E11BBD2
|
||||
Dale 05-07-16 P.O. Box 149, 7946 Bibendum. St. Narbonne Cayman Islands DCAFA688-BDF2-DFC9-F545-B6191F3AABBA
|
||||
Fletcher 10-08-16 Ap #984-4339 Id Avenue Appelterre-Eichem Nauru C870B22E-A1DC-A376-0589-63A6E97F4459
|
||||
Murphy 07-02-16 P.O. Box 736, 2911 Ut Rd. Dorval Pitcairn Islands D2F75F2B-2CC8-9BD3-2DF1-6F6C1537F228
|
||||
Carson 10-11-16 4270 Nulla Rd. Halen Israel A3EC0D50-A0C9-9625-28AD-B3933A81C5F1
|
||||
Brennan 12-11-14 P.O. Box 142, 9526 Ante, Avenue Cochin Bonaire, Sint Eustatius and Saba BB02EC4A-C57C-1F61-9298-45C7C3EB55B5
|
||||
Dennis 09-14-16 Ap #292-9945 Iaculis Street Santander Mayotte 93ACD6FF-E620-D8A4-985F-2DB67BE630B7
|
||||
Amir 10-10-15 P.O. Box 369, 979 Senectus Av. Wardin Armenia 79FF5F4E-03F8-7DAC-09B4-A8076E3F39A9
|
||||
Palmer 10-09-16 3086 Eu Road Sossano Cameroon 66ABAEF0-2A60-27C5-2B4D-6C1D08F0148F
|
||||
Dorian 06-27-16 483-7380 Etiam Av. Zierikzee Ireland FCC92CC2-C59B-07A4-034D-7AC1F56FF893
|
||||
Donovan 10-19-16 P.O. Box 282, 1555 Molestie Avenue Kırıkhan Equatorial Guinea 6E1C773F-7579-01A6-2C2F-50CD28E99AC5
|
||||
Wesley 08-26-15 P.O. Box 557, 4171 Eget St. Banchory Jersey D889335F-815F-B91A-7C92-814CF8491944
|
||||
Damon 08-13-15 Ap #724-7527 Lobortis, Avenue Juneau Mauritius 65336375-864D-DA66-043D-C4461F3B3A21
|
||||
Cooper 08-25-16 832-3247 In Road Pike Creek Somalia 57CAFF15-A497-D20D-9D36-E3AE78C77F2B
|
||||
Flynn 10-12-15 401 Congue, Street Rouvroy Paraguay 81FE1E24-7843-25EA-BE5B-C2598C4453BF
|
||||
Declan 03-12-15 686-1101 Dignissim. Rd. Bad Oldesloe Trinidad and Tobago 124E4702-21AA-3617-D6EF-0A680BF287F9
|
||||
Ryder 10-21-16 1151 Eu Ave Orsara di Puglia Chad 6947FFF6-F8F2-637D-4DB2-EF746659E965
|
||||
Allen 06-30-15 Ap #756-3480 Accumsan Street Carnoustie Taiwan 5631AE3E-6E47-53BD-8891-817B4CC3512D
|
||||
Charles 01-02-15 P.O. Box 940, 6735 Sed, Street Mandi Burewala Nauru 876E1717-ECCC-6359-47B5-97BA80A2B29C
|
||||
Travis 10-07-15 P.O. Box 162, 8293 Duis St. Geesthacht Samoa BB3CEE82-1B41-F4B9-8045-08F1C9B7A17F
|
||||
Beck 06-01-16 2021 Maecenas St. Hugli-Chinsurah Pakistan F7ABADF7-9EC5-F5C6-FF32-ADAE093ACA10
|
||||
Chadwick 02-24-15 286-4943 Sodales St. Stockport Mauritania C04926C6-A52C-B7EF-1569-F9A5B5EDD8B7
|
||||
Eric 03-22-16 Ap #443-2598 Malesuada Rd. Sutton Jersey 70152CA1-69C1-F88E-E19F-D0DFB191072C
|
||||
Jarrod 02-28-16 P.O. Box 573, 5483 Mattis. Street Treglio Djibouti 4477A21E-68A0-BB81-C78B-009276AC2309
|
||||
Sebastian 08-10-16 P.O. Box 486, 5119 Dis Av. Weesp Singapore C4396AD3-9AA0-423B-A372-DE21B5AE757F
|
||||
Robert 10-20-15 9597 Morbi Ave Haren Micronesia DAE70851-B015-A9FC-0222-57DF9EE41EDE
|
||||
Garrison 01-29-16 112-727 Sed St. Pickering Dominican Republic FD8F4927-407A-F57C-A668-732631AEE69F
|
||||
Dominic 10-22-16 P.O. Box 379, 6763 Neque St. Colwood Cocos (Keeling) Islands BAB8741F-A3FA-C1DF-77CE-4E05C483CA6C
|
||||
Adrian 01-30-15 P.O. Box 993, 5994 Tempus, Av. Kelowna Korea, North 35627FC0-8C04-45EE-52C0-DA52EFA4331C
|
||||
Cullen 01-15-15 Ap #119-8754 Parturient St. Mazy Haiti 008EE5DE-9370-1F99-9F53-3E27D088D1FD
|
||||
Gray 05-02-16 P.O. Box 694, 9954 Posuere Av. Magdeburg Korea, North C2C7C509-8D31-FE4C-8B1F-D4798D03CC27
|
||||
Rogan 02-03-15 203 Diam St. Rimbey Trinidad and Tobago 775A58E6-3F69-DE34-2795-10A4FA610E59
|
||||
Plato 12-11-15 Ap #973-9650 Primis St. Colwood Tokelau E89C96FA-D021-A966-D8B7-4012C2B7D08A
|
||||
Jarrod 12-21-14 741-959 Pede Av. Bad Vilbel Honduras 2833D3A2-A195-90CC-5344-DCD810C95ABD
|
||||
Forrest 03-19-15 8901 Magna Avenue Esterzili United Kingdom (Great Britain) 75F9D959-8A54-E131-628A-13AE6B5A470E
|
||||
Erich 01-05-15 P.O. Box 527, 4985 Luctus Street Ponte nelle Alpi Iran 1552F559-B952-06C7-5192-BD07E359AE35
|
||||
Dalton 06-18-16 576-7919 Ut St. Merzig Holy See (Vatican City State) 8583B5E6-2403-FD3E-C565-462B8FD7612F
|
||||
Hasad 02-15-16 P.O. Box 208, 7841 Conubia Street Rothesay Marshall Islands 79B9F905-C923-552D-EDAD-1BA121782459
|
||||
Tate 06-18-15 P.O. Box 724, 3627 Magna. St. Iowa City Peru 6F0D2D02-10CD-B4E2-052D-96F7583D2BFE
|
||||
Amos 05-05-15 644-6779 Nascetur Ave Brixton Tunisia 8684D7A8-5EAF-6437-E11F-627463B1F18A
|
||||
Todd 01-19-15 7501 Metus. Street Galbiate Yemen 6EF8DEBF-367C-EDA3-0095-4CE84EEE0B5F
|
||||
Magee 02-28-15 840-3378 Porttitor Avenue Rocky View Benin 0E78AEB3-5837-C394-0F74-521A5197D00C
|
||||
Amal 12-10-14 P.O. Box 985, 561 Risus. Street Mirzapur-cum-Vindhyachal Congo, the Democratic Republic of the 24BF71D4-1656-A0AA-4297-B981FE305195
|
||||
Ahmed 09-05-15 P.O. Box 973, 9430 Neque. Rd. Oromocto Belgium 1F254A19-2447-39BD-DF00-CEDBC8D54356
|
||||
Jackson 01-02-16 P.O. Box 756, 8760 Ultricies Avenue Chartres Dominica CE19C68C-FCF8-D069-0B97-D4547CE34851
|
||||
Mannix 10-04-16 P.O. Box 381, 2207 Cum Rd. Hartford Korea, South 5B6F4C08-92DE-53CD-92BD-B0ACB55DB9AD
|
||||
Adrian 08-14-15 P.O. Box 214, 2410 Amet Street Ipatinga Côte D'Ivoire (Ivory Coast) 70F29ED9-D666-B24B-2266-C9556148D161
|
||||
Flynn 08-10-16 P.O. Box 149, 5993 Mollis Road Siracusa Belarus FA5AE1AE-E808-1DBC-4C94-4532BBC7F71B
|
||||
Armand 12-13-15 Ap #175-342 Vitae, Avenue Saint-Rhémy-en-Bosses Togo CCBA04A7-8D9A-0811-06E8-83167FDCB56A
|
||||
Warren 01-07-15 130-3775 Massa. Road Brixton Papua New Guinea F294CBEE-CC10-8F2E-7C1F-82B2E9DD70AF
|
||||
David 10-17-16 245-1747 Blandit Rd. Bastia Umbra Cocos (Keeling) Islands B6579554-4C36-6452-1495-9E01D652436C
|
||||
Hu 09-11-16 453-2346 Ante Ave Whitehaven Bouvet Island 188370B5-9285-24B8-9E03-D5B4F9BCA3E2
|
||||
James 03-08-15 2669 Nam Av. Cambridge Guinea 71D87ECA-94CD-CBA7-A557-9CD119C8C752
|
||||
Dexter 02-26-16 653-3752 Nunc Street Hearst Austria 84429BD8-70A3-0A9D-5619-33F749C0858F
|
||||
Theodore 09-09-16 Ap #645-9999 Nam Rd. Maidenhead Gabon 7F801674-E786-AB3A-A822-202776D33212
|
||||
Yasir 11-09-15 283-2518 Accumsan Road Kempten Heard Island and Mcdonald Islands 3D46A729-E760-CA01-4C90-32938AE5E952
|
||||
Marvin 04-24-16 P.O. Box 467, 2421 Gravida Rd. Siena Slovakia 0027CB01-3982-D9A8-C8D8-024F5DBAF0CC
|
||||
Travis 04-20-16 Ap #669-4818 Nisl Rd. Mosciano Sant'Angelo Armenia EF3BB505-4054-E7DF-3212-B6BA09FB6FE2
|
||||
Cullen 02-14-15 P.O. Box 902, 5025 Aliquam Street Tintange Colombia E0242050-CDAF-1EEF-6BCC-CE1B1D4BEF7C
|
||||
Griffin 03-28-15 Ap #990-3013 Aliquet. Rd. Wepion Brunei 5E282F96-ED09-D0EE-5B23-AB496871DDBC
|
||||
Keegan 06-02-16 Ap #390-8084 Elementum Street Idaho Falls Nauru 0EEB2712-4DBC-CA61-5DC2-7D8E2519E831
|
||||
Gavin 03-31-15 P.O. Box 635, 4723 Hendrerit Rd. Torrevieja Macao 19D3F50A-951A-17B0-242F-1013E8EAC8F9
|
||||
Paki 12-17-15 P.O. Box 512, 277 Augue St. Horsham Cape Verde C1AB7BEF-7DCA-5A79-D4D0-42C70D212677
|
||||
Oleg 05-22-15 P.O. Box 398, 6647 Quis Rd. Eisden Ethiopia DA124388-152B-EB65-669A-34927AF30596
|
||||
Orlando 07-20-15 Ap #575-4637 Non St. Cerreto di Spoleto Solomon Islands CC8A6504-0489-A622-8AEA-CE2FF0CE001F
|
||||
Xander 02-26-15 Ap #977-190 Eu Rd. Vespolate Guyana D98E0C02-55C1-C5A4-0723-D637099CA8CE
|
||||
Ishmael 08-19-16 151-6314 Varius St. Sulzano Syria 8DBB274F-1417-6B03-7907-24FF5E2A1761
|
||||
Isaiah 09-27-15 Ap #584-7955 Ut Street H<>villers Indonesia 8AE27E32-0759-EDAD-1AC2-F2664B4D2CA0
|
||||
Edward 09-26-15 155-5699 Lobortis, Street Sauveni<6E>re Guinea 7DEC987B-CD15-2967-BB88-98A9DE869AC2
|
||||
Jason 12-24-14 Ap #394-4852 Lorem, Rd. Barchi Niger F8A268A9-70F9-8298-CADA-22E29CC973E9
|
||||
Colin 04-15-15 Ap #738-1831 Pretium Avenue Lafayette Tuvalu 99C2A67A-82FD-4FD2-B13D-41021A93CD34
|
||||
Ulric 07-13-15 335-3099 Cum St. Aix-en-Provence Mozambique 59844D4F-FB53-E903-67C4-7B0DCA451420
|
||||
Vance 11-08-15 Ap #805-4137 Nulla Road Ligney South Sudan CB3B9B77-12C0-1D8D-96AF-982CFBDC04D8
|
||||
Mason 06-06-15 Ap #750-6911 Aliquam St. Maisi<73>res Benin D5E21534-EF42-0C7C-5761-8D55A418F78C
|
||||
Jesse 08-04-15 P.O. Box 371, 2374 Malesuada Ave Aschersleben Pitcairn Islands FFB87D4C-C25B-8B2A-C65D-0C0CF04ECD19
|
||||
Xenos 01-08-15 P.O. Box 302, 9020 Sed Avenue Ancaster Town Guam 5ACC0483-30D0-194F-8E0A-F2BB9CB7E41C
|
||||
Dalton 04-10-15 Ap #987-4193 Suspendisse Street Bromyard United States E0DE1186-15BD-025A-425E-5A551CB66FCA
|
||||
Maxwell 01-03-15 P.O. Box 297, 2759 Per Avenue Rae-Edzo Namibia 5E880371-EB39-D705-B6BA-B1C47A0FB20F
|
||||
Josiah 12-29-15 481-4517 Justo. Rd. Vreren Ethiopia 6146E324-1713-031D-4A05-00DA9A6E0A72
|
||||
Dillon 01-15-15 903-2925 Sed Rd. Bath Solomon Islands B6784798-C745-6B8B-EFC3-DDB456766B3A
|
||||
Lucas 04-07-16 Ap #212-4291 Non Ave Mount Isa Bermuda 4BF02F00-6543-E955-2CB3-147DB5ACC996
|
||||
Kane 10-27-15 Ap #855-8041 Aliquam Road Bloomington Isle of Man 7D5F7EF0-1DA1-2956-913E-9DD0232FE82B
|
||||
Jermaine 02-08-16 6536 Sollicitudin Rd. Lens-Saint-Servais Laos 98480101-570D-3989-8607-DF037CE2C04D
|
||||
Scott 05-11-16 982-7468 Aliquam Avenue Eckville Wallis and Futuna F9E86E1B-C940-93BC-F269-90120A50A828
|
||||
Ronan 07-02-15 P.O. Box 351, 6427 Sociis St. R<>dermark Kenya 13E31F6C-A4BE-3B63-C208-0F9EDC33231C
|
||||
Paul 09-17-16 4613 Tortor, Av. Riksingen Central African Republic 2830470E-9126-E1F0-EFE7-75E16F47E605
|
||||
Fulton 04-16-16 4351 Elit, Road Sint-Gillis Cape Verde 5B8782C1-12C1-0EE0-5229-5AB14D06BD57
|
||||
Lamar 05-18-16 9263 Mollis. Road Veerle Nepal 4ED58B8B-35D8-732C-C232-4228154A009A
|
||||
Charles 12-27-14 Ap #239-2452 Nec Avenue Saskatoon New Caledonia E7C99399-87EA-F908-59E9-CCB1B40AF168
|
||||
Kaseem 09-28-16 Ap #958-9657 Cursus Road Sunset Point Ukraine 5BAA6A09-9E8C-8AEA-962D-B7371368DB8C
|
||||
Baxter 09-14-15 P.O. Box 566, 4372 Feugiat Av. LaSalle Serbia 8190712E-A2AD-3CC9-89B4-2301F9570595
|
||||
Lionel 05-12-16 3005 Suspendisse St. Zuienkerke Mali 2CD8B4BB-6CD5-2D4C-9074-FBBF5462E471
|
||||
Quinn 12-20-15 P.O. Box 799, 2708 Augue Ave Chapadinha Mongolia 9BDB232A-24B6-4020-CF05-2195FCC7A683
|
||||
Channing 10-12-15 P.O. Box 263, 6647 Eleifend Road Ajaccio Botswana 88C7710E-4B0A-739A-CCFA-68656D352511
|
||||
Evan 10-12-15 877-3353 In St. Torella del Sannio Togo 936FDD4C-7489-285F-B391-28F15291FA15
|
||||
Deacon 01-01-15 P.O. Box 896, 2131 Mollis. Rd. San Pietro al Tanagro Niue D0489775-4C8B-B6A4-B13F-69F1EFE6A2BB
|
||||
Hyatt 08-09-15 Ap #628-8427 Semper Street Northallerton Ireland 1645C905-04E6-3187-05FD-FF3EF3B1909C
|
||||
Mason 03-08-15 1919 Rhoncus. Road La Matap<61>dia Latvia 948764BD-0D67-8193-7F71-DB8B75405BB8
|
||||
Aquila 07-16-16 Ap #367-5036 Lobortis Street Wasseiges Christmas Island 9D78ECF4-D785-16F6-1506-EFEC7A2E680C
|
||||
Jesse 12-09-14 Ap #524-1274 Nec Rd. Elgin Faroe Islands 4A4F0E32-EFF6-B1C7-7FE6-8701C4849DAD
|
||||
Norman 06-08-16 365-7493 Proin Ave Pitlochry Norfolk Island C4002F4B-703A-356B-3B52-EF349E11BBD2
|
||||
Dale 05-07-16 P.O. Box 149, 7946 Bibendum. St. Narbonne Cayman Islands DCAFA688-BDF2-DFC9-F545-B6191F3AABBA
|
||||
Fletcher 10-08-16 Ap #984-4339 Id Avenue Appelterre-Eichem Nauru C870B22E-A1DC-A376-0589-63A6E97F4459
|
||||
Murphy 07-02-16 P.O. Box 736, 2911 Ut Rd. Dorval Pitcairn Islands D2F75F2B-2CC8-9BD3-2DF1-6F6C1537F228
|
||||
Carson 10-11-16 4270 Nulla Rd. Halen Israel A3EC0D50-A0C9-9625-28AD-B3933A81C5F1
|
||||
Brennan 12-11-14 P.O. Box 142, 9526 Ante, Avenue Cochin Bonaire, Sint Eustatius and Saba BB02EC4A-C57C-1F61-9298-45C7C3EB55B5
|
||||
Dennis 09-14-16 Ap #292-9945 Iaculis Street Santander Mayotte 93ACD6FF-E620-D8A4-985F-2DB67BE630B7
|
||||
Amir 10-10-15 P.O. Box 369, 979 Senectus Av. Wardin Armenia 79FF5F4E-03F8-7DAC-09B4-A8076E3F39A9
|
||||
Palmer 10-09-16 3086 Eu Road Sossano Cameroon 66ABAEF0-2A60-27C5-2B4D-6C1D08F0148F
|
||||
Dorian 06-27-16 483-7380 Etiam Av. Zierikzee Ireland FCC92CC2-C59B-07A4-034D-7AC1F56FF893
|
||||
Donovan 10-19-16 P.O. Box 282, 1555 Molestie Avenue Kırıkhan Equatorial Guinea 6E1C773F-7579-01A6-2C2F-50CD28E99AC5
|
||||
Wesley 08-26-15 P.O. Box 557, 4171 Eget St. Banchory Jersey D889335F-815F-B91A-7C92-814CF8491944
|
||||
Damon 08-13-15 Ap #724-7527 Lobortis, Avenue Juneau Mauritius 65336375-864D-DA66-043D-C4461F3B3A21
|
||||
Cooper 08-25-16 832-3247 In Road Pike Creek Somalia 57CAFF15-A497-D20D-9D36-E3AE78C77F2B
|
||||
Flynn 10-12-15 401 Congue, Street Rouvroy Paraguay 81FE1E24-7843-25EA-BE5B-C2598C4453BF
|
||||
Declan 03-12-15 686-1101 Dignissim. Rd. Bad Oldesloe Trinidad and Tobago 124E4702-21AA-3617-D6EF-0A680BF287F9
|
||||
Ryder 10-21-16 1151 Eu Ave Orsara di Puglia Chad 6947FFF6-F8F2-637D-4DB2-EF746659E965
|
||||
Allen 06-30-15 Ap #756-3480 Accumsan Street Carnoustie Taiwan 5631AE3E-6E47-53BD-8891-817B4CC3512D
|
||||
Charles 01-02-15 P.O. Box 940, 6735 Sed, Street Mandi Burewala Nauru 876E1717-ECCC-6359-47B5-97BA80A2B29C
|
||||
Travis 10-07-15 P.O. Box 162, 8293 Duis St. Geesthacht Samoa BB3CEE82-1B41-F4B9-8045-08F1C9B7A17F
|
||||
Beck 06-01-16 2021 Maecenas St. Hugli-Chinsurah Pakistan F7ABADF7-9EC5-F5C6-FF32-ADAE093ACA10
|
||||
Chadwick 02-24-15 286-4943 Sodales St. Stockport Mauritania C04926C6-A52C-B7EF-1569-F9A5B5EDD8B7
|
||||
Eric 03-22-16 Ap #443-2598 Malesuada Rd. Sutton Jersey 70152CA1-69C1-F88E-E19F-D0DFB191072C
|
||||
Jarrod 02-28-16 P.O. Box 573, 5483 Mattis. Street Treglio Djibouti 4477A21E-68A0-BB81-C78B-009276AC2309
|
||||
Sebastian 08-10-16 P.O. Box 486, 5119 Dis Av. Weesp Singapore C4396AD3-9AA0-423B-A372-DE21B5AE757F
|
||||
Robert 10-20-15 9597 Morbi Ave Haren Micronesia DAE70851-B015-A9FC-0222-57DF9EE41EDE
|
||||
Garrison 01-29-16 112-727 Sed St. Pickering Dominican Republic FD8F4927-407A-F57C-A668-732631AEE69F
|
||||
Dominic 10-22-16 P.O. Box 379, 6763 Neque St. Colwood Cocos (Keeling) Islands BAB8741F-A3FA-C1DF-77CE-4E05C483CA6C
|
||||
Adrian 01-30-15 P.O. Box 993, 5994 Tempus, Av. Kelowna Korea, North 35627FC0-8C04-45EE-52C0-DA52EFA4331C
|
||||
Cullen 01-15-15 Ap #119-8754 Parturient St. Mazy Haiti 008EE5DE-9370-1F99-9F53-3E27D088D1FD
|
||||
Gray 05-02-16 P.O. Box 694, 9954 Posuere Av. Magdeburg Korea, North C2C7C509-8D31-FE4C-8B1F-D4798D03CC27
|
||||
Rogan 02-03-15 203 Diam St. Rimbey Trinidad and Tobago 775A58E6-3F69-DE34-2795-10A4FA610E59
|
||||
Plato 12-11-15 Ap #973-9650 Primis St. Colwood Tokelau E89C96FA-D021-A966-D8B7-4012C2B7D08A
|
||||
Jarrod 12-21-14 741-959 Pede Av. Bad Vilbel Honduras 2833D3A2-A195-90CC-5344-DCD810C95ABD
|
||||
Forrest 03-19-15 8901 Magna Avenue Esterzili United Kingdom (Great Britain) 75F9D959-8A54-E131-628A-13AE6B5A470E
|
||||
Erich 01-05-15 P.O. Box 527, 4985 Luctus Street Ponte nelle Alpi Iran 1552F559-B952-06C7-5192-BD07E359AE35
|
||||
Dalton 06-18-16 576-7919 Ut St. Merzig Holy See (Vatican City State) 8583B5E6-2403-FD3E-C565-462B8FD7612F
|
||||
Hasad 02-15-16 P.O. Box 208, 7841 Conubia Street Rothesay Marshall Islands 79B9F905-C923-552D-EDAD-1BA121782459
|
||||
Tate 06-18-15 P.O. Box 724, 3627 Magna. St. Iowa City Peru 6F0D2D02-10CD-B4E2-052D-96F7583D2BFE
|
||||
Amos 05-05-15 644-6779 Nascetur Ave Brixton Tunisia 8684D7A8-5EAF-6437-E11F-627463B1F18A
|
||||
Todd 01-19-15 7501 Metus. Street Galbiate Yemen 6EF8DEBF-367C-EDA3-0095-4CE84EEE0B5F
|
||||
Magee 02-28-15 840-3378 Porttitor Avenue Rocky View Benin 0E78AEB3-5837-C394-0F74-521A5197D00C
|
||||
Amal 12-10-14 P.O. Box 985, 561 Risus. Street Mirzapur-cum-Vindhyachal Congo, the Democratic Republic of the 24BF71D4-1656-A0AA-4297-B981FE305195
|
||||
Ahmed 09-05-15 P.O. Box 973, 9430 Neque. Rd. Oromocto Belgium 1F254A19-2447-39BD-DF00-CEDBC8D54356
|
||||
Jackson 01-02-16 P.O. Box 756, 8760 Ultricies Avenue Chartres Dominica CE19C68C-FCF8-D069-0B97-D4547CE34851
|
||||
Mannix 10-04-16 P.O. Box 381, 2207 Cum Rd. Hartford Korea, South 5B6F4C08-92DE-53CD-92BD-B0ACB55DB9AD
|
||||
Adrian 08-14-15 P.O. Box 214, 2410 Amet Street Ipatinga Côte D'Ivoire (Ivory Coast) 70F29ED9-D666-B24B-2266-C9556148D161
|
||||
Flynn 08-10-16 P.O. Box 149, 5993 Mollis Road Siracusa Belarus FA5AE1AE-E808-1DBC-4C94-4532BBC7F71B
|
||||
Armand 12-13-15 Ap #175-342 Vitae, Avenue Saint-Rhémy-en-Bosses Togo CCBA04A7-8D9A-0811-06E8-83167FDCB56A
|
||||
Warren 01-07-15 130-3775 Massa. Road Brixton Papua New Guinea F294CBEE-CC10-8F2E-7C1F-82B2E9DD70AF
|
||||
David 10-17-16 245-1747 Blandit Rd. Bastia Umbra Cocos (Keeling) Islands B6579554-4C36-6452-1495-9E01D652436C
|
||||
Hu 09-11-16 453-2346 Ante Ave Whitehaven Bouvet Island 188370B5-9285-24B8-9E03-D5B4F9BCA3E2
|
||||
James 03-08-15 2669 Nam Av. Cambridge Guinea 71D87ECA-94CD-CBA7-A557-9CD119C8C752
|
||||
Dexter 02-26-16 653-3752 Nunc Street Hearst Austria 84429BD8-70A3-0A9D-5619-33F749C0858F
|
||||
Theodore 09-09-16 Ap #645-9999 Nam Rd. Maidenhead Gabon 7F801674-E786-AB3A-A822-202776D33212
|
||||
Yasir 11-09-15 283-2518 Accumsan Road Kempten Heard Island and Mcdonald Islands 3D46A729-E760-CA01-4C90-32938AE5E952
|
||||
Marvin 04-24-16 P.O. Box 467, 2421 Gravida Rd. Siena Slovakia 0027CB01-3982-D9A8-C8D8-024F5DBAF0CC
|
||||
Travis 04-20-16 Ap #669-4818 Nisl Rd. Mosciano Sant'Angelo Armenia EF3BB505-4054-E7DF-3212-B6BA09FB6FE2
|
||||
Cullen 02-14-15 P.O. Box 902, 5025 Aliquam Street Tintange Colombia E0242050-CDAF-1EEF-6BCC-CE1B1D4BEF7C
|
||||
Griffin 03-28-15 Ap #990-3013 Aliquet. Rd. Wepion Brunei 5E282F96-ED09-D0EE-5B23-AB496871DDBC
|
||||
Keegan 06-02-16 Ap #390-8084 Elementum Street Idaho Falls Nauru 0EEB2712-4DBC-CA61-5DC2-7D8E2519E831
|
||||
Gavin 03-31-15 P.O. Box 635, 4723 Hendrerit Rd. Torrevieja Macao 19D3F50A-951A-17B0-242F-1013E8EAC8F9
|
||||
Paki 12-17-15 P.O. Box 512, 277 Augue St. Horsham Cape Verde C1AB7BEF-7DCA-5A79-D4D0-42C70D212677
|
||||
Oleg 05-22-15 P.O. Box 398, 6647 Quis Rd. Eisden Ethiopia DA124388-152B-EB65-669A-34927AF30596
|
||||
Orlando 07-20-15 Ap #575-4637 Non St. Cerreto di Spoleto Solomon Islands CC8A6504-0489-A622-8AEA-CE2FF0CE001F
|
||||
Xander 02-26-15 Ap #977-190 Eu Rd. Vespolate Guyana D98E0C02-55C1-C5A4-0723-D637099CA8CE
|
||||
Ishmael 08-19-16 151-6314 Varius St. Sulzano Syria 8DBB274F-1417-6B03-7907-24FF5E2A1761
|
||||
Isaiah 09-27-15 Ap #584-7955 Ut Street H<>villers Indonesia 8AE27E32-0759-EDAD-1AC2-F2664B4D2CA0
|
||||
@@ -0,0 +1,175 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [v1.1.9](https://github.com/inspect-js/which-typed-array/compare/v1.1.8...v1.1.9) - 2022-11-02
|
||||
|
||||
### Commits
|
||||
|
||||
- [Dev Deps] update `aud`, `is-callable`, `tape` [`9a20b3c`](https://github.com/inspect-js/which-typed-array/commit/9a20b3cb8f5d087789a8160395517bffe27b4339)
|
||||
- [Refactor] use `gopd` instead of `es-abstract` helper [`00157af`](https://github.com/inspect-js/which-typed-array/commit/00157af909842b8b5affa5485d3574ec92d94065)
|
||||
- [Deps] update `is-typed-array` [`6714240`](https://github.com/inspect-js/which-typed-array/commit/6714240e748cbbb634cb1e405ad762bc52acde66)
|
||||
- [meta] add `sideEffects` flag [`89b96cc`](https://github.com/inspect-js/which-typed-array/commit/89b96cc3decc78d9621598e94fa1c2bb87eabf2e)
|
||||
|
||||
## [v1.1.8](https://github.com/inspect-js/which-typed-array/compare/v1.1.7...v1.1.8) - 2022-05-14
|
||||
|
||||
### Commits
|
||||
|
||||
- [actions] reuse common workflows [`95ea6c0`](https://github.com/inspect-js/which-typed-array/commit/95ea6c02dc5ec4ed0ee1b9c4692bb060108c8637)
|
||||
- [meta] use `npmignore` to autogenerate an npmignore file [`d08436a`](https://github.com/inspect-js/which-typed-array/commit/d08436a19cdd76219732f5040a01cdb92ef2820e)
|
||||
- [readme] add github actions/codecov badges [`35ae3af`](https://github.com/inspect-js/which-typed-array/commit/35ae3af6a0bb328c9d9b9bbb53e47122f269d81a)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `safe-publish-latest`, `tape` [`86e6e3a`](https://github.com/inspect-js/which-typed-array/commit/86e6e3af60b2436f0ff34968d9d6240a23f40528)
|
||||
- [actions] update codecov uploader [`0aa6e30`](https://github.com/inspect-js/which-typed-array/commit/0aa6e3026ab4198c4364737ed4f0315a2ecc432a)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`a881a78`](https://github.com/inspect-js/which-typed-array/commit/a881a785f094e823e1cefe2ae9e4ebe31a8e996e)
|
||||
- [Refactor] use `for-each` instead of `foreach` [`9dafa03`](https://github.com/inspect-js/which-typed-array/commit/9dafa0377fc5c690059a9d454f1dd4d365c5c902)
|
||||
- [Deps] update `es-abstract`, `is-typed-array` [`0684022`](https://github.com/inspect-js/which-typed-array/commit/068402297608f321a4ec99ebce741b3eb38fcfdd)
|
||||
- [Deps] update `es-abstract`, `is-typed-array` [`633a529`](https://github.com/inspect-js/which-typed-array/commit/633a529081b5c48d9675abb8aea425e6e33d528e)
|
||||
|
||||
## [v1.1.7](https://github.com/inspect-js/which-typed-array/compare/v1.1.6...v1.1.7) - 2021-08-30
|
||||
|
||||
### Commits
|
||||
|
||||
- [Refactor] use `globalThis` if available [`2a16d1f`](https://github.com/inspect-js/which-typed-array/commit/2a16d1fd520871ce6b23c60f0bd2113cf33b2533)
|
||||
- [meta] changelog cleanup [`ba99f56`](https://github.com/inspect-js/which-typed-array/commit/ba99f56b45e6acde7aef4a1f34bb00e44088ccee)
|
||||
- [Dev Deps] update `@ljharb/eslint-config` [`19a6e04`](https://github.com/inspect-js/which-typed-array/commit/19a6e04ce0094fb3fd6d0d2cbc58d320556ddf50)
|
||||
- [Deps] update `available-typed-arrays` [`50dbc58`](https://github.com/inspect-js/which-typed-array/commit/50dbc5810a24c468b49409e1f0a79d03501e3dd6)
|
||||
- [Deps] update `is-typed-array` [`c1b83ea`](https://github.com/inspect-js/which-typed-array/commit/c1b83eae65f042e46b6ae941ac4e814b7965a0f7)
|
||||
|
||||
## [v1.1.6](https://github.com/inspect-js/which-typed-array/compare/v1.1.5...v1.1.6) - 2021-08-06
|
||||
|
||||
### Fixed
|
||||
|
||||
- [Fix] if Symbol.toStringTag exists but is not present, use Object.prototype.toString [`#51`](https://github.com/inspect-js/which-typed-array/issues/51) [`#49`](https://github.com/inspect-js/which-typed-array/issues/49)
|
||||
|
||||
### Commits
|
||||
|
||||
- [Dev Deps] update `is-callable`, `tape` [`63eb1e3`](https://github.com/inspect-js/which-typed-array/commit/63eb1e3faede3f328bbbb4a5fcffc2e4769cf4ec)
|
||||
- [Deps] update `is-typed-array` [`c5056f0`](https://github.com/inspect-js/which-typed-array/commit/c5056f0007d4c9434f1fa69eff183109468b4769)
|
||||
|
||||
## [v1.1.5](https://github.com/inspect-js/which-typed-array/compare/v1.1.4...v1.1.5) - 2021-08-05
|
||||
|
||||
### Commits
|
||||
|
||||
- [actions] use `node/install` instead of `node/run`; use `codecov` action [`63fa8dd`](https://github.com/inspect-js/which-typed-array/commit/63fa8dd1dc9c0f0dbbaa16d1de0eb89797324c5d)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `is-callable`, `tape` [`1107c74`](https://github.com/inspect-js/which-typed-array/commit/1107c74c52ed6eb4a719faec88e16c4343976d73)
|
||||
- [Deps] update `available-typed-arrays`, `call-bind`, `es-abstract`, `is-typed-array` [`f953454`](https://github.com/inspect-js/which-typed-array/commit/f953454b2c6f589f09573ddc961431f970c2e1b6)
|
||||
- [Fix] use `has-tostringtag` to behave correctly in the presence of symbol shams [`8aee720`](https://github.com/inspect-js/which-typed-array/commit/8aee7207abcd72c799ac324b214fbb6ca7ae4a28)
|
||||
- [meta] use `prepublishOnly` script for npm 7+ [`6c5167b`](https://github.com/inspect-js/which-typed-array/commit/6c5167b4cd06cb62a5487a2e797d8e41cc2970b1)
|
||||
|
||||
## [v1.1.4](https://github.com/inspect-js/which-typed-array/compare/v1.1.3...v1.1.4) - 2020-12-05
|
||||
|
||||
### Commits
|
||||
|
||||
- [meta] npmignore github action workflows [`aa427e7`](https://github.com/inspect-js/which-typed-array/commit/aa427e79a230a985953695a8129ceb6bb7d42527)
|
||||
|
||||
## [v1.1.3](https://github.com/inspect-js/which-typed-array/compare/v1.1.2...v1.1.3) - 2020-12-05
|
||||
|
||||
### Commits
|
||||
|
||||
- [Tests] migrate tests to Github Actions [`803d4dd`](https://github.com/inspect-js/which-typed-array/commit/803d4ddb601ff03e587be792bd452de0e2783d03)
|
||||
- [Tests] run `nyc` on all tests [`205a13f`](https://github.com/inspect-js/which-typed-array/commit/205a13f7aa172e014ddc2079c84af6ba575581c8)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `is-callable`, `tape` [`97ceb07`](https://github.com/inspect-js/which-typed-array/commit/97ceb070d5aea1c3a696c6f695800ae468bafc0b)
|
||||
- [actions] add "Allow Edits" workflow [`b140492`](https://github.com/inspect-js/which-typed-array/commit/b14049211eff32bd4149767def4f939483810051)
|
||||
- [Deps] update `es-abstract`; use `call-bind` where applicable [`2abdb87`](https://github.com/inspect-js/which-typed-array/commit/2abdb871961b4e1b58925115a7d56a9cc5966a02)
|
||||
- [actions] switch Automatic Rebase workflow to `pull_request_target` event [`256d34b`](https://github.com/inspect-js/which-typed-array/commit/256d34b8bdb67b8af0e9f83c9a318e54f3340e3b)
|
||||
- [Dev Deps] update `auto-changelog`; add `aud` [`ddea96f`](https://github.com/inspect-js/which-typed-array/commit/ddea96fe320dbdd0c7d7569812399a7f64d43e04)
|
||||
- [meta] gitignore nyc output [`8a812bd`](https://github.com/inspect-js/which-typed-array/commit/8a812bd1ce7c5609988fb4fe2e9af2089eccd07d)
|
||||
|
||||
## [v1.1.2](https://github.com/inspect-js/which-typed-array/compare/v1.1.1...v1.1.2) - 2020-04-07
|
||||
|
||||
### Commits
|
||||
|
||||
- [Dev Deps] update `make-arrow-function`, `make-generator-function` [`28c61ef`](https://github.com/inspect-js/which-typed-array/commit/28c61eff4903ff6509f65c2f500858b9cb4636f1)
|
||||
- [Dev Deps] update `@ljharb/eslint-config` [`a233879`](https://github.com/inspect-js/which-typed-array/commit/a2338798d3a4a3169cda54e322b2f2eb0e976ad0)
|
||||
- [Dev Deps] update `auto-changelog` [`df0134c`](https://github.com/inspect-js/which-typed-array/commit/df0134c0e20ec6d94993988ad670e1b3cf350bea)
|
||||
- [Fix] move `foreach` to dependencies [`6ef29c0`](https://github.com/inspect-js/which-typed-array/commit/6ef29c0dbb91a7ec21df7ce8736f99f41efea39e)
|
||||
- [Tests] only audit prod deps [`eb21044`](https://github.com/inspect-js/which-typed-array/commit/eb210446bd7a433657204d2314ef56fe264c21ad)
|
||||
- [Deps] update `es-abstract` [`5ef0236`](https://github.com/inspect-js/which-typed-array/commit/5ef02368d9876a1074123aa7725d6759b4f3e358)
|
||||
- [Dev Deps] update `tape` [`7456037`](https://github.com/inspect-js/which-typed-array/commit/745603728c6c3da8bdddee321e8a9196f4827aa3)
|
||||
- [Deps] update `available-typed-arrays` [`8a856c9`](https://github.com/inspect-js/which-typed-array/commit/8a856c9aa707c1e6f7a52e834485356b31395ea6)
|
||||
|
||||
## [v1.1.1](https://github.com/inspect-js/which-typed-array/compare/v1.1.0...v1.1.1) - 2020-01-24
|
||||
|
||||
### Commits
|
||||
|
||||
- [Tests] use shared travis-ci configs [`0a627d9`](https://github.com/inspect-js/which-typed-array/commit/0a627d9694d0eabdaee63b19e605584166995a79)
|
||||
- [meta] add `auto-changelog` [`2a14c58`](https://github.com/inspect-js/which-typed-array/commit/2a14c58b79f72e32ef2078efb40d31a4bf8c197a)
|
||||
- [meta] remove unused Makefile and associated utilities [`75f7f22`](https://github.com/inspect-js/which-typed-array/commit/75f7f222199f42618c290de363c542b11f5a5632)
|
||||
- [Tests] up to `node` `v12.10`, `v11.15`, `v10.16`, `v8.16`, `v6.17` [`4162327`](https://github.com/inspect-js/which-typed-array/commit/416232725e7d127cbd886af0f8988dae612a342f)
|
||||
- [Refactor] use `es-abstract`’s `callBound`, `available-typed-arrays`, `has-symbols` [`9b04a2a`](https://github.com/inspect-js/which-typed-array/commit/9b04a2a14c758600cffcf59485b7b3c85839c266)
|
||||
- [readme] fix repo URLs, remove testling [`03ed52f`](https://github.com/inspect-js/which-typed-array/commit/03ed52f3ae4fcd35614bcda7e947b14e62009c71)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `replace`, `semver`, `tape` [`bfbcf3e`](https://github.com/inspect-js/which-typed-array/commit/bfbcf3ec9c449bd0089ed805c01a32ba4e7e5938)
|
||||
- [actions] add automatic rebasing / merge commit blocking [`cc88ac5`](https://github.com/inspect-js/which-typed-array/commit/cc88ac56bcfb71cb26c656ebde4c560a22fadd85)
|
||||
- [meta] create FUNDING.yml [`acbc723`](https://github.com/inspect-js/which-typed-array/commit/acbc7230929b1256c83df28be4a456eed3e147e9)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `is-callable`, `tape` [`f1ab63e`](https://github.com/inspect-js/which-typed-array/commit/f1ab63e9366027eae2e29398c035181dac164132)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`; add `safe-publish-latest` [`ac9f50b`](https://github.com/inspect-js/which-typed-array/commit/ac9f50b59558933292dff993df2e68eaa44b07e2)
|
||||
- [Tests] use `npx aud` instead of `nsp` or `npm audit` with hoops [`aaaa15d`](https://github.com/inspect-js/which-typed-array/commit/aaaa15dfb5bd8228c0cfb8f2aba267efb405b0a1)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`602fc9a`](https://github.com/inspect-js/which-typed-array/commit/602fc9a0a7d708236f90c76f592e6a980ecde940)
|
||||
- [Deps] update `available-typed-arrays`, `is-typed-array` [`b2d69b6`](https://github.com/inspect-js/which-typed-array/commit/b2d69b639bf14344d09f8512dbc060cd4f533161)
|
||||
- [meta] add `funding` field [`156f613`](https://github.com/inspect-js/which-typed-array/commit/156f613d0ce547c4b15e1ae279198b66e3cef55e)
|
||||
|
||||
## [v1.1.0](https://github.com/inspect-js/which-typed-array/compare/v1.0.1...v1.1.0) - 2019-02-16
|
||||
|
||||
### Commits
|
||||
|
||||
- [Tests] remove `jscs` [`381c9b4`](https://github.com/inspect-js/which-typed-array/commit/381c9b4bd858da1adedf23d8555af3a3ed901a83)
|
||||
- [Tests] up to `node` `v8.2`, `v7.10`, `v6.11`, `v5.8`; improve matrix; newer npm breaks on older node [`7015c19`](https://github.com/inspect-js/which-typed-array/commit/7015c196ba86540b04d18d9b1d2c368909492023)
|
||||
- [Tests] up to `node` `v10.0`, `v9.11`, `v8.11`, `v6.14`, `v4.9`; use `nvm install-latest-npm` [`ad67885`](https://github.com/inspect-js/which-typed-array/commit/ad678853e245986720d7650be1c974a9ff3ac814)
|
||||
- [Tests] up to `node` `v11.6`, `v10.15`, `v8.15`, `v6.16` [`dd94bfb`](https://github.com/inspect-js/which-typed-array/commit/dd94bfb6309a92d1537352f2d1100f9e913ebc01)
|
||||
- [Refactor] use an array instead of an object for storing Typed Array names [`de98bc1`](https://github.com/inspect-js/which-typed-array/commit/de98bc1d44af92909a34212e276deb5d79ac428a)
|
||||
- [meta] ignore `test.html` [`06cfb1b`](https://github.com/inspect-js/which-typed-array/commit/06cfb1bc0ca7881d1bd1621fa946a16366cd6afc)
|
||||
- [Tests] up to `node` `v7.0`, `v6.9`, `v4.6`; improve test matrix [`df76eaa`](https://github.com/inspect-js/which-typed-array/commit/df76eaa39b94b28147e81a89bb587e8aa3e3dba3)
|
||||
- [New] add `BigInt64Array` and `BigUint64Array` [`d6bca3a`](https://github.com/inspect-js/which-typed-array/commit/d6bca3a68ccfe33f6659a24b770068e89dab1592)
|
||||
- [Dev Deps] update `jscs`, `nsp`, `eslint` [`f23b45b`](https://github.com/inspect-js/which-typed-array/commit/f23b45b2796bd1f63ddddf28b4b80b9709478cb3)
|
||||
- [Dev Deps] update `@ljharb/eslint-config`, `eslint`, `semver`, `tape` [`ddb4484`](https://github.com/inspect-js/which-typed-array/commit/ddb4484adc3b45c4396632611556055f3b2f5990)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `covert`, `is-callable`, `replace`, `semver`, `tape` [`4524e59`](https://github.com/inspect-js/which-typed-array/commit/4524e593e9387c185d5632696c62c1600c0b380f)
|
||||
- [Dev Deps] update `tape`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config`, `semver` [`1ec7056`](https://github.com/inspect-js/which-typed-array/commit/1ec70568565c479a6168b03e0a5aec6ec9ac5a21)
|
||||
- [Dev Deps] update `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config` [`799487d`](https://github.com/inspect-js/which-typed-array/commit/799487d666b32d1ae0d27cfededf2f5480c5faea)
|
||||
- [Dev Deps] update `tape`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config`, `semver` [`8092598`](https://github.com/inspect-js/which-typed-array/commit/8092598998a1f9f8005b4e3d299eb09c96fa2e21)
|
||||
- [Tests] up to `node` `v11.10` [`a5aabb1`](https://github.com/inspect-js/which-typed-array/commit/a5aabb1910e8408f857a791253487824c7c758d3)
|
||||
- [Dev Deps] update `@ljharb/eslint-config`, `eslint`, `nsp`, `semver`, `tape` [`277be33`](https://github.com/inspect-js/which-typed-array/commit/277be331d9f05ff95644d6bcd896547ca620cd8e)
|
||||
- [Tests] use `npm audit` instead of `nsp` [`ee97dc7`](https://github.com/inspect-js/which-typed-array/commit/ee97dc7c5d384d68f60ce6cb5a85d9509e75f72b)
|
||||
- [Dev Deps] update `tape`, `eslint`, `@ljharb/eslint-config` [`262ffb0`](https://github.com/inspect-js/which-typed-array/commit/262ffb025facb0795b33fbd5131183bdbc0a40f6)
|
||||
- [Dev Deps] update `jscs`, `eslint`, `@ljharb/eslint-config` [`d6bbcfc`](https://github.com/inspect-js/which-typed-array/commit/d6bbcfc3eea427f0156fbdcf9ae11dbf3745a755)
|
||||
- [Tests] up to `node` `v6.2` [`2ff89eb`](https://github.com/inspect-js/which-typed-array/commit/2ff89eb91754146c0bc1ae689f37458d84f6e690)
|
||||
- Only apps should have lockfiles [`e2bc271`](https://github.com/inspect-js/which-typed-array/commit/e2bc271e1e9a6481a2836f892177825a808c331c)
|
||||
- [Dev Deps] update `nsp`, `eslint`, `@ljharb/eslint-config` [`b79e93b`](https://github.com/inspect-js/which-typed-array/commit/b79e93bf15c871ce0ff24fa3ad61001707eea463)
|
||||
- [Dev Deps] update `nsp`, `eslint`, `@ljharb/eslint-config` [`016dbff`](https://github.com/inspect-js/which-typed-array/commit/016dbff8c49c32cda7ec80d86006c8a7c43bc40c)
|
||||
- [Dev Deps] update `eslint`, `tape` [`6ce4bbc`](https://github.com/inspect-js/which-typed-array/commit/6ce4bbc5f6caf632cbcf9ababbfe36e1bf4093d7)
|
||||
- [Tests] on `node` `v10.1` [`f0683a0`](https://github.com/inspect-js/which-typed-array/commit/f0683a0c17e039e926ecaad4c4c341cd8e5878f1)
|
||||
- [Tests] up to `node` `v7.2` [`2f29cef`](https://github.com/inspect-js/which-typed-array/commit/2f29cef42d30f87259cd6687c25a79ae4651d0c9)
|
||||
- [Dev Deps] update `replace` [`73b5ba6`](https://github.com/inspect-js/which-typed-array/commit/73b5ba6e87638d13553985977cab9d1bad33e242)
|
||||
- [Deps] update `function-bind` [`c8a18c2`](https://github.com/inspect-js/which-typed-array/commit/c8a18c2982e6b126ecc1d4655ec2e53b05535b20)
|
||||
- [Tests] on `node` `v5.12` [`812102b`](https://github.com/inspect-js/which-typed-array/commit/812102bf223422da8f7a89e5a1308214dd158571)
|
||||
- [Tests] on `node` `v5.10` [`271584f`](https://github.com/inspect-js/which-typed-array/commit/271584f3a8b10ef68a7d419ac0062b444e63d07c)
|
||||
|
||||
## [v1.0.1](https://github.com/inspect-js/which-typed-array/compare/v1.0.0...v1.0.1) - 2016-03-19
|
||||
|
||||
### Commits
|
||||
|
||||
- [Dev Deps] update `tape`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config`, `semver`, `is-callable` [`4a628c5`](https://github.com/inspect-js/which-typed-array/commit/4a628c520d8e080a9fa7e8218947d3b2ceedca72)
|
||||
- [Dev Deps] update `tape`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config`, `is-callable` [`8e09372`](https://github.com/inspect-js/which-typed-array/commit/8e09372ded877a191cbf777060483227d5071e84)
|
||||
- [Tests] up to `node` `v5.6`, `v4.3` [`3a35bf9`](https://github.com/inspect-js/which-typed-array/commit/3a35bf9fb9c7f8e6ac1b579ed2754087351ad1a5)
|
||||
- [Dev Deps] update `jscs`, `eslint`, `@ljharb/eslint-config` [`9410d5e`](https://github.com/inspect-js/which-typed-array/commit/9410d5e35db4b834827b31ea1723bbeebbcde5ba)
|
||||
- [Fix] `Symbol.toStringTag` is on the super-[[Prototype]] of Float32Array, not the [[Prototype]]. [`7c40a3a`](https://github.com/inspect-js/which-typed-array/commit/7c40a3a05046bbbd188340fb19471ad913e4af05)
|
||||
- [Tests] up to `node` `v5.9`, `v4.4` [`07878e7`](https://github.com/inspect-js/which-typed-array/commit/07878e7cd23d586ddb9e85a03f675e0a574db246)
|
||||
- Use the object form of "author" in package.json [`65caa56`](https://github.com/inspect-js/which-typed-array/commit/65caa560d1c0c15c1080b25a9df55c7373c73f08)
|
||||
- [Tests] use pretest/posttest for linting/security [`c170f7e`](https://github.com/inspect-js/which-typed-array/commit/c170f7ebcf07475d6420f2d2d2d08b1646280cd4)
|
||||
- [Deps] update `is-typed-array` [`9ab324e`](https://github.com/inspect-js/which-typed-array/commit/9ab324e746a7552b2d9363777fc5c9f5c2e31ce7)
|
||||
- [Deps] update `function-bind` [`a723142`](https://github.com/inspect-js/which-typed-array/commit/a723142c70a5b6a4f8f5feecc9705619590f4eeb)
|
||||
- [Deps] update `is-typed-array` [`ed82ce4`](https://github.com/inspect-js/which-typed-array/commit/ed82ce4e8ecc657fc6e839d23ef6347497bc93be)
|
||||
- [Tests] on `node` `v4.2` [`f581c20`](https://github.com/inspect-js/which-typed-array/commit/f581c2031990668894a8e5a08eaf01a2548e822c)
|
||||
|
||||
## v1.0.0 - 2015-10-05
|
||||
|
||||
### Commits
|
||||
|
||||
- Dotfiles / Makefile [`667f89a`](https://github.com/inspect-js/which-typed-array/commit/667f89a9046502594e2559dbf5568e062af3b770)
|
||||
- Tests. [`a14d05e`](https://github.com/inspect-js/which-typed-array/commit/a14d05ef443d2ac678cb0567befc0abf8cf21709)
|
||||
- package.json [`560b1aa`](https://github.com/inspect-js/which-typed-array/commit/560b1aa4f8bbc5d41d9cee96c93faf08c25be0e5)
|
||||
- Read me [`a22096e`](https://github.com/inspect-js/which-typed-array/commit/a22096e05773f93b34e672d3f743ec6f1963bc24)
|
||||
- Implementation [`0b1ae28`](https://github.com/inspect-js/which-typed-array/commit/0b1ae2848372f6256cf075d687e3722878e67aca)
|
||||
- Initial commit [`4b32f0a`](https://github.com/inspect-js/which-typed-array/commit/4b32f0a9d32165d6ab91797d6971ea83cf4ce9da)
|
||||
@@ -0,0 +1,448 @@
|
||||
let parser = require('postcss-value-parser')
|
||||
let range = require('normalize-range')
|
||||
|
||||
let OldValue = require('../old-value')
|
||||
let Value = require('../value')
|
||||
let utils = require('../utils')
|
||||
|
||||
let IS_DIRECTION = /top|left|right|bottom/gi
|
||||
|
||||
class Gradient extends Value {
|
||||
/**
|
||||
* Change degrees for webkit prefix
|
||||
*/
|
||||
replace(string, prefix) {
|
||||
let ast = parser(string)
|
||||
for (let node of ast.nodes) {
|
||||
let gradientName = this.name // gradient name
|
||||
if (node.type === 'function' && node.value === gradientName) {
|
||||
node.nodes = this.newDirection(node.nodes)
|
||||
node.nodes = this.normalize(node.nodes, gradientName)
|
||||
if (prefix === '-webkit- old') {
|
||||
let changes = this.oldWebkit(node)
|
||||
if (!changes) {
|
||||
return false
|
||||
}
|
||||
} else {
|
||||
node.nodes = this.convertDirection(node.nodes)
|
||||
node.value = prefix + node.value
|
||||
}
|
||||
}
|
||||
}
|
||||
return ast.toString()
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace first token
|
||||
*/
|
||||
replaceFirst(params, ...words) {
|
||||
let prefix = words.map(i => {
|
||||
if (i === ' ') {
|
||||
return { type: 'space', value: i }
|
||||
}
|
||||
return { type: 'word', value: i }
|
||||
})
|
||||
return prefix.concat(params.slice(1))
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert angle unit to deg
|
||||
*/
|
||||
normalizeUnit(str, full) {
|
||||
let num = parseFloat(str)
|
||||
let deg = (num / full) * 360
|
||||
return `${deg}deg`
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalize angle
|
||||
*/
|
||||
normalize(nodes, gradientName) {
|
||||
if (!nodes[0]) return nodes
|
||||
|
||||
if (/-?\d+(.\d+)?grad/.test(nodes[0].value)) {
|
||||
nodes[0].value = this.normalizeUnit(nodes[0].value, 400)
|
||||
} else if (/-?\d+(.\d+)?rad/.test(nodes[0].value)) {
|
||||
nodes[0].value = this.normalizeUnit(nodes[0].value, 2 * Math.PI)
|
||||
} else if (/-?\d+(.\d+)?turn/.test(nodes[0].value)) {
|
||||
nodes[0].value = this.normalizeUnit(nodes[0].value, 1)
|
||||
} else if (nodes[0].value.includes('deg')) {
|
||||
let num = parseFloat(nodes[0].value)
|
||||
num = range.wrap(0, 360, num)
|
||||
nodes[0].value = `${num}deg`
|
||||
}
|
||||
|
||||
if (
|
||||
gradientName === 'linear-gradient' ||
|
||||
gradientName === 'repeating-linear-gradient'
|
||||
) {
|
||||
let direction = nodes[0].value
|
||||
|
||||
// Unitless zero for `<angle>` values are allowed in CSS gradients and transforms.
|
||||
// Spec: https://github.com/w3c/csswg-drafts/commit/602789171429b2231223ab1e5acf8f7f11652eb3
|
||||
if (direction === '0deg' || direction === '0') {
|
||||
nodes = this.replaceFirst(nodes, 'to', ' ', 'top')
|
||||
} else if (direction === '90deg') {
|
||||
nodes = this.replaceFirst(nodes, 'to', ' ', 'right')
|
||||
} else if (direction === '180deg') {
|
||||
nodes = this.replaceFirst(nodes, 'to', ' ', 'bottom') // default value
|
||||
} else if (direction === '270deg') {
|
||||
nodes = this.replaceFirst(nodes, 'to', ' ', 'left')
|
||||
}
|
||||
}
|
||||
|
||||
return nodes
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace old direction to new
|
||||
*/
|
||||
newDirection(params) {
|
||||
if (params[0].value === 'to') {
|
||||
return params
|
||||
}
|
||||
IS_DIRECTION.lastIndex = 0 // reset search index of global regexp
|
||||
if (!IS_DIRECTION.test(params[0].value)) {
|
||||
return params
|
||||
}
|
||||
|
||||
params.unshift(
|
||||
{
|
||||
type: 'word',
|
||||
value: 'to'
|
||||
},
|
||||
{
|
||||
type: 'space',
|
||||
value: ' '
|
||||
}
|
||||
)
|
||||
|
||||
for (let i = 2; i < params.length; i++) {
|
||||
if (params[i].type === 'div') {
|
||||
break
|
||||
}
|
||||
if (params[i].type === 'word') {
|
||||
params[i].value = this.revertDirection(params[i].value)
|
||||
}
|
||||
}
|
||||
|
||||
return params
|
||||
}
|
||||
|
||||
/**
|
||||
* Look for at word
|
||||
*/
|
||||
isRadial(params) {
|
||||
let state = 'before'
|
||||
for (let param of params) {
|
||||
if (state === 'before' && param.type === 'space') {
|
||||
state = 'at'
|
||||
} else if (state === 'at' && param.value === 'at') {
|
||||
state = 'after'
|
||||
} else if (state === 'after' && param.type === 'space') {
|
||||
return true
|
||||
} else if (param.type === 'div') {
|
||||
break
|
||||
} else {
|
||||
state = 'before'
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* Change new direction to old
|
||||
*/
|
||||
convertDirection(params) {
|
||||
if (params.length > 0) {
|
||||
if (params[0].value === 'to') {
|
||||
this.fixDirection(params)
|
||||
} else if (params[0].value.includes('deg')) {
|
||||
this.fixAngle(params)
|
||||
} else if (this.isRadial(params)) {
|
||||
this.fixRadial(params)
|
||||
}
|
||||
}
|
||||
return params
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace `to top left` to `bottom right`
|
||||
*/
|
||||
fixDirection(params) {
|
||||
params.splice(0, 2)
|
||||
|
||||
for (let param of params) {
|
||||
if (param.type === 'div') {
|
||||
break
|
||||
}
|
||||
if (param.type === 'word') {
|
||||
param.value = this.revertDirection(param.value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add 90 degrees
|
||||
*/
|
||||
fixAngle(params) {
|
||||
let first = params[0].value
|
||||
first = parseFloat(first)
|
||||
first = Math.abs(450 - first) % 360
|
||||
first = this.roundFloat(first, 3)
|
||||
params[0].value = `${first}deg`
|
||||
}
|
||||
|
||||
/**
|
||||
* Fix radial direction syntax
|
||||
*/
|
||||
fixRadial(params) {
|
||||
let first = []
|
||||
let second = []
|
||||
let a, b, c, i, next
|
||||
|
||||
for (i = 0; i < params.length - 2; i++) {
|
||||
a = params[i]
|
||||
b = params[i + 1]
|
||||
c = params[i + 2]
|
||||
if (a.type === 'space' && b.value === 'at' && c.type === 'space') {
|
||||
next = i + 3
|
||||
break
|
||||
} else {
|
||||
first.push(a)
|
||||
}
|
||||
}
|
||||
|
||||
let div
|
||||
for (i = next; i < params.length; i++) {
|
||||
if (params[i].type === 'div') {
|
||||
div = params[i]
|
||||
break
|
||||
} else {
|
||||
second.push(params[i])
|
||||
}
|
||||
}
|
||||
|
||||
params.splice(0, i, ...second, div, ...first)
|
||||
}
|
||||
|
||||
revertDirection(word) {
|
||||
return Gradient.directions[word.toLowerCase()] || word
|
||||
}
|
||||
|
||||
/**
|
||||
* Round float and save digits under dot
|
||||
*/
|
||||
roundFloat(float, digits) {
|
||||
return parseFloat(float.toFixed(digits))
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert to old webkit syntax
|
||||
*/
|
||||
oldWebkit(node) {
|
||||
let { nodes } = node
|
||||
let string = parser.stringify(node.nodes)
|
||||
|
||||
if (this.name !== 'linear-gradient') {
|
||||
return false
|
||||
}
|
||||
if (nodes[0] && nodes[0].value.includes('deg')) {
|
||||
return false
|
||||
}
|
||||
if (
|
||||
string.includes('px') ||
|
||||
string.includes('-corner') ||
|
||||
string.includes('-side')
|
||||
) {
|
||||
return false
|
||||
}
|
||||
|
||||
let params = [[]]
|
||||
for (let i of nodes) {
|
||||
params[params.length - 1].push(i)
|
||||
if (i.type === 'div' && i.value === ',') {
|
||||
params.push([])
|
||||
}
|
||||
}
|
||||
|
||||
this.oldDirection(params)
|
||||
this.colorStops(params)
|
||||
|
||||
node.nodes = []
|
||||
for (let param of params) {
|
||||
node.nodes = node.nodes.concat(param)
|
||||
}
|
||||
|
||||
node.nodes.unshift(
|
||||
{ type: 'word', value: 'linear' },
|
||||
this.cloneDiv(node.nodes)
|
||||
)
|
||||
node.value = '-webkit-gradient'
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
/**
|
||||
* Change direction syntax to old webkit
|
||||
*/
|
||||
oldDirection(params) {
|
||||
let div = this.cloneDiv(params[0])
|
||||
|
||||
if (params[0][0].value !== 'to') {
|
||||
return params.unshift([
|
||||
{ type: 'word', value: Gradient.oldDirections.bottom },
|
||||
div
|
||||
])
|
||||
} else {
|
||||
let words = []
|
||||
for (let node of params[0].slice(2)) {
|
||||
if (node.type === 'word') {
|
||||
words.push(node.value.toLowerCase())
|
||||
}
|
||||
}
|
||||
|
||||
words = words.join(' ')
|
||||
let old = Gradient.oldDirections[words] || words
|
||||
|
||||
params[0] = [{ type: 'word', value: old }, div]
|
||||
return params[0]
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get div token from exists parameters
|
||||
*/
|
||||
cloneDiv(params) {
|
||||
for (let i of params) {
|
||||
if (i.type === 'div' && i.value === ',') {
|
||||
return i
|
||||
}
|
||||
}
|
||||
return { type: 'div', value: ',', after: ' ' }
|
||||
}
|
||||
|
||||
/**
|
||||
* Change colors syntax to old webkit
|
||||
*/
|
||||
colorStops(params) {
|
||||
let result = []
|
||||
for (let i = 0; i < params.length; i++) {
|
||||
let pos
|
||||
let param = params[i]
|
||||
let item
|
||||
if (i === 0) {
|
||||
continue
|
||||
}
|
||||
|
||||
let color = parser.stringify(param[0])
|
||||
if (param[1] && param[1].type === 'word') {
|
||||
pos = param[1].value
|
||||
} else if (param[2] && param[2].type === 'word') {
|
||||
pos = param[2].value
|
||||
}
|
||||
|
||||
let stop
|
||||
if (i === 1 && (!pos || pos === '0%')) {
|
||||
stop = `from(${color})`
|
||||
} else if (i === params.length - 1 && (!pos || pos === '100%')) {
|
||||
stop = `to(${color})`
|
||||
} else if (pos) {
|
||||
stop = `color-stop(${pos}, ${color})`
|
||||
} else {
|
||||
stop = `color-stop(${color})`
|
||||
}
|
||||
|
||||
let div = param[param.length - 1]
|
||||
params[i] = [{ type: 'word', value: stop }]
|
||||
if (div.type === 'div' && div.value === ',') {
|
||||
item = params[i].push(div)
|
||||
}
|
||||
result.push(item)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove old WebKit gradient too
|
||||
*/
|
||||
old(prefix) {
|
||||
if (prefix === '-webkit-') {
|
||||
let type
|
||||
if (this.name === 'linear-gradient') {
|
||||
type = 'linear'
|
||||
} else if (this.name === 'repeating-linear-gradient') {
|
||||
type = 'repeating-linear'
|
||||
} else if (this.name === 'repeating-radial-gradient') {
|
||||
type = 'repeating-radial'
|
||||
} else {
|
||||
type = 'radial'
|
||||
}
|
||||
let string = '-gradient'
|
||||
let regexp = utils.regexp(
|
||||
`-webkit-(${type}-gradient|gradient\\(\\s*${type})`,
|
||||
false
|
||||
)
|
||||
|
||||
return new OldValue(this.name, prefix + this.name, string, regexp)
|
||||
} else {
|
||||
return super.old(prefix)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Do not add non-webkit prefixes for list-style and object
|
||||
*/
|
||||
add(decl, prefix) {
|
||||
let p = decl.prop
|
||||
if (p.includes('mask')) {
|
||||
if (prefix === '-webkit-' || prefix === '-webkit- old') {
|
||||
return super.add(decl, prefix)
|
||||
}
|
||||
} else if (
|
||||
p === 'list-style' ||
|
||||
p === 'list-style-image' ||
|
||||
p === 'content'
|
||||
) {
|
||||
if (prefix === '-webkit-' || prefix === '-webkit- old') {
|
||||
return super.add(decl, prefix)
|
||||
}
|
||||
} else {
|
||||
return super.add(decl, prefix)
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
Gradient.names = [
|
||||
'linear-gradient',
|
||||
'repeating-linear-gradient',
|
||||
'radial-gradient',
|
||||
'repeating-radial-gradient'
|
||||
]
|
||||
|
||||
Gradient.directions = {
|
||||
top: 'bottom', // default value
|
||||
left: 'right',
|
||||
bottom: 'top',
|
||||
right: 'left'
|
||||
}
|
||||
|
||||
// Direction to replace
|
||||
Gradient.oldDirections = {
|
||||
'top': 'left bottom, left top',
|
||||
'left': 'right top, left top',
|
||||
'bottom': 'left top, left bottom',
|
||||
'right': 'left top, right top',
|
||||
|
||||
'top right': 'left bottom, right top',
|
||||
'top left': 'right bottom, left top',
|
||||
'right top': 'left bottom, right top',
|
||||
'right bottom': 'left top, right bottom',
|
||||
'bottom right': 'left top, right bottom',
|
||||
'bottom left': 'right top, left bottom',
|
||||
'left top': 'right bottom, left top',
|
||||
'left bottom': 'right top, left bottom'
|
||||
}
|
||||
|
||||
module.exports = Gradient
|
||||
Reference in New Issue
Block a user