mirror of
https://github.com/titanscouting/tra-analysis.git
synced 2025-07-26 12:48:50 +00:00
apps
data analysis
website
functions
node_modules
.bin
@firebase
@google-cloud
@grpc
@mrmlnc
@nodelib
@protobufjs
aspromise
base64
codegen
eventemitter
fetch
float
bench
tests
LICENSE
README.md
index.d.ts
index.js
package.json
inquire
path
pool
utf8
@types
accepts
acorn
acorn-es7-plugin
ajv
ansi-regex
arr-diff
arr-flatten
arr-union
array-filter
array-flatten
array-union
array-uniq
array-unique
arrify
ascli
asn1
assert-plus
assign-symbols
async
asynckit
atob
aws-sign2
aws4
axios
balanced-match
base
bcrypt-pbkdf
body-parser
brace-expansion
braces
buffer-equal-constant-time
buffer-from
bun
bytebuffer
bytes
cache-base
call-me-maybe
call-signature
camelcase
capture-stack-trace
caseless
class-utils
cliui
code-point-at
collection-visit
colour
combined-stream
component-emitter
compressible
concat-map
concat-stream
configstore
content-disposition
content-type
cookie
cookie-signature
copy-descriptor
core-js
core-util-is
cors
create-error-class
crypto-random-string
dashdash
debug
decamelize
decode-uri-component
deep-equal
define-properties
define-property
delayed-stream
depd
destroy
diff-match-patch
dir-glob
dom-storage
dot-prop
duplexify
eastasianwidth
ecc-jsbn
ecdsa-sig-formatter
ee-first
empower
empower-core
encodeurl
end-of-stream
ent
escape-html
espurify
estraverse
etag
expand-brackets
express
extend
extend-shallow
extglob
extsprintf
fast-deep-equal
fast-glob
fast-json-stable-stringify
faye-websocket
fill-range
finalhandler
firebase-admin
firebase-functions
follow-redirects
for-in
forever-agent
form-data
forwarded
fragment-cache
fresh
fs.realpath
functional-red-black-tree
gcp-metadata
gcs-resumable-upload
get-value
getpass
glob
glob-parent
glob-to-regexp
globby
google-auth-library
google-auto-auth
google-gax
google-p12-pem
google-proto-files
graceful-fs
grpc
gtoken
har-schema
har-validator
has-value
has-values
hash-stream-validation
http-errors
http-parser-js
http-signature
iconv-lite
ignore
imurmurhash
indexof
inflight
inherits
invert-kv
ipaddr.js
is
is-accessor-descriptor
is-buffer
is-data-descriptor
is-descriptor
is-extendable
is-extglob
is-fullwidth-code-point
is-glob
is-number
is-obj
is-plain-object
is-stream-ended
is-typedarray
is-windows
isarray
isobject
isstream
jsbn
json-schema
json-schema-traverse
json-stringify-safe
jsonwebtoken
jsprim
jwa
jws
kind-of
lcid
lodash
lodash.camelcase
lodash.clone
lodash.includes
lodash.isboolean
lodash.isinteger
lodash.isnumber
lodash.isplainobject
lodash.isstring
lodash.merge
lodash.once
log-driver
long
lru-cache
make-dir
map-cache
map-visit
media-typer
merge-descriptors
merge2
methmeth
methods
micromatch
mime
mime-db
mime-types
minimatch
mixin-deep
modelo
ms
nan
nanomatch
negotiator
node-forge
number-is-nan
oauth-sign
object-assign
object-copy
object-keys
object-visit
object.pick
on-finished
once
optjs
os-locale
parseurl
pascalcase
path-dirname
path-is-absolute
path-to-regexp
path-type
performance-now
pify
posix-character-classes
power-assert
power-assert-context-formatter
power-assert-context-reducer-ast
power-assert-context-traversal
power-assert-formatter
power-assert-renderer-assertion
power-assert-renderer-base
power-assert-renderer-comparison
power-assert-renderer-diagram
power-assert-renderer-file
power-assert-util-string-width
process-nextick-args
protobufjs
proxy-addr
pseudomap
psl
pump
pumpify
punycode
qs
range-parser
raw-body
readable-stream
regex-not
repeat-element
repeat-string
request
resolve-url
ret
retry-axios
retry-request
safe-buffer
safe-regex
safer-buffer
send
serve-static
set-value
setprototypeof
signal-exit
slash
snakeize
snapdragon
snapdragon-node
snapdragon-util
source-map
source-map-resolve
source-map-url
split-array-stream
split-string
sshpk
static-extend
statuses
stream-events
stream-shift
string-format-obj
string-width
string_decoder
stringifier
strip-ansi
stubs
through2
to-object-path
to-regex
to-regex-range
tough-cookie
traverse
tslib
tunnel-agent
tweetnacl
type-is
type-name
typedarray
union-value
unique-string
universal-deep-strict-equal
unpipe
unset-value
uri-js
urix
use
util-deprecate
utils-merge
uuid
vary
verror
websocket-driver
websocket-extensions
window-size
wrap-ansi
wrappy
write-file-atomic
xdg-basedir
xmlhttprequest
xtend
y18n
yallist
yargs
index.js
package-lock.json
package.json
node_modules
public
.firebaserc
.gitignore
.runtimeconfig.json
firebase.json
firestore.indexes.json
firestore.rules
package-lock.json
.gitattributes
.gitignore
README.md
336 lines
11 KiB
JavaScript
336 lines
11 KiB
JavaScript
"use strict";
|
|
|
|
module.exports = factory(factory);
|
|
|
|
/**
|
|
* Reads / writes floats / doubles from / to buffers.
|
|
* @name util.float
|
|
* @namespace
|
|
*/
|
|
|
|
/**
|
|
* Writes a 32 bit float to a buffer using little endian byte order.
|
|
* @name util.float.writeFloatLE
|
|
* @function
|
|
* @param {number} val Value to write
|
|
* @param {Uint8Array} buf Target buffer
|
|
* @param {number} pos Target buffer offset
|
|
* @returns {undefined}
|
|
*/
|
|
|
|
/**
|
|
* Writes a 32 bit float to a buffer using big endian byte order.
|
|
* @name util.float.writeFloatBE
|
|
* @function
|
|
* @param {number} val Value to write
|
|
* @param {Uint8Array} buf Target buffer
|
|
* @param {number} pos Target buffer offset
|
|
* @returns {undefined}
|
|
*/
|
|
|
|
/**
|
|
* Reads a 32 bit float from a buffer using little endian byte order.
|
|
* @name util.float.readFloatLE
|
|
* @function
|
|
* @param {Uint8Array} buf Source buffer
|
|
* @param {number} pos Source buffer offset
|
|
* @returns {number} Value read
|
|
*/
|
|
|
|
/**
|
|
* Reads a 32 bit float from a buffer using big endian byte order.
|
|
* @name util.float.readFloatBE
|
|
* @function
|
|
* @param {Uint8Array} buf Source buffer
|
|
* @param {number} pos Source buffer offset
|
|
* @returns {number} Value read
|
|
*/
|
|
|
|
/**
|
|
* Writes a 64 bit double to a buffer using little endian byte order.
|
|
* @name util.float.writeDoubleLE
|
|
* @function
|
|
* @param {number} val Value to write
|
|
* @param {Uint8Array} buf Target buffer
|
|
* @param {number} pos Target buffer offset
|
|
* @returns {undefined}
|
|
*/
|
|
|
|
/**
|
|
* Writes a 64 bit double to a buffer using big endian byte order.
|
|
* @name util.float.writeDoubleBE
|
|
* @function
|
|
* @param {number} val Value to write
|
|
* @param {Uint8Array} buf Target buffer
|
|
* @param {number} pos Target buffer offset
|
|
* @returns {undefined}
|
|
*/
|
|
|
|
/**
|
|
* Reads a 64 bit double from a buffer using little endian byte order.
|
|
* @name util.float.readDoubleLE
|
|
* @function
|
|
* @param {Uint8Array} buf Source buffer
|
|
* @param {number} pos Source buffer offset
|
|
* @returns {number} Value read
|
|
*/
|
|
|
|
/**
|
|
* Reads a 64 bit double from a buffer using big endian byte order.
|
|
* @name util.float.readDoubleBE
|
|
* @function
|
|
* @param {Uint8Array} buf Source buffer
|
|
* @param {number} pos Source buffer offset
|
|
* @returns {number} Value read
|
|
*/
|
|
|
|
// Factory function for the purpose of node-based testing in modified global environments
|
|
function factory(exports) {
|
|
|
|
// float: typed array
|
|
if (typeof Float32Array !== "undefined") (function() {
|
|
|
|
var f32 = new Float32Array([ -0 ]),
|
|
f8b = new Uint8Array(f32.buffer),
|
|
le = f8b[3] === 128;
|
|
|
|
function writeFloat_f32_cpy(val, buf, pos) {
|
|
f32[0] = val;
|
|
buf[pos ] = f8b[0];
|
|
buf[pos + 1] = f8b[1];
|
|
buf[pos + 2] = f8b[2];
|
|
buf[pos + 3] = f8b[3];
|
|
}
|
|
|
|
function writeFloat_f32_rev(val, buf, pos) {
|
|
f32[0] = val;
|
|
buf[pos ] = f8b[3];
|
|
buf[pos + 1] = f8b[2];
|
|
buf[pos + 2] = f8b[1];
|
|
buf[pos + 3] = f8b[0];
|
|
}
|
|
|
|
/* istanbul ignore next */
|
|
exports.writeFloatLE = le ? writeFloat_f32_cpy : writeFloat_f32_rev;
|
|
/* istanbul ignore next */
|
|
exports.writeFloatBE = le ? writeFloat_f32_rev : writeFloat_f32_cpy;
|
|
|
|
function readFloat_f32_cpy(buf, pos) {
|
|
f8b[0] = buf[pos ];
|
|
f8b[1] = buf[pos + 1];
|
|
f8b[2] = buf[pos + 2];
|
|
f8b[3] = buf[pos + 3];
|
|
return f32[0];
|
|
}
|
|
|
|
function readFloat_f32_rev(buf, pos) {
|
|
f8b[3] = buf[pos ];
|
|
f8b[2] = buf[pos + 1];
|
|
f8b[1] = buf[pos + 2];
|
|
f8b[0] = buf[pos + 3];
|
|
return f32[0];
|
|
}
|
|
|
|
/* istanbul ignore next */
|
|
exports.readFloatLE = le ? readFloat_f32_cpy : readFloat_f32_rev;
|
|
/* istanbul ignore next */
|
|
exports.readFloatBE = le ? readFloat_f32_rev : readFloat_f32_cpy;
|
|
|
|
// float: ieee754
|
|
})(); else (function() {
|
|
|
|
function writeFloat_ieee754(writeUint, val, buf, pos) {
|
|
var sign = val < 0 ? 1 : 0;
|
|
if (sign)
|
|
val = -val;
|
|
if (val === 0)
|
|
writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos);
|
|
else if (isNaN(val))
|
|
writeUint(2143289344, buf, pos);
|
|
else if (val > 3.4028234663852886e+38) // +-Infinity
|
|
writeUint((sign << 31 | 2139095040) >>> 0, buf, pos);
|
|
else if (val < 1.1754943508222875e-38) // denormal
|
|
writeUint((sign << 31 | Math.round(val / 1.401298464324817e-45)) >>> 0, buf, pos);
|
|
else {
|
|
var exponent = Math.floor(Math.log(val) / Math.LN2),
|
|
mantissa = Math.round(val * Math.pow(2, -exponent) * 8388608) & 8388607;
|
|
writeUint((sign << 31 | exponent + 127 << 23 | mantissa) >>> 0, buf, pos);
|
|
}
|
|
}
|
|
|
|
exports.writeFloatLE = writeFloat_ieee754.bind(null, writeUintLE);
|
|
exports.writeFloatBE = writeFloat_ieee754.bind(null, writeUintBE);
|
|
|
|
function readFloat_ieee754(readUint, buf, pos) {
|
|
var uint = readUint(buf, pos),
|
|
sign = (uint >> 31) * 2 + 1,
|
|
exponent = uint >>> 23 & 255,
|
|
mantissa = uint & 8388607;
|
|
return exponent === 255
|
|
? mantissa
|
|
? NaN
|
|
: sign * Infinity
|
|
: exponent === 0 // denormal
|
|
? sign * 1.401298464324817e-45 * mantissa
|
|
: sign * Math.pow(2, exponent - 150) * (mantissa + 8388608);
|
|
}
|
|
|
|
exports.readFloatLE = readFloat_ieee754.bind(null, readUintLE);
|
|
exports.readFloatBE = readFloat_ieee754.bind(null, readUintBE);
|
|
|
|
})();
|
|
|
|
// double: typed array
|
|
if (typeof Float64Array !== "undefined") (function() {
|
|
|
|
var f64 = new Float64Array([-0]),
|
|
f8b = new Uint8Array(f64.buffer),
|
|
le = f8b[7] === 128;
|
|
|
|
function writeDouble_f64_cpy(val, buf, pos) {
|
|
f64[0] = val;
|
|
buf[pos ] = f8b[0];
|
|
buf[pos + 1] = f8b[1];
|
|
buf[pos + 2] = f8b[2];
|
|
buf[pos + 3] = f8b[3];
|
|
buf[pos + 4] = f8b[4];
|
|
buf[pos + 5] = f8b[5];
|
|
buf[pos + 6] = f8b[6];
|
|
buf[pos + 7] = f8b[7];
|
|
}
|
|
|
|
function writeDouble_f64_rev(val, buf, pos) {
|
|
f64[0] = val;
|
|
buf[pos ] = f8b[7];
|
|
buf[pos + 1] = f8b[6];
|
|
buf[pos + 2] = f8b[5];
|
|
buf[pos + 3] = f8b[4];
|
|
buf[pos + 4] = f8b[3];
|
|
buf[pos + 5] = f8b[2];
|
|
buf[pos + 6] = f8b[1];
|
|
buf[pos + 7] = f8b[0];
|
|
}
|
|
|
|
/* istanbul ignore next */
|
|
exports.writeDoubleLE = le ? writeDouble_f64_cpy : writeDouble_f64_rev;
|
|
/* istanbul ignore next */
|
|
exports.writeDoubleBE = le ? writeDouble_f64_rev : writeDouble_f64_cpy;
|
|
|
|
function readDouble_f64_cpy(buf, pos) {
|
|
f8b[0] = buf[pos ];
|
|
f8b[1] = buf[pos + 1];
|
|
f8b[2] = buf[pos + 2];
|
|
f8b[3] = buf[pos + 3];
|
|
f8b[4] = buf[pos + 4];
|
|
f8b[5] = buf[pos + 5];
|
|
f8b[6] = buf[pos + 6];
|
|
f8b[7] = buf[pos + 7];
|
|
return f64[0];
|
|
}
|
|
|
|
function readDouble_f64_rev(buf, pos) {
|
|
f8b[7] = buf[pos ];
|
|
f8b[6] = buf[pos + 1];
|
|
f8b[5] = buf[pos + 2];
|
|
f8b[4] = buf[pos + 3];
|
|
f8b[3] = buf[pos + 4];
|
|
f8b[2] = buf[pos + 5];
|
|
f8b[1] = buf[pos + 6];
|
|
f8b[0] = buf[pos + 7];
|
|
return f64[0];
|
|
}
|
|
|
|
/* istanbul ignore next */
|
|
exports.readDoubleLE = le ? readDouble_f64_cpy : readDouble_f64_rev;
|
|
/* istanbul ignore next */
|
|
exports.readDoubleBE = le ? readDouble_f64_rev : readDouble_f64_cpy;
|
|
|
|
// double: ieee754
|
|
})(); else (function() {
|
|
|
|
function writeDouble_ieee754(writeUint, off0, off1, val, buf, pos) {
|
|
var sign = val < 0 ? 1 : 0;
|
|
if (sign)
|
|
val = -val;
|
|
if (val === 0) {
|
|
writeUint(0, buf, pos + off0);
|
|
writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos + off1);
|
|
} else if (isNaN(val)) {
|
|
writeUint(0, buf, pos + off0);
|
|
writeUint(2146959360, buf, pos + off1);
|
|
} else if (val > 1.7976931348623157e+308) { // +-Infinity
|
|
writeUint(0, buf, pos + off0);
|
|
writeUint((sign << 31 | 2146435072) >>> 0, buf, pos + off1);
|
|
} else {
|
|
var mantissa;
|
|
if (val < 2.2250738585072014e-308) { // denormal
|
|
mantissa = val / 5e-324;
|
|
writeUint(mantissa >>> 0, buf, pos + off0);
|
|
writeUint((sign << 31 | mantissa / 4294967296) >>> 0, buf, pos + off1);
|
|
} else {
|
|
var exponent = Math.floor(Math.log(val) / Math.LN2);
|
|
if (exponent === 1024)
|
|
exponent = 1023;
|
|
mantissa = val * Math.pow(2, -exponent);
|
|
writeUint(mantissa * 4503599627370496 >>> 0, buf, pos + off0);
|
|
writeUint((sign << 31 | exponent + 1023 << 20 | mantissa * 1048576 & 1048575) >>> 0, buf, pos + off1);
|
|
}
|
|
}
|
|
}
|
|
|
|
exports.writeDoubleLE = writeDouble_ieee754.bind(null, writeUintLE, 0, 4);
|
|
exports.writeDoubleBE = writeDouble_ieee754.bind(null, writeUintBE, 4, 0);
|
|
|
|
function readDouble_ieee754(readUint, off0, off1, buf, pos) {
|
|
var lo = readUint(buf, pos + off0),
|
|
hi = readUint(buf, pos + off1);
|
|
var sign = (hi >> 31) * 2 + 1,
|
|
exponent = hi >>> 20 & 2047,
|
|
mantissa = 4294967296 * (hi & 1048575) + lo;
|
|
return exponent === 2047
|
|
? mantissa
|
|
? NaN
|
|
: sign * Infinity
|
|
: exponent === 0 // denormal
|
|
? sign * 5e-324 * mantissa
|
|
: sign * Math.pow(2, exponent - 1075) * (mantissa + 4503599627370496);
|
|
}
|
|
|
|
exports.readDoubleLE = readDouble_ieee754.bind(null, readUintLE, 0, 4);
|
|
exports.readDoubleBE = readDouble_ieee754.bind(null, readUintBE, 4, 0);
|
|
|
|
})();
|
|
|
|
return exports;
|
|
}
|
|
|
|
// uint helpers
|
|
|
|
function writeUintLE(val, buf, pos) {
|
|
buf[pos ] = val & 255;
|
|
buf[pos + 1] = val >>> 8 & 255;
|
|
buf[pos + 2] = val >>> 16 & 255;
|
|
buf[pos + 3] = val >>> 24;
|
|
}
|
|
|
|
function writeUintBE(val, buf, pos) {
|
|
buf[pos ] = val >>> 24;
|
|
buf[pos + 1] = val >>> 16 & 255;
|
|
buf[pos + 2] = val >>> 8 & 255;
|
|
buf[pos + 3] = val & 255;
|
|
}
|
|
|
|
function readUintLE(buf, pos) {
|
|
return (buf[pos ]
|
|
| buf[pos + 1] << 8
|
|
| buf[pos + 2] << 16
|
|
| buf[pos + 3] << 24) >>> 0;
|
|
}
|
|
|
|
function readUintBE(buf, pos) {
|
|
return (buf[pos ] << 24
|
|
| buf[pos + 1] << 16
|
|
| buf[pos + 2] << 8
|
|
| buf[pos + 3]) >>> 0;
|
|
}
|