Comparing version 1.7.0 to 1.7.1
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
typeof define === 'function' && define.amd ? define(['exports'], factory) : | ||
(factory((global.vega = global.vega || {}))); | ||
}(this, (function (exports) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
typeof define === 'function' && define.amd ? define(['exports'], factory) : | ||
factory(global.vega = {}); | ||
}(typeof self !== 'undefined' ? self : this, function (exports) { 'use strict'; | ||
var accessor = function(fn, fields, name) { | ||
fn.fields = fields || []; | ||
fn.fname = name; | ||
return fn; | ||
}; | ||
function accessor(fn, fields, name) { | ||
fn.fields = fields || []; | ||
fn.fname = name; | ||
return fn; | ||
} | ||
function accessorName(fn) { | ||
return fn == null ? null : fn.fname; | ||
} | ||
function accessorName(fn) { | ||
return fn == null ? null : fn.fname; | ||
} | ||
function accessorFields(fn) { | ||
return fn == null ? null : fn.fields; | ||
} | ||
function accessorFields(fn) { | ||
return fn == null ? null : fn.fields; | ||
} | ||
var error = function(message) { | ||
throw Error(message); | ||
}; | ||
function error(message) { | ||
throw Error(message); | ||
} | ||
var splitAccessPath = function(p) { | ||
var path = [], | ||
q = null, | ||
b = 0, | ||
n = p.length, | ||
s = '', | ||
i, j, c; | ||
function splitAccessPath(p) { | ||
var path = [], | ||
q = null, | ||
b = 0, | ||
n = p.length, | ||
s = '', | ||
i, j, c; | ||
p = p + ''; | ||
p = p + ''; | ||
function push() { | ||
path.push(s + p.substring(i, j)); | ||
s = ''; | ||
i = j + 1; | ||
} | ||
function push() { | ||
path.push(s + p.substring(i, j)); | ||
s = ''; | ||
i = j + 1; | ||
} | ||
for (i=j=0; j<n; ++j) { | ||
c = p[j]; | ||
if (c === '\\') { | ||
s += p.substring(i, j); | ||
i = ++j; | ||
} else if (c === q) { | ||
push(); | ||
q = null; | ||
b = -1; | ||
} else if (q) { | ||
continue; | ||
} else if (i === b && c === '"') { | ||
i = j + 1; | ||
q = c; | ||
} else if (i === b && c === "'") { | ||
i = j + 1; | ||
q = c; | ||
} else if (c === '.' && !b) { | ||
if (j > i) { | ||
for (i=j=0; j<n; ++j) { | ||
c = p[j]; | ||
if (c === '\\') { | ||
s += p.substring(i, j); | ||
i = ++j; | ||
} else if (c === q) { | ||
push(); | ||
} else { | ||
q = null; | ||
b = -1; | ||
} else if (q) { | ||
continue; | ||
} else if (i === b && c === '"') { | ||
i = j + 1; | ||
q = c; | ||
} else if (i === b && c === "'") { | ||
i = j + 1; | ||
q = c; | ||
} else if (c === '.' && !b) { | ||
if (j > i) { | ||
push(); | ||
} else { | ||
i = j + 1; | ||
} | ||
} else if (c === '[') { | ||
if (j > i) push(); | ||
b = i = j + 1; | ||
} else if (c === ']') { | ||
if (!b) error('Access path missing open bracket: ' + p); | ||
if (b > 0) push(); | ||
b = 0; | ||
i = j + 1; | ||
} | ||
} else if (c === '[') { | ||
if (j > i) push(); | ||
b = i = j + 1; | ||
} else if (c === ']') { | ||
if (!b) error('Access path missing open bracket: ' + p); | ||
if (b > 0) push(); | ||
b = 0; | ||
i = j + 1; | ||
} | ||
} | ||
if (b) error('Access path missing closing bracket: ' + p); | ||
if (q) error('Access path missing closing quote: ' + p); | ||
if (b) error('Access path missing closing bracket: ' + p); | ||
if (q) error('Access path missing closing quote: ' + p); | ||
if (j > i) { | ||
j++; | ||
push(); | ||
if (j > i) { | ||
j++; | ||
push(); | ||
} | ||
return path; | ||
} | ||
return path; | ||
}; | ||
var isArray = Array.isArray; | ||
var isArray = Array.isArray; | ||
function isObject(_) { | ||
return _ === Object(_); | ||
} | ||
var isObject = function(_) { | ||
return _ === Object(_); | ||
}; | ||
function isString(_) { | ||
return typeof _ === 'string'; | ||
} | ||
var isString = function(_) { | ||
return typeof _ === 'string'; | ||
}; | ||
function $(x) { | ||
return isArray(x) ? '[' + x.map($) + ']' | ||
: isObject(x) || isString(x) ? | ||
// Output valid JSON and JS source strings. | ||
// See http://timelessrepo.com/json-isnt-a-javascript-subset | ||
JSON.stringify(x).replace('\u2028','\\u2028').replace('\u2029', '\\u2029') | ||
: x; | ||
} | ||
function $(x) { | ||
return isArray(x) ? '[' + x.map($) + ']' | ||
: isObject(x) || isString(x) ? | ||
// Output valid JSON and JS source strings. | ||
// See http://timelessrepo.com/json-isnt-a-javascript-subset | ||
JSON.stringify(x).replace('\u2028','\\u2028').replace('\u2029', '\\u2029') | ||
: x; | ||
} | ||
function field(field, name) { | ||
var path = splitAccessPath(field), | ||
code = 'return _[' + path.map($).join('][') + '];'; | ||
var field = function(field, name) { | ||
var path = splitAccessPath(field), | ||
code = 'return _[' + path.map($).join('][') + '];'; | ||
return accessor( | ||
Function('_', code), | ||
[(field = path.length===1 ? path[0] : field)], | ||
name || field | ||
); | ||
} | ||
return accessor( | ||
Function('_', code), | ||
[(field = path.length===1 ? path[0] : field)], | ||
name || field | ||
); | ||
}; | ||
var empty = []; | ||
var empty = []; | ||
var id = field('id'); | ||
var id = field('id'); | ||
var identity = accessor(function(_) { return _; }, empty, 'identity'); | ||
var identity = accessor(function(_) { return _; }, empty, 'identity'); | ||
var zero = accessor(function() { return 0; }, empty, 'zero'); | ||
var zero = accessor(function() { return 0; }, empty, 'zero'); | ||
var one = accessor(function() { return 1; }, empty, 'one'); | ||
var one = accessor(function() { return 1; }, empty, 'one'); | ||
var truthy = accessor(function() { return true; }, empty, 'true'); | ||
var truthy = accessor(function() { return true; }, empty, 'true'); | ||
var falsy = accessor(function() { return false; }, empty, 'false'); | ||
var falsy = accessor(function() { return false; }, empty, 'false'); | ||
function log(method, level, input) { | ||
var args = [level].concat([].slice.call(input)); | ||
console[method].apply(console, args); // eslint-disable-line no-console | ||
} | ||
function log(method, level, input) { | ||
var args = [level].concat([].slice.call(input)); | ||
console[method].apply(console, args); // eslint-disable-line no-console | ||
} | ||
var None = 0; | ||
var Error$1 = 1; | ||
var Warn = 2; | ||
var Info = 3; | ||
var Debug = 4; | ||
var None = 0; | ||
var Error$1 = 1; | ||
var Warn = 2; | ||
var Info = 3; | ||
var Debug = 4; | ||
var logger = function(_) { | ||
var level = _ || None; | ||
return { | ||
level: function(_) { | ||
if (arguments.length) { | ||
level = +_; | ||
function logger(_) { | ||
var level = _ || None; | ||
return { | ||
level: function(_) { | ||
if (arguments.length) { | ||
level = +_; | ||
return this; | ||
} else { | ||
return level; | ||
} | ||
}, | ||
error: function() { | ||
if (level >= Error$1) log('error', 'ERROR', arguments); | ||
return this; | ||
} else { | ||
return level; | ||
}, | ||
warn: function() { | ||
if (level >= Warn) log('warn', 'WARN', arguments); | ||
return this; | ||
}, | ||
info: function() { | ||
if (level >= Info) log('log', 'INFO', arguments); | ||
return this; | ||
}, | ||
debug: function() { | ||
if (level >= Debug) log('log', 'DEBUG', arguments); | ||
return this; | ||
} | ||
}, | ||
error: function() { | ||
if (level >= Error$1) log('error', 'ERROR', arguments); | ||
return this; | ||
}, | ||
warn: function() { | ||
if (level >= Warn) log('warn', 'WARN', arguments); | ||
return this; | ||
}, | ||
info: function() { | ||
if (level >= Info) log('log', 'INFO', arguments); | ||
return this; | ||
}, | ||
debug: function() { | ||
if (level >= Debug) log('log', 'DEBUG', arguments); | ||
return this; | ||
} | ||
} | ||
}; | ||
var peek = function(array) { | ||
return array[array.length - 1]; | ||
}; | ||
function peek(array) { | ||
return array[array.length - 1]; | ||
} | ||
var toNumber = function(_) { | ||
return _ == null || _ === '' ? null : +_; | ||
}; | ||
function toNumber(_) { | ||
return _ == null || _ === '' ? null : +_; | ||
} | ||
function exp(sign) { | ||
return function(x) { return sign * Math.exp(x); }; | ||
} | ||
function exp(sign) { | ||
return function(x) { return sign * Math.exp(x); }; | ||
} | ||
function log$1(sign) { | ||
return function(x) { return Math.log(sign * x); }; | ||
} | ||
function log$1(sign) { | ||
return function(x) { return Math.log(sign * x); }; | ||
} | ||
function pow(exponent) { | ||
return function(x) { | ||
return x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent); | ||
}; | ||
} | ||
function pow(exponent) { | ||
return function(x) { | ||
return x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent); | ||
}; | ||
} | ||
function pan(domain, delta, lift, ground) { | ||
var d0 = lift(domain[0]), | ||
d1 = lift(peek(domain)), | ||
dd = (d1 - d0) * delta; | ||
function pan(domain, delta, lift, ground) { | ||
var d0 = lift(domain[0]), | ||
d1 = lift(peek(domain)), | ||
dd = (d1 - d0) * delta; | ||
return [ | ||
ground(d0 - dd), | ||
ground(d1 - dd) | ||
]; | ||
} | ||
return [ | ||
ground(d0 - dd), | ||
ground(d1 - dd) | ||
]; | ||
} | ||
function panLinear(domain, delta) { | ||
return pan(domain, delta, toNumber, identity); | ||
} | ||
function panLinear(domain, delta) { | ||
return pan(domain, delta, toNumber, identity); | ||
} | ||
function panLog(domain, delta) { | ||
var sign = Math.sign(domain[0]); | ||
return pan(domain, delta, log$1(sign), exp(sign)); | ||
} | ||
function panLog(domain, delta) { | ||
var sign = Math.sign(domain[0]); | ||
return pan(domain, delta, log$1(sign), exp(sign)); | ||
} | ||
function panPow(domain, delta, exponent) { | ||
return pan(domain, delta, pow(exponent), pow(1/exponent)); | ||
} | ||
function panPow(domain, delta, exponent) { | ||
return pan(domain, delta, pow(exponent), pow(1/exponent)); | ||
} | ||
function zoom(domain, anchor, scale, lift, ground) { | ||
var d0 = lift(domain[0]), | ||
d1 = lift(peek(domain)), | ||
da = anchor != null ? lift(anchor) : (d0 + d1) / 2; | ||
function zoom(domain, anchor, scale, lift, ground) { | ||
var d0 = lift(domain[0]), | ||
d1 = lift(peek(domain)), | ||
da = anchor != null ? lift(anchor) : (d0 + d1) / 2; | ||
return [ | ||
ground(da + (d0 - da) * scale), | ||
ground(da + (d1 - da) * scale) | ||
]; | ||
} | ||
return [ | ||
ground(da + (d0 - da) * scale), | ||
ground(da + (d1 - da) * scale) | ||
]; | ||
} | ||
function zoomLinear(domain, anchor, scale) { | ||
return zoom(domain, anchor, scale, toNumber, identity); | ||
} | ||
function zoomLinear(domain, anchor, scale) { | ||
return zoom(domain, anchor, scale, toNumber, identity); | ||
} | ||
function zoomLog(domain, anchor, scale) { | ||
var sign = Math.sign(domain[0]); | ||
return zoom(domain, anchor, scale, log$1(sign), exp(sign)); | ||
} | ||
function zoomLog(domain, anchor, scale) { | ||
var sign = Math.sign(domain[0]); | ||
return zoom(domain, anchor, scale, log$1(sign), exp(sign)); | ||
} | ||
function zoomPow(domain, anchor, scale, exponent) { | ||
return zoom(domain, anchor, scale, pow(exponent), pow(1/exponent)); | ||
} | ||
function zoomPow(domain, anchor, scale, exponent) { | ||
return zoom(domain, anchor, scale, pow(exponent), pow(1/exponent)); | ||
} | ||
var array = function(_) { | ||
return _ != null ? (isArray(_) ? _ : [_]) : []; | ||
}; | ||
function array(_) { | ||
return _ != null ? (isArray(_) ? _ : [_]) : []; | ||
} | ||
var isFunction = function(_) { | ||
return typeof _ === 'function'; | ||
}; | ||
function isFunction(_) { | ||
return typeof _ === 'function'; | ||
} | ||
var compare = function(fields, orders) { | ||
var idx = [], | ||
cmp = (fields = array(fields)).map(function(f, i) { | ||
if (f == null) { | ||
return null; | ||
} else { | ||
idx.push(i); | ||
return isFunction(f) ? f | ||
: splitAccessPath(f).map($).join(']['); | ||
} | ||
}), | ||
n = idx.length - 1, | ||
ord = array(orders), | ||
code = 'var u,v;return ', | ||
i, j, f, u, v, d, t, lt, gt; | ||
function compare(fields, orders) { | ||
var idx = [], | ||
cmp = (fields = array(fields)).map(function(f, i) { | ||
if (f == null) { | ||
return null; | ||
} else { | ||
idx.push(i); | ||
return isFunction(f) ? f | ||
: splitAccessPath(f).map($).join(']['); | ||
} | ||
}), | ||
n = idx.length - 1, | ||
ord = array(orders), | ||
code = 'var u,v;return ', | ||
i, j, f, u, v, d, t, lt, gt; | ||
if (n < 0) return null; | ||
if (n < 0) return null; | ||
for (j=0; j<=n; ++j) { | ||
i = idx[j]; | ||
f = cmp[i]; | ||
for (j=0; j<=n; ++j) { | ||
i = idx[j]; | ||
f = cmp[i]; | ||
if (isFunction(f)) { | ||
d = 'f' + i; | ||
u = '(u=this.' + d + '(a))'; | ||
v = '(v=this.' + d + '(b))'; | ||
(t = t || {})[d] = f; | ||
} else { | ||
u = '(u=a['+f+'])'; | ||
v = '(v=b['+f+'])'; | ||
} | ||
if (isFunction(f)) { | ||
d = 'f' + i; | ||
u = '(u=this.' + d + '(a))'; | ||
v = '(v=this.' + d + '(b))'; | ||
(t = t || {})[d] = f; | ||
} else { | ||
u = '(u=a['+f+'])'; | ||
v = '(v=b['+f+'])'; | ||
} | ||
d = '((v=v instanceof Date?+v:v),(u=u instanceof Date?+u:u))'; | ||
d = '((v=v instanceof Date?+v:v),(u=u instanceof Date?+u:u))'; | ||
if (ord[i] !== 'descending') { | ||
gt = 1; | ||
lt = -1; | ||
} else { | ||
gt = -1; | ||
lt = 1; | ||
if (ord[i] !== 'descending') { | ||
gt = 1; | ||
lt = -1; | ||
} else { | ||
gt = -1; | ||
lt = 1; | ||
} | ||
code += '(' + u+'<'+v+'||u==null)&&v!=null?' + lt | ||
+ ':(u>v||v==null)&&u!=null?' + gt | ||
+ ':'+d+'!==u&&v===v?' + lt | ||
+ ':v!==v&&u===u?' + gt | ||
+ (i < n ? ':' : ':0'); | ||
} | ||
code += '(' + u+'<'+v+'||u==null)&&v!=null?' + lt | ||
+ ':(u>v||v==null)&&u!=null?' + gt | ||
+ ':'+d+'!==u&&v===v?' + lt | ||
+ ':v!==v&&u===u?' + gt | ||
+ (i < n ? ':' : ':0'); | ||
} | ||
f = Function('a', 'b', code + ';'); | ||
if (t) f = f.bind(t); | ||
f = Function('a', 'b', code + ';'); | ||
if (t) f = f.bind(t); | ||
fields = fields.reduce(function(map, field) { | ||
if (isFunction(field)) { | ||
(accessorFields(field) || []).forEach(function(_) { map[_] = 1; }); | ||
} else if (field != null) { | ||
map[field + ''] = 1; | ||
} | ||
return map; | ||
}, {}); | ||
fields = fields.reduce(function(map, field) { | ||
if (isFunction(field)) { | ||
(accessorFields(field) || []).forEach(function(_) { map[_] = 1; }); | ||
} else if (field != null) { | ||
map[field + ''] = 1; | ||
} | ||
return map; | ||
}, {}); | ||
return accessor(f, Object.keys(fields)); | ||
} | ||
return accessor(f, Object.keys(fields)); | ||
}; | ||
function constant(_) { | ||
return isFunction(_) ? _ : function() { return _; }; | ||
} | ||
var constant = function(_) { | ||
return isFunction(_) ? _ : function() { return _; }; | ||
}; | ||
function debounce(delay, handler) { | ||
var tid, evt; | ||
var debounce = function(delay, handler) { | ||
var tid, evt; | ||
function callback() { | ||
handler(evt); | ||
tid = evt = null; | ||
} | ||
function callback() { | ||
handler(evt); | ||
tid = evt = null; | ||
return function(e) { | ||
evt = e; | ||
if (tid) clearTimeout(tid); | ||
tid = setTimeout(callback, delay); | ||
}; | ||
} | ||
return function(e) { | ||
evt = e; | ||
if (tid) clearTimeout(tid); | ||
tid = setTimeout(callback, delay); | ||
}; | ||
}; | ||
var extend = function(_) { | ||
for (var x, k, i=1, len=arguments.length; i<len; ++i) { | ||
x = arguments[i]; | ||
for (k in x) { _[k] = x[k]; } | ||
function extend(_) { | ||
for (var x, k, i=1, len=arguments.length; i<len; ++i) { | ||
x = arguments[i]; | ||
for (k in x) { _[k] = x[k]; } | ||
} | ||
return _; | ||
} | ||
return _; | ||
}; | ||
var extentIndex = function(array, f) { | ||
var i = -1, | ||
n = array.length, | ||
a, b, c, u, v; | ||
function extentIndex(array, f) { | ||
var i = -1, | ||
n = array.length, | ||
a, b, c, u, v; | ||
if (f == null) { | ||
while (++i < n) { | ||
b = array[i]; | ||
if (b != null && b >= b) { | ||
a = c = b; | ||
break; | ||
if (f == null) { | ||
while (++i < n) { | ||
b = array[i]; | ||
if (b != null && b >= b) { | ||
a = c = b; | ||
break; | ||
} | ||
} | ||
} | ||
u = v = i; | ||
while (++i < n) { | ||
b = array[i]; | ||
if (b != null) { | ||
if (a > b) { | ||
a = b; | ||
u = i; | ||
u = v = i; | ||
while (++i < n) { | ||
b = array[i]; | ||
if (b != null) { | ||
if (a > b) { | ||
a = b; | ||
u = i; | ||
} | ||
if (c < b) { | ||
c = b; | ||
v = i; | ||
} | ||
} | ||
if (c < b) { | ||
c = b; | ||
v = i; | ||
} | ||
} else { | ||
while (++i < n) { | ||
b = f(array[i], i, array); | ||
if (b != null && b >= b) { | ||
a = c = b; | ||
break; | ||
} | ||
} | ||
} | ||
} else { | ||
while (++i < n) { | ||
b = f(array[i], i, array); | ||
if (b != null && b >= b) { | ||
a = c = b; | ||
break; | ||
} | ||
} | ||
u = v = i; | ||
while (++i < n) { | ||
b = f(array[i], i, array); | ||
if (b != null) { | ||
if (a > b) { | ||
a = b; | ||
u = i; | ||
u = v = i; | ||
while (++i < n) { | ||
b = f(array[i], i, array); | ||
if (b != null) { | ||
if (a > b) { | ||
a = b; | ||
u = i; | ||
} | ||
if (c < b) { | ||
c = b; | ||
v = i; | ||
} | ||
} | ||
if (c < b) { | ||
c = b; | ||
v = i; | ||
} | ||
} | ||
} | ||
return [u, v]; | ||
} | ||
return [u, v]; | ||
}; | ||
var NULL = {}; | ||
var NULL = {}; | ||
function fastmap(input) { | ||
var obj = {}, | ||
map, | ||
test; | ||
var fastmap = function(input) { | ||
var obj = {}, | ||
map, | ||
test; | ||
function has(key) { | ||
return obj.hasOwnProperty(key) && obj[key] !== NULL; | ||
} | ||
function has(key) { | ||
return obj.hasOwnProperty(key) && obj[key] !== NULL; | ||
} | ||
map = { | ||
size: 0, | ||
empty: 0, | ||
object: obj, | ||
has: has, | ||
get: function(key) { | ||
return has(key) ? obj[key] : undefined; | ||
}, | ||
set: function(key, value) { | ||
if (!has(key)) { | ||
++map.size; | ||
if (obj[key] === NULL) --map.empty; | ||
} | ||
obj[key] = value; | ||
return this; | ||
}, | ||
delete: function(key) { | ||
if (has(key)) { | ||
--map.size; | ||
++map.empty; | ||
obj[key] = NULL; | ||
} | ||
return this; | ||
}, | ||
clear: function() { | ||
map.size = map.empty = 0; | ||
map.object = obj = {}; | ||
}, | ||
test: function(_) { | ||
if (arguments.length) { | ||
test = _; | ||
return map; | ||
} else { | ||
return test; | ||
} | ||
}, | ||
clean: function() { | ||
var next = {}, | ||
size = 0, | ||
key, value; | ||
for (key in obj) { | ||
value = obj[key]; | ||
if (value !== NULL && (!test || !test(value))) { | ||
next[key] = value; | ||
++size; | ||
map = { | ||
size: 0, | ||
empty: 0, | ||
object: obj, | ||
has: has, | ||
get: function(key) { | ||
return has(key) ? obj[key] : undefined; | ||
}, | ||
set: function(key, value) { | ||
if (!has(key)) { | ||
++map.size; | ||
if (obj[key] === NULL) --map.empty; | ||
} | ||
obj[key] = value; | ||
return this; | ||
}, | ||
delete: function(key) { | ||
if (has(key)) { | ||
--map.size; | ||
++map.empty; | ||
obj[key] = NULL; | ||
} | ||
return this; | ||
}, | ||
clear: function() { | ||
map.size = map.empty = 0; | ||
map.object = obj = {}; | ||
}, | ||
test: function(_) { | ||
if (arguments.length) { | ||
test = _; | ||
return map; | ||
} else { | ||
return test; | ||
} | ||
}, | ||
clean: function() { | ||
var next = {}, | ||
size = 0, | ||
key, value; | ||
for (key in obj) { | ||
value = obj[key]; | ||
if (value !== NULL && (!test || !test(value))) { | ||
next[key] = value; | ||
++size; | ||
} | ||
} | ||
map.size = size; | ||
map.empty = 0; | ||
map.object = (obj = next); | ||
} | ||
map.size = size; | ||
map.empty = 0; | ||
map.object = (obj = next); | ||
} | ||
}; | ||
}; | ||
if (input) Object.keys(input).forEach(function(key) { | ||
map.set(key, input[key]); | ||
}); | ||
if (input) Object.keys(input).forEach(function(key) { | ||
map.set(key, input[key]); | ||
}); | ||
return map; | ||
}; | ||
return map; | ||
} | ||
var inherits = function(child, parent) { | ||
var proto = (child.prototype = Object.create(parent.prototype)); | ||
proto.constructor = child; | ||
return proto; | ||
}; | ||
function inherits(child, parent) { | ||
var proto = (child.prototype = Object.create(parent.prototype)); | ||
proto.constructor = child; | ||
return proto; | ||
} | ||
var isBoolean = function(_) { | ||
return typeof _ === 'boolean'; | ||
}; | ||
function isBoolean(_) { | ||
return typeof _ === 'boolean'; | ||
} | ||
var isDate = function(_) { | ||
return Object.prototype.toString.call(_) === '[object Date]'; | ||
}; | ||
function isDate(_) { | ||
return Object.prototype.toString.call(_) === '[object Date]'; | ||
} | ||
var isNumber = function(_) { | ||
return typeof _ === 'number'; | ||
}; | ||
function isNumber(_) { | ||
return typeof _ === 'number'; | ||
} | ||
var isRegExp = function(_) { | ||
return Object.prototype.toString.call(_) === '[object RegExp]'; | ||
}; | ||
function isRegExp(_) { | ||
return Object.prototype.toString.call(_) === '[object RegExp]'; | ||
} | ||
var key = function(fields, flat) { | ||
if (fields) { | ||
fields = flat | ||
? array(fields).map(function(f) { return f.replace(/\\(.)/g, '$1'); }) | ||
: array(fields); | ||
function key(fields, flat) { | ||
if (fields) { | ||
fields = flat | ||
? array(fields).map(function(f) { return f.replace(/\\(.)/g, '$1'); }) | ||
: array(fields); | ||
} | ||
var fn = !(fields && fields.length) | ||
? function() { return ''; } | ||
: Function('_', 'return \'\'+' + | ||
fields.map(function(f) { | ||
return '_[' + (flat | ||
? $(f) | ||
: splitAccessPath(f).map($).join('][') | ||
) + ']'; | ||
}).join('+\'|\'+') + ';'); | ||
return accessor(fn, fields, 'key'); | ||
} | ||
var fn = !(fields && fields.length) | ||
? function() { return ''; } | ||
: Function('_', 'return \'\'+' + | ||
fields.map(function(f) { | ||
return '_[' + (flat | ||
? $(f) | ||
: splitAccessPath(f).map($).join('][') | ||
) + ']'; | ||
}).join('+\'|\'+') + ';'); | ||
function merge(compare, array0, array1, output) { | ||
var n0 = array0.length, | ||
n1 = array1.length; | ||
return accessor(fn, fields, 'key'); | ||
}; | ||
if (!n1) return array0; | ||
if (!n0) return array1; | ||
var merge = function(compare, array0, array1, output) { | ||
var n0 = array0.length, | ||
n1 = array1.length; | ||
var merged = output || new array0.constructor(n0 + n1), | ||
i0 = 0, i1 = 0, i = 0; | ||
if (!n1) return array0; | ||
if (!n0) return array1; | ||
for (; i0<n0 && i1<n1; ++i) { | ||
merged[i] = compare(array0[i0], array1[i1]) > 0 | ||
? array1[i1++] | ||
: array0[i0++]; | ||
} | ||
var merged = output || new array0.constructor(n0 + n1), | ||
i0 = 0, i1 = 0, i = 0; | ||
for (; i0<n0; ++i0, ++i) { | ||
merged[i] = array0[i0]; | ||
} | ||
for (; i0<n0 && i1<n1; ++i) { | ||
merged[i] = compare(array0[i0], array1[i1]) > 0 | ||
? array1[i1++] | ||
: array0[i0++]; | ||
} | ||
for (; i1<n1; ++i1, ++i) { | ||
merged[i] = array1[i1]; | ||
} | ||
for (; i0<n0; ++i0, ++i) { | ||
merged[i] = array0[i0]; | ||
return merged; | ||
} | ||
for (; i1<n1; ++i1, ++i) { | ||
merged[i] = array1[i1]; | ||
function repeat(str, reps) { | ||
var s = ''; | ||
while (--reps >= 0) s += str; | ||
return s; | ||
} | ||
return merged; | ||
}; | ||
function pad(str, length, padchar, align) { | ||
var c = padchar || ' ', | ||
s = str + '', | ||
n = length - s.length; | ||
var repeat = function(str, reps) { | ||
var s = ''; | ||
while (--reps >= 0) s += str; | ||
return s; | ||
}; | ||
return n <= 0 ? s | ||
: align === 'left' ? repeat(c, n) + s | ||
: align === 'center' ? repeat(c, ~~(n/2)) + s + repeat(c, Math.ceil(n/2)) | ||
: s + repeat(c, n); | ||
} | ||
var pad = function(str, length, padchar, align) { | ||
var c = padchar || ' ', | ||
s = str + '', | ||
n = length - s.length; | ||
function toBoolean(_) { | ||
return _ == null || _ === '' ? null : !_ || _ === 'false' || _ === '0' ? false : !!_; | ||
} | ||
return n <= 0 ? s | ||
: align === 'left' ? repeat(c, n) + s | ||
: align === 'center' ? repeat(c, ~~(n/2)) + s + repeat(c, Math.ceil(n/2)) | ||
: s + repeat(c, n); | ||
}; | ||
function defaultParser(_) { | ||
return isNumber(_) ? _ : isDate(_) ? _ : Date.parse(_); | ||
} | ||
var toBoolean = function(_) { | ||
return _ == null || _ === '' ? null : !_ || _ === 'false' || _ === '0' ? false : !!_; | ||
}; | ||
function toDate(_, parser) { | ||
parser = parser || defaultParser; | ||
return _ == null || _ === '' ? null : parser(_); | ||
} | ||
function defaultParser(_) { | ||
return isNumber(_) ? _ : isDate(_) ? _ : Date.parse(_); | ||
} | ||
function toString(_) { | ||
return _ == null || _ === '' ? null : _ + ''; | ||
} | ||
var toDate = function(_, parser) { | ||
parser = parser || defaultParser; | ||
return _ == null || _ === '' ? null : parser(_); | ||
}; | ||
function toSet(_) { | ||
for (var s={}, i=0, n=_.length; i<n; ++i) s[_[i]] = true; | ||
return s; | ||
} | ||
var toString = function(_) { | ||
return _ == null || _ === '' ? null : _ + ''; | ||
}; | ||
function truncate(str, length, align, ellipsis) { | ||
var e = ellipsis != null ? ellipsis : '\u2026', | ||
s = str + '', | ||
n = s.length, | ||
l = Math.max(0, length - e.length); | ||
var toSet = function(_) { | ||
for (var s={}, i=0, n=_.length; i<n; ++i) s[_[i]] = true; | ||
return s; | ||
}; | ||
return n <= length ? s | ||
: align === 'left' ? e + s.slice(n - l) | ||
: align === 'center' ? s.slice(0, Math.ceil(l/2)) + e + s.slice(n - ~~(l/2)) | ||
: s.slice(0, l) + e; | ||
} | ||
var truncate = function(str, length, align, ellipsis) { | ||
var e = ellipsis != null ? ellipsis : '\u2026', | ||
s = str + '', | ||
n = s.length, | ||
l = Math.max(0, length - e.length); | ||
return n <= length ? s | ||
: align === 'left' ? e + s.slice(n - l) | ||
: align === 'center' ? s.slice(0, Math.ceil(l/2)) + e + s.slice(n - ~~(l/2)) | ||
: s.slice(0, l) + e; | ||
}; | ||
var visitArray = function(array, filter, visitor) { | ||
if (array) { | ||
var i = 0, n = array.length, t; | ||
if (filter) { | ||
for (; i<n; ++i) { | ||
if (t = filter(array[i])) visitor(t, i, array); | ||
function visitArray(array, filter, visitor) { | ||
if (array) { | ||
var i = 0, n = array.length, t; | ||
if (filter) { | ||
for (; i<n; ++i) { | ||
if (t = filter(array[i])) visitor(t, i, array); | ||
} | ||
} else { | ||
array.forEach(visitor); | ||
} | ||
} else { | ||
array.forEach(visitor); | ||
} | ||
} | ||
}; | ||
exports.accessor = accessor; | ||
exports.accessorName = accessorName; | ||
exports.accessorFields = accessorFields; | ||
exports.id = id; | ||
exports.identity = identity; | ||
exports.zero = zero; | ||
exports.one = one; | ||
exports.truthy = truthy; | ||
exports.falsy = falsy; | ||
exports.logger = logger; | ||
exports.None = None; | ||
exports.Error = Error$1; | ||
exports.Warn = Warn; | ||
exports.Info = Info; | ||
exports.Debug = Debug; | ||
exports.panLinear = panLinear; | ||
exports.panLog = panLog; | ||
exports.panPow = panPow; | ||
exports.zoomLinear = zoomLinear; | ||
exports.zoomLog = zoomLog; | ||
exports.zoomPow = zoomPow; | ||
exports.array = array; | ||
exports.compare = compare; | ||
exports.constant = constant; | ||
exports.debounce = debounce; | ||
exports.error = error; | ||
exports.extend = extend; | ||
exports.extentIndex = extentIndex; | ||
exports.fastmap = fastmap; | ||
exports.field = field; | ||
exports.inherits = inherits; | ||
exports.isArray = isArray; | ||
exports.isBoolean = isBoolean; | ||
exports.isDate = isDate; | ||
exports.isFunction = isFunction; | ||
exports.isNumber = isNumber; | ||
exports.isObject = isObject; | ||
exports.isRegExp = isRegExp; | ||
exports.isString = isString; | ||
exports.key = key; | ||
exports.merge = merge; | ||
exports.pad = pad; | ||
exports.peek = peek; | ||
exports.repeat = repeat; | ||
exports.splitAccessPath = splitAccessPath; | ||
exports.stringValue = $; | ||
exports.toBoolean = toBoolean; | ||
exports.toDate = toDate; | ||
exports.toNumber = toNumber; | ||
exports.toString = toString; | ||
exports.toSet = toSet; | ||
exports.truncate = truncate; | ||
exports.visitArray = visitArray; | ||
exports.accessor = accessor; | ||
exports.accessorName = accessorName; | ||
exports.accessorFields = accessorFields; | ||
exports.id = id; | ||
exports.identity = identity; | ||
exports.zero = zero; | ||
exports.one = one; | ||
exports.truthy = truthy; | ||
exports.falsy = falsy; | ||
exports.logger = logger; | ||
exports.None = None; | ||
exports.Error = Error$1; | ||
exports.Warn = Warn; | ||
exports.Info = Info; | ||
exports.Debug = Debug; | ||
exports.panLinear = panLinear; | ||
exports.panLog = panLog; | ||
exports.panPow = panPow; | ||
exports.zoomLinear = zoomLinear; | ||
exports.zoomLog = zoomLog; | ||
exports.zoomPow = zoomPow; | ||
exports.array = array; | ||
exports.compare = compare; | ||
exports.constant = constant; | ||
exports.debounce = debounce; | ||
exports.error = error; | ||
exports.extend = extend; | ||
exports.extentIndex = extentIndex; | ||
exports.fastmap = fastmap; | ||
exports.field = field; | ||
exports.inherits = inherits; | ||
exports.isArray = isArray; | ||
exports.isBoolean = isBoolean; | ||
exports.isDate = isDate; | ||
exports.isFunction = isFunction; | ||
exports.isNumber = isNumber; | ||
exports.isObject = isObject; | ||
exports.isRegExp = isRegExp; | ||
exports.isString = isString; | ||
exports.key = key; | ||
exports.merge = merge; | ||
exports.pad = pad; | ||
exports.peek = peek; | ||
exports.repeat = repeat; | ||
exports.splitAccessPath = splitAccessPath; | ||
exports.stringValue = $; | ||
exports.toBoolean = toBoolean; | ||
exports.toDate = toDate; | ||
exports.toNumber = toNumber; | ||
exports.toString = toString; | ||
exports.toSet = toSet; | ||
exports.truncate = truncate; | ||
exports.visitArray = visitArray; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
}))); | ||
})); |
@@ -1,1 +0,1 @@ | ||
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(n.vega=n.vega||{})}(this,function(n){"use strict";function t(n){return null==n?null:n.fields}function r(n){return g(n)?"["+n.map(r)+"]":h(n)||v(n)?JSON.stringify(n).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):n}function e(n,t,r){var e=[t].concat([].slice.call(r));console[n].apply(console,e)}function u(n){return function(t){return n*Math.exp(t)}}function o(n){return function(t){return Math.log(n*t)}}function i(n){return function(t){return t<0?-Math.pow(-t,n):Math.pow(t,n)}}function c(n,t,r,e){var u=r(n[0]),o=r(M(n)),i=(o-u)*t;return[e(u-i),e(o-i)]}function f(n,t,r,e,u){var o=e(n[0]),i=e(M(n)),c=null!=t?e(t):(o+i)/2;return[u(c+(o-c)*r),u(c+(i-c)*r)]}function l(n){return N(n)?n:D(n)?n:Date.parse(n)}var a=function(n,t,r){return n.fields=t||[],n.fname=r,n},s=function(n){throw Error(n)},p=function(n){function t(){o.push(l+n.substring(r,e)),l="",r=e+1}var r,e,u,o=[],i=null,c=0,f=n.length,l="";for(n+="",r=e=0;e<f;++e)if("\\"===(u=n[e]))l+=n.substring(r,e),r=++e;else if(u===i)t(),i=null,c=-1;else{if(i)continue;r===c&&'"'===u?(r=e+1,i=u):r===c&&"'"===u?(r=e+1,i=u):"."!==u||c?"["===u?(e>r&&t(),c=r=e+1):"]"===u&&(c||s("Access path missing open bracket: "+n),c>0&&t(),c=0,r=e+1):e>r?t():r=e+1}return c&&s("Access path missing closing bracket: "+n),i&&s("Access path missing closing quote: "+n),e>r&&(e++,t()),o},g=Array.isArray,h=function(n){return n===Object(n)},v=function(n){return"string"==typeof n},y=function(n,t){var e=p(n),u="return _["+e.map(r).join("][")+"];";return a(Function("_",u),[n=1===e.length?e[0]:n],t||n)},m=[],b=y("id"),d=a(function(n){return n},m,"identity"),j=a(function(){return 0},m,"zero"),O=a(function(){return 1},m,"one"),x=a(function(){return!0},m,"true"),z=a(function(){return!1},m,"false"),M=function(n){return n[n.length-1]},k=function(n){return null==n||""===n?null:+n},w=function(n){return null!=n?g(n)?n:[n]:[]},A=function(n){return"function"==typeof n},E={},D=function(n){return"[object Date]"===Object.prototype.toString.call(n)},N=function(n){return"number"==typeof n},F=function(n,t){for(var r="";--t>=0;)r+=n;return r};n.accessor=a,n.accessorName=function(n){return null==n?null:n.fname},n.accessorFields=t,n.id=b,n.identity=d,n.zero=j,n.one=O,n.truthy=x,n.falsy=z,n.logger=function(n){var t=n||0;return{level:function(n){return arguments.length?(t=+n,this):t},error:function(){return t>=1&&e("error","ERROR",arguments),this},warn:function(){return t>=2&&e("warn","WARN",arguments),this},info:function(){return t>=3&&e("log","INFO",arguments),this},debug:function(){return t>=4&&e("log","DEBUG",arguments),this}}},n.None=0,n.Error=1,n.Warn=2,n.Info=3,n.Debug=4,n.panLinear=function(n,t){return c(n,t,k,d)},n.panLog=function(n,t){var r=Math.sign(n[0]);return c(n,t,o(r),u(r))},n.panPow=function(n,t,r){return c(n,t,i(r),i(1/r))},n.zoomLinear=function(n,t,r){return f(n,t,r,k,d)},n.zoomLog=function(n,t,r){var e=Math.sign(n[0]);return f(n,t,r,o(e),u(e))},n.zoomPow=function(n,t,r,e){return f(n,t,r,i(e),i(1/e))},n.array=w,n.compare=function(n,e){var u,o,i,c,f,l,s,g,h,v=[],y=(n=w(n)).map(function(n,t){return null==n?null:(v.push(t),A(n)?n:p(n).map(r).join("]["))}),m=v.length-1,b=w(e),d="var u,v;return ";if(m<0)return null;for(o=0;o<=m;++o)i=y[u=v[o]],A(i)?(c="(u=this."+(l="f"+u)+"(a))",f="(v=this."+l+"(b))",(s=s||{})[l]=i):(c="(u=a["+i+"])",f="(v=b["+i+"])"),l="((v=v instanceof Date?+v:v),(u=u instanceof Date?+u:u))","descending"!==b[u]?(h=1,g=-1):(h=-1,g=1),d+="("+c+"<"+f+"||u==null)&&v!=null?"+g+":(u>v||v==null)&&u!=null?"+h+":"+l+"!==u&&v===v?"+g+":v!==v&&u===u?"+h+(u<m?":":":0");return i=Function("a","b",d+";"),s&&(i=i.bind(s)),n=n.reduce(function(n,r){return A(r)?(t(r)||[]).forEach(function(t){n[t]=1}):null!=r&&(n[r+""]=1),n},{}),a(i,Object.keys(n))},n.constant=function(n){return A(n)?n:function(){return n}},n.debounce=function(n,t){function r(){t(u),e=u=null}var e,u;return function(t){u=t,e&&clearTimeout(e),e=setTimeout(r,n)}},n.error=s,n.extend=function(n){for(var t,r,e=1,u=arguments.length;e<u;++e){t=arguments[e];for(r in t)n[r]=t[r]}return n},n.extentIndex=function(n,t){var r,e,u,o,i,c=-1,f=n.length;if(null==t){for(;++c<f;)if(null!=(e=n[c])&&e>=e){r=u=e;break}for(o=i=c;++c<f;)null!=(e=n[c])&&(r>e&&(r=e,o=c),u<e&&(u=e,i=c))}else{for(;++c<f;)if(null!=(e=t(n[c],c,n))&&e>=e){r=u=e;break}for(o=i=c;++c<f;)null!=(e=t(n[c],c,n))&&(r>e&&(r=e,o=c),u<e&&(u=e,i=c))}return[o,i]},n.fastmap=function(n){function t(n){return u.hasOwnProperty(n)&&u[n]!==E}var r,e,u={};return r={size:0,empty:0,object:u,has:t,get:function(n){return t(n)?u[n]:void 0},set:function(n,e){return t(n)||(++r.size,u[n]===E&&--r.empty),u[n]=e,this},delete:function(n){return t(n)&&(--r.size,++r.empty,u[n]=E),this},clear:function(){r.size=r.empty=0,r.object=u={}},test:function(n){return arguments.length?(e=n,r):e},clean:function(){var n,t,o={},i=0;for(n in u)(t=u[n])===E||e&&e(t)||(o[n]=t,++i);r.size=i,r.empty=0,r.object=u=o}},n&&Object.keys(n).forEach(function(t){r.set(t,n[t])}),r},n.field=y,n.inherits=function(n,t){var r=n.prototype=Object.create(t.prototype);return r.constructor=n,r},n.isArray=g,n.isBoolean=function(n){return"boolean"==typeof n},n.isDate=D,n.isFunction=A,n.isNumber=N,n.isObject=h,n.isRegExp=function(n){return"[object RegExp]"===Object.prototype.toString.call(n)},n.isString=v,n.key=function(n,t){n&&(n=t?w(n).map(function(n){return n.replace(/\\(.)/g,"$1")}):w(n));var e=n&&n.length?Function("_","return ''+"+n.map(function(n){return"_["+(t?r(n):p(n).map(r).join("]["))+"]"}).join("+'|'+")+";"):function(){return""};return a(e,n,"key")},n.merge=function(n,t,r,e){var u=t.length,o=r.length;if(!o)return t;if(!u)return r;for(var i=e||new t.constructor(u+o),c=0,f=0,l=0;c<u&&f<o;++l)i[l]=n(t[c],r[f])>0?r[f++]:t[c++];for(;c<u;++c,++l)i[l]=t[c];for(;f<o;++f,++l)i[l]=r[f];return i},n.pad=function(n,t,r,e){var u=r||" ",o=n+"",i=t-o.length;return i<=0?o:"left"===e?F(u,i)+o:"center"===e?F(u,~~(i/2))+o+F(u,Math.ceil(i/2)):o+F(u,i)},n.peek=M,n.repeat=F,n.splitAccessPath=p,n.stringValue=r,n.toBoolean=function(n){return null==n||""===n?null:!(!n||"false"===n||"0"===n||!n)},n.toDate=function(n,t){return t=t||l,null==n||""===n?null:t(n)},n.toNumber=k,n.toString=function(n){return null==n||""===n?null:n+""},n.toSet=function(n){for(var t={},r=0,e=n.length;r<e;++r)t[n[r]]=!0;return t},n.truncate=function(n,t,r,e){var u=null!=e?e:"…",o=n+"",i=o.length,c=Math.max(0,t-u.length);return i<=t?o:"left"===r?u+o.slice(i-c):"center"===r?o.slice(0,Math.ceil(c/2))+u+o.slice(i-~~(c/2)):o.slice(0,c)+u},n.visitArray=function(n,t,r){if(n){var e,u=0,o=n.length;if(t)for(;u<o;++u)(e=t(n[u]))&&r(e,u,n);else n.forEach(r)}},Object.defineProperty(n,"__esModule",{value:!0})}); | ||
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(n.vega={})}("undefined"!=typeof self?self:this,function(n){"use strict";function y(n,t,e){return n.fields=t||[],n.fname=e,n}function m(n){return null==n?null:n.fields}function a(n){throw Error(n)}function b(n){var t,e,r,u=[],o=null,i=0,c=n.length,f="";function l(){u.push(f+n.substring(t,e)),f="",t=e+1}for(n+="",t=e=0;e<c;++e)if("\\"===(r=n[e]))f+=n.substring(t,e),t=++e;else if(r===o)l(),o=null,i=-1;else{if(o)continue;t===i&&'"'===r?(t=e+1,o=r):t===i&&"'"===r?(t=e+1,o=r):"."!==r||i?"["===r?(t<e&&l(),i=t=e+1):"]"===r&&(i||a("Access path missing open bracket: "+n),0<i&&l(),i=0,t=e+1):t<e?l():t=e+1}return i&&a("Access path missing closing bracket: "+n),o&&a("Access path missing closing quote: "+n),t<e&&(e++,l()),u}var t=Array.isArray;function e(n){return n===Object(n)}function r(n){return"string"==typeof n}function d(n){return t(n)?"["+n.map(d)+"]":e(n)||r(n)?JSON.stringify(n).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):n}function u(n,t){var e=b(n),r="return _["+e.map(d).join("][")+"];";return y(Function("_",r),[n=1===e.length?e[0]:n],t||n)}var o=[],i=u("id"),c=y(function(n){return n},o,"identity"),f=y(function(){return 0},o,"zero"),l=y(function(){return 1},o,"one"),s=y(function(){return!0},o,"true"),p=y(function(){return!1},o,"false");function h(n,t,e){var r=[t].concat([].slice.call(e));console[n].apply(console,r)}function g(n){return n[n.length-1]}function v(n){return null==n||""===n?null:+n}function j(t){return function(n){return t*Math.exp(n)}}function O(t){return function(n){return Math.log(t*n)}}function x(t){return function(n){return n<0?-Math.pow(-n,t):Math.pow(n,t)}}function z(n,t,e,r){var u=e(n[0]),o=e(g(n)),i=(o-u)*t;return[r(u-i),r(o-i)]}function M(n,t,e,r,u){var o=r(n[0]),i=r(g(n)),c=null!=t?r(t):(o+i)/2;return[u(c+(o-c)*e),u(c+(i-c)*e)]}function k(n){return null!=n?t(n)?n:[n]:[]}function w(n){return"function"==typeof n}var A={};function E(n){return"[object Date]"===Object.prototype.toString.call(n)}function D(n){return"number"==typeof n}function N(n,t){for(var e="";0<=--t;)e+=n;return e}function F(n){return D(n)?n:E(n)?n:Date.parse(n)}n.accessor=y,n.accessorName=function(n){return null==n?null:n.fname},n.accessorFields=m,n.id=i,n.identity=c,n.zero=f,n.one=l,n.truthy=s,n.falsy=p,n.logger=function(n){var t=n||0;return{level:function(n){return arguments.length?(t=+n,this):t},error:function(){return 1<=t&&h("error","ERROR",arguments),this},warn:function(){return 2<=t&&h("warn","WARN",arguments),this},info:function(){return 3<=t&&h("log","INFO",arguments),this},debug:function(){return 4<=t&&h("log","DEBUG",arguments),this}}},n.None=0,n.Error=1,n.Warn=2,n.Info=3,n.Debug=4,n.panLinear=function(n,t){return z(n,t,v,c)},n.panLog=function(n,t){var e=Math.sign(n[0]);return z(n,t,O(e),j(e))},n.panPow=function(n,t,e){return z(n,t,x(e),x(1/e))},n.zoomLinear=function(n,t,e){return M(n,t,e,v,c)},n.zoomLog=function(n,t,e){var r=Math.sign(n[0]);return M(n,t,e,O(r),j(r))},n.zoomPow=function(n,t,e,r){return M(n,t,e,x(r),x(1/r))},n.array=k,n.compare=function(n,t){var e,r,u,o,i,c,f,l,a,s=[],p=(n=k(n)).map(function(n,t){return null==n?null:(s.push(t),w(n)?n:b(n).map(d).join("]["))}),h=s.length-1,g=k(t),v="var u,v;return ";if(h<0)return null;for(r=0;r<=h;++r)w(u=p[e=s[r]])?(o="(u=this."+(c="f"+e)+"(a))",i="(v=this."+c+"(b))",(f=f||{})[c]=u):(o="(u=a["+u+"])",i="(v=b["+u+"])"),c="((v=v instanceof Date?+v:v),(u=u instanceof Date?+u:u))",v+="("+o+"<"+i+"||u==null)&&v!=null?"+(l="descending"!==g[e]?-(a=1):(a=-1,1))+":(u>v||v==null)&&u!=null?"+a+":"+c+"!==u&&v===v?"+l+":v!==v&&u===u?"+a+(e<h?":":":0");return u=Function("a","b",v+";"),f&&(u=u.bind(f)),n=n.reduce(function(t,n){return w(n)?(m(n)||[]).forEach(function(n){t[n]=1}):null!=n&&(t[n+""]=1),t},{}),y(u,Object.keys(n))},n.constant=function(n){return w(n)?n:function(){return n}},n.debounce=function(t,n){var e,r;function u(){n(r),e=r=null}return function(n){r=n,e&&clearTimeout(e),e=setTimeout(u,t)}},n.error=a,n.extend=function(n){for(var t,e,r=1,u=arguments.length;r<u;++r)for(e in t=arguments[r])n[e]=t[e];return n},n.extentIndex=function(n,t){var e,r,u,o,i,c=-1,f=n.length;if(null==t){for(;++c<f;)if(null!=(r=n[c])&&r<=r){e=u=r;break}for(o=i=c;++c<f;)null!=(r=n[c])&&(r<e&&(e=r,o=c),u<r&&(u=r,i=c))}else{for(;++c<f;)if(null!=(r=t(n[c],c,n))&&r<=r){e=u=r;break}for(o=i=c;++c<f;)null!=(r=t(n[c],c,n))&&(r<e&&(e=r,o=c),u<r&&(u=r,i=c))}return[o,i]},n.fastmap=function(t){var u,o,i={};function e(n){return i.hasOwnProperty(n)&&i[n]!==A}return u={size:0,empty:0,object:i,has:e,get:function(n){return e(n)?i[n]:void 0},set:function(n,t){return e(n)||(++u.size,i[n]===A&&--u.empty),i[n]=t,this},delete:function(n){return e(n)&&(--u.size,++u.empty,i[n]=A),this},clear:function(){u.size=u.empty=0,u.object=i={}},test:function(n){return arguments.length?(o=n,u):o},clean:function(){var n,t,e={},r=0;for(n in i)(t=i[n])===A||o&&o(t)||(e[n]=t,++r);u.size=r,u.empty=0,u.object=i=e}},t&&Object.keys(t).forEach(function(n){u.set(n,t[n])}),u},n.field=u,n.inherits=function(n,t){var e=n.prototype=Object.create(t.prototype);return e.constructor=n,e},n.isArray=t,n.isBoolean=function(n){return"boolean"==typeof n},n.isDate=E,n.isFunction=w,n.isNumber=D,n.isObject=e,n.isRegExp=function(n){return"[object RegExp]"===Object.prototype.toString.call(n)},n.isString=r,n.key=function(n,t){return n&&(n=t?k(n).map(function(n){return n.replace(/\\(.)/g,"$1")}):k(n)),y(n&&n.length?Function("_","return ''+"+n.map(function(n){return"_["+(t?d(n):b(n).map(d).join("]["))+"]"}).join("+'|'+")+";"):function(){return""},n,"key")},n.merge=function(n,t,e,r){var u=t.length,o=e.length;if(!o)return t;if(!u)return e;for(var i=r||new t.constructor(u+o),c=0,f=0,l=0;c<u&&f<o;++l)i[l]=0<n(t[c],e[f])?e[f++]:t[c++];for(;c<u;++c,++l)i[l]=t[c];for(;f<o;++f,++l)i[l]=e[f];return i},n.pad=function(n,t,e,r){var u=e||" ",o=n+"",i=t-o.length;return i<=0?o:"left"===r?N(u,i)+o:"center"===r?N(u,~~(i/2))+o+N(u,Math.ceil(i/2)):o+N(u,i)},n.peek=g,n.repeat=N,n.splitAccessPath=b,n.stringValue=d,n.toBoolean=function(n){return null==n||""===n?null:!(!n||"false"===n||"0"===n||!n)},n.toDate=function(n,t){return t=t||F,null==n||""===n?null:t(n)},n.toNumber=v,n.toString=function(n){return null==n||""===n?null:n+""},n.toSet=function(n){for(var t={},e=0,r=n.length;e<r;++e)t[n[e]]=!0;return t},n.truncate=function(n,t,e,r){var u=null!=r?r:"…",o=n+"",i=o.length,c=Math.max(0,t-u.length);return i<=t?o:"left"===e?u+o.slice(i-c):"center"===e?o.slice(0,Math.ceil(c/2))+u+o.slice(i-~~(c/2)):o.slice(0,c)+u},n.visitArray=function(n,t,e){if(n){var r,u=0,o=n.length;if(t)for(;u<o;++u)(r=t(n[u]))&&e(r,u,n);else n.forEach(e)}},Object.defineProperty(n,"__esModule",{value:!0})}); |
@@ -20,3 +20,3 @@ // Functions | ||
export function identity<V>(v: V): () => V; | ||
export function identity<V>(v: V): V; | ||
@@ -31,2 +31,3 @@ export function key(fields: string[], flat?: boolean): (_: object) => string; | ||
// Type Checkers | ||
export function isArray<T>(a: any | T[]): a is T[]; | ||
@@ -42,2 +43,3 @@ export function isBoolean(a: any): a is boolean; | ||
// Type Coercion | ||
export function toBoolean(a: any): boolean; | ||
@@ -44,0 +46,0 @@ export function toDate(a: any, parser?: (_: any) => number): number; |
{ | ||
"name": "vega-util", | ||
"version": "1.7.0", | ||
"version": "1.7.1", | ||
"description": "JavaScript utilities for Vega.", | ||
@@ -25,14 +25,15 @@ "keywords": [ | ||
"pretest": "rm -rf build && mkdir build && rollup -f umd -n vega -o build/vega-util.js -- index.js", | ||
"test": "tape 'test/**/*-test.js' && eslint index.js src test", | ||
"test": "tape 'test/**/*-test.js' && eslint index.js src test && tsc", | ||
"tsc": "tsc", | ||
"prepublish": "npm run build", | ||
"prepublishOnly": "npm run build", | ||
"postpublish": "git push && git push --tags && zip -j build/vega-util.zip -- LICENSE README.md build/vega-util.js build/vega-util.min.js" | ||
}, | ||
"devDependencies": { | ||
"eslint": "2", | ||
"rollup": "0.43", | ||
"@types/node": "10", | ||
"eslint": "5", | ||
"rollup": "0.68.0", | ||
"tape": "4", | ||
"typescript": "2", | ||
"typescript": "3", | ||
"uglify-js": "3" | ||
} | ||
} |
@@ -542,2 +542,5 @@ # vega-util | ||
with a log level less than or equal to *value* will be written to the console. | ||
* <b>error</b>(<i>message1</i>[, <i>message2</i>, …]): Logs an error message. | ||
The messages will be written to the console using the `console.error` method | ||
if the current log level is [Error](#error) or higher. | ||
* <b>warn</b>(<i>message1</i>[, <i>message2</i>, …]): Logs a warning message. | ||
@@ -549,3 +552,3 @@ The messages will be written to the console using the `console.warn` method | ||
method if the current log level is [Info](#info) or higher. | ||
* <b>warn</b>(<i>message1</i>[, <i>message2</i>, …]): Logs a debugging message. | ||
* <b>debug</b>(<i>message1</i>[, <i>message2</i>, …]): Logs a debugging message. | ||
The messages will be written to the console using the `console.log` method | ||
@@ -552,0 +555,0 @@ if the current log level is [Debug](#debug) or higher. |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
70204
609
6