_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 52 373k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q21500 | make | train | function make(move) {
var _this = this;
if (!Glide.disabled) {
Glide.disable();
this.move = move;
Events.emit('run.before', this.move);
this.calculate();
Events.emit('run', this.move);
Components.Transition.after(function () {
if (_this.isStart... | javascript | {
"resource": ""
} |
q21501 | calculate | train | function calculate() {
var move = this.move,
length = this.length;
var steps = move.steps,
direction = move.direction;
var countableSteps = isNumber(toInt(steps)) && toInt(steps) !== 0;
switch (direction) {
case '>':
if (steps === '>') {
Glide... | javascript | {
"resource": ""
} |
q21502 | set | train | function set(value) {
var step = value.substr(1);
this._m = {
direction: value.substr(0, 1),
steps: step ? toInt(step) ? toInt(step) : step : 0
};
} | javascript | {
"resource": ""
} |
q21503 | get | train | function get() {
var settings = Glide.settings;
var length = Components.Html.slides.length;
// If the `bound` option is acitve, a maximum running distance should be
// reduced by `perView` and `focusAt` settings. Running distance
// should end before creating an empty space after instance... | javascript | {
"resource": ""
} |
q21504 | apply | train | function apply(slides) {
for (var i = 0, len = slides.length; i < len; i++) {
var style = slides[i].style;
var direction = Components.Direction.value;
if (i !== 0) {
style[MARGIN_TYPE[direction][0]] = this.value / 2 + 'px';
} else {
style[MARGIN_TYPE[direction]... | javascript | {
"resource": ""
} |
q21505 | remove | train | function remove(slides) {
for (var i = 0, len = slides.length; i < len; i++) {
var style = slides[i].style;
style.marginLeft = '';
style.marginRight = '';
}
} | javascript | {
"resource": ""
} |
q21506 | siblings | train | function siblings(node) {
if (node && node.parentNode) {
var n = node.parentNode.firstChild;
var matched = [];
for (; n; n = n.nextSibling) {
if (n.nodeType === 1 && n !== node) {
matched.push(n);
}
}
return matched;
}
return [];
} | javascript | {
"resource": ""
} |
q21507 | mount | train | function mount() {
this.root = Glide.selector;
this.track = this.root.querySelector(TRACK_SELECTOR);
this.slides = Array.prototype.slice.call(this.wrapper.children).filter(function (slide) {
return !slide.classList.contains(Glide.settings.classes.cloneSlide);
});
} | javascript | {
"resource": ""
} |
q21508 | set | train | function set(r) {
if (isString(r)) {
r = document.querySelector(r);
}
if (exist(r)) {
Html._r = r;
} else {
warn('Root element must be a existing Html node');
}
} | javascript | {
"resource": ""
} |
q21509 | set | train | function set(value) {
if (isObject(value)) {
value.before = toInt(value.before);
value.after = toInt(value.after);
} else {
value = toInt(value);
}
Peek._v = value;
} | javascript | {
"resource": ""
} |
q21510 | get | train | function get() {
var value = Peek.value;
var perView = Glide.settings.perView;
if (isObject(value)) {
return value.before / perView + value.after / perView;
}
return value * 2 / perView;
} | javascript | {
"resource": ""
} |
q21511 | make | train | function make() {
var _this = this;
var offset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
this.offset = offset;
Events.emit('move', {
movement: this.value
});
Components.Transition.after(function () {
Events.emit('move.after', {
... | javascript | {
"resource": ""
} |
q21512 | get | train | function get() {
var offset = this.offset;
var translate = this.translate;
if (Components.Direction.is('rtl')) {
return translate + offset;
}
return translate - offset;
} | javascript | {
"resource": ""
} |
q21513 | setupSlides | train | function setupSlides() {
var width = this.slideWidth + 'px';
var slides = Components.Html.slides;
for (var i = 0; i < slides.length; i++) {
slides[i].style.width = width;
}
} | javascript | {
"resource": ""
} |
q21514 | remove | train | function remove() {
var slides = Components.Html.slides;
for (var i = 0; i < slides.length; i++) {
slides[i].style.width = '';
}
Components.Html.wrapper.style.width = '';
} | javascript | {
"resource": ""
} |
q21515 | get | train | function get() {
return Sizes.slideWidth * Sizes.length + Components.Gaps.grow + Components.Clones.grow;
} | javascript | {
"resource": ""
} |
q21516 | get | train | function get() {
return Sizes.width / Glide.settings.perView - Components.Peek.reductor - Components.Gaps.reductor;
} | javascript | {
"resource": ""
} |
q21517 | typeClass | train | function typeClass() {
Components.Html.root.classList.add(Glide.settings.classes[Glide.settings.type]);
} | javascript | {
"resource": ""
} |
q21518 | removeClasses | train | function removeClasses() {
var classes = Glide.settings.classes;
Components.Html.root.classList.remove(classes[Glide.settings.type]);
Components.Html.slides.forEach(function (sibling) {
sibling.classList.remove(classes.activeSlide);
});
} | javascript | {
"resource": ""
} |
q21519 | collect | train | function collect() {
var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
var slides = Components.Html.slides;
var _Glide$settings = Glide.settings,
perView = _Glide$settings.perView,
classes = _Glide$settings.classes;
var peekIncrementer = +!... | javascript | {
"resource": ""
} |
q21520 | append | train | function append() {
var items = this.items;
var _Components$Html = Components.Html,
wrapper = _Components$Html.wrapper,
slides = _Components$Html.slides;
var half = Math.floor(items.length / 2);
var prepend = items.slice(0, half).reverse();
var append = items.slice(ha... | javascript | {
"resource": ""
} |
q21521 | remove | train | function remove() {
var items = this.items;
for (var i = 0; i < items.length; i++) {
Components.Html.wrapper.removeChild(items[i]);
}
} | javascript | {
"resource": ""
} |
q21522 | get | train | function get() {
return (Components.Sizes.slideWidth + Components.Gaps.value) * Clones.items.length;
} | javascript | {
"resource": ""
} |
q21523 | EventsBinder | train | function EventsBinder() {
var listeners = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
classCallCheck(this, EventsBinder);
this.listeners = listeners;
} | javascript | {
"resource": ""
} |
q21524 | bind | train | function bind() {
Binder.on('resize', window, throttle(function () {
Events.emit('resize');
}, Glide.settings.throttle));
} | javascript | {
"resource": ""
} |
q21525 | resolve | train | function resolve(pattern) {
var token = pattern.slice(0, 1);
if (this.is('rtl')) {
return pattern.split(token).join(FLIPED_MOVEMENTS[token]);
}
return pattern;
} | javascript | {
"resource": ""
} |
q21526 | addClass | train | function addClass() {
Components.Html.root.classList.add(Glide.settings.classes.direction[this.value]);
} | javascript | {
"resource": ""
} |
q21527 | removeClass | train | function removeClass() {
Components.Html.root.classList.remove(Glide.settings.classes.direction[this.value]);
} | javascript | {
"resource": ""
} |
q21528 | Rtl | train | function Rtl (Glide, Components) {
return {
/**
* Negates the passed translate if glide is in RTL option.
*
* @param {Number} translate
* @return {Number}
*/
modify: function modify(translate) {
if (Components.Direction.is('rtl')) {
return -translate;
}
ret... | javascript | {
"resource": ""
} |
q21529 | Gap | train | function Gap (Glide, Components) {
return {
/**
* Modifies passed translate value with number in the `gap` settings.
*
* @param {Number} translate
* @return {Number}
*/
modify: function modify(translate) {
return translate + Components.Gaps.value * Glide.index;
}
};
} | javascript | {
"resource": ""
} |
q21530 | Grow | train | function Grow (Glide, Components) {
return {
/**
* Adds to the passed translate width of the half of clones.
*
* @param {Number} translate
* @return {Number}
*/
modify: function modify(translate) {
return translate + Components.Clones.grow / 2;
}
};
} | javascript | {
"resource": ""
} |
q21531 | modify | train | function modify(translate) {
if (Glide.settings.focusAt >= 0) {
var peek = Components.Peek.value;
if (isObject(peek)) {
return translate - peek.before;
}
return translate - peek;
}
return translate;
} | javascript | {
"resource": ""
} |
q21532 | Focusing | train | function Focusing (Glide, Components) {
return {
/**
* Modifies passed translate value with index in the `focusAt` setting.
*
* @param {Number} translate
* @return {Number}
*/
modify: function modify(translate) {
var gap = Components.Gaps.value;
var width = Components.Siz... | javascript | {
"resource": ""
} |
q21533 | mutator | train | function mutator (Glide, Components, Events) {
/**
* Merge instance transformers with collection of default transformers.
* It's important that the Rtl component be last on the list,
* so it reflects all previous transformations.
*
* @type {Array}
*/
var TRANSFORMERS = [Gap, Grow, Peeking, Focusin... | javascript | {
"resource": ""
} |
q21534 | mutate | train | function mutate(translate) {
for (var i = 0; i < TRANSFORMERS.length; i++) {
var transformer = TRANSFORMERS[i];
if (isFunction(transformer) && isFunction(transformer().modify)) {
translate = transformer(Glide, Components, Events).modify(translate);
} else {
warn('Trans... | javascript | {
"resource": ""
} |
q21535 | set | train | function set(value) {
var transform = mutator(Glide, Components).mutate(value);
Components.Html.wrapper.style.transform = 'translate3d(' + -1 * transform + 'px, 0px, 0px)';
} | javascript | {
"resource": ""
} |
q21536 | compose | train | function compose(property) {
var settings = Glide.settings;
if (!disabled) {
return property + ' ' + this.duration + 'ms ' + settings.animationTimingFunc;
}
return property + ' 0ms ' + settings.animationTimingFunc;
} | javascript | {
"resource": ""
} |
q21537 | set | train | function set() {
var property = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'transform';
Components.Html.wrapper.style.transition = this.compose(property);
} | javascript | {
"resource": ""
} |
q21538 | get | train | function get() {
var settings = Glide.settings;
if (Glide.isType('slider') && Components.Run.offset) {
return settings.rewindDuration;
}
return settings.animationDuration;
} | javascript | {
"resource": ""
} |
q21539 | start | train | function start(event) {
if (!disabled && !Glide.disabled) {
this.disable();
var swipe = this.touches(event);
swipeSin = null;
swipeStartX = toInt(swipe.pageX);
swipeStartY = toInt(swipe.pageY);
this.bindSwipeMove();
this.bindSwipeEnd();
Events.em... | javascript | {
"resource": ""
} |
q21540 | move | train | function move(event) {
if (!Glide.disabled) {
var _Glide$settings = Glide.settings,
touchAngle = _Glide$settings.touchAngle,
touchRatio = _Glide$settings.touchRatio,
classes = _Glide$settings.classes;
var swipe = this.touches(event);
var subExSx = toI... | javascript | {
"resource": ""
} |
q21541 | end | train | function end(event) {
if (!Glide.disabled) {
var settings = Glide.settings;
var swipe = this.touches(event);
var threshold = this.threshold(event);
var swipeDistance = swipe.pageX - swipeStartX;
var swipeDeg = swipeSin * 180 / Math.PI;
var steps = Math.round(swipe... | javascript | {
"resource": ""
} |
q21542 | bindSwipeStart | train | function bindSwipeStart() {
var _this = this;
var settings = Glide.settings;
if (settings.swipeThreshold) {
Binder.on(START_EVENTS[0], Components.Html.wrapper, function (event) {
_this.start(event);
}, capture);
}
if (settings.dragThreshold) {
Binder.on... | javascript | {
"resource": ""
} |
q21543 | unbindSwipeStart | train | function unbindSwipeStart() {
Binder.off(START_EVENTS[0], Components.Html.wrapper, capture);
Binder.off(START_EVENTS[1], Components.Html.wrapper, capture);
} | javascript | {
"resource": ""
} |
q21544 | bindSwipeMove | train | function bindSwipeMove() {
var _this2 = this;
Binder.on(MOVE_EVENTS, Components.Html.wrapper, throttle(function (event) {
_this2.move(event);
}, Glide.settings.throttle), capture);
} | javascript | {
"resource": ""
} |
q21545 | bindSwipeEnd | train | function bindSwipeEnd() {
var _this3 = this;
Binder.on(END_EVENTS, Components.Html.wrapper, function (event) {
_this3.end(event);
});
} | javascript | {
"resource": ""
} |
q21546 | touches | train | function touches(event) {
if (MOUSE_EVENTS.indexOf(event.type) > -1) {
return event;
}
return event.touches[0] || event.changedTouches[0];
} | javascript | {
"resource": ""
} |
q21547 | threshold | train | function threshold(event) {
var settings = Glide.settings;
if (MOUSE_EVENTS.indexOf(event.type) > -1) {
return settings.dragThreshold;
}
return settings.swipeThreshold;
} | javascript | {
"resource": ""
} |
q21548 | detach | train | function detach() {
prevented = true;
if (!detached) {
for (var i = 0; i < this.items.length; i++) {
this.items[i].draggable = false;
this.items[i].setAttribute('data-href', this.items[i].getAttribute('href'));
this.items[i].removeAttribute('href');
}
... | javascript | {
"resource": ""
} |
q21549 | attach | train | function attach() {
prevented = false;
if (detached) {
for (var i = 0; i < this.items.length; i++) {
this.items[i].draggable = true;
this.items[i].setAttribute('href', this.items[i].getAttribute('data-href'));
}
detached = false;
}
return this;
... | javascript | {
"resource": ""
} |
q21550 | mount | train | function mount() {
/**
* Collection of navigation HTML elements.
*
* @private
* @type {HTMLCollection}
*/
this._n = Components.Html.root.querySelectorAll(NAV_SELECTOR);
/**
* Collection of controls HTML elements.
*
* @private
* @type {HTM... | javascript | {
"resource": ""
} |
q21551 | removeActive | train | function removeActive() {
for (var i = 0; i < this._n.length; i++) {
this.removeClass(this._n[i].children);
}
} | javascript | {
"resource": ""
} |
q21552 | addClass | train | function addClass(controls) {
var settings = Glide.settings;
var item = controls[Glide.index];
if (item) {
item.classList.add(settings.classes.activeNav);
siblings(item).forEach(function (sibling) {
sibling.classList.remove(settings.classes.activeNav);
});
}
... | javascript | {
"resource": ""
} |
q21553 | removeClass | train | function removeClass(controls) {
var item = controls[Glide.index];
if (item) {
item.classList.remove(Glide.settings.classes.activeNav);
}
} | javascript | {
"resource": ""
} |
q21554 | addBindings | train | function addBindings() {
for (var i = 0; i < this._c.length; i++) {
this.bind(this._c[i].children);
}
} | javascript | {
"resource": ""
} |
q21555 | removeBindings | train | function removeBindings() {
for (var i = 0; i < this._c.length; i++) {
this.unbind(this._c[i].children);
}
} | javascript | {
"resource": ""
} |
q21556 | bind | train | function bind(elements) {
for (var i = 0; i < elements.length; i++) {
Binder.on('click', elements[i], this.click);
Binder.on('touchstart', elements[i], this.click, capture);
}
} | javascript | {
"resource": ""
} |
q21557 | unbind | train | function unbind(elements) {
for (var i = 0; i < elements.length; i++) {
Binder.off(['click', 'touchstart'], elements[i]);
}
} | javascript | {
"resource": ""
} |
q21558 | click | train | function click(event) {
event.preventDefault();
Components.Run.make(Components.Direction.resolve(event.currentTarget.getAttribute('data-glide-dir')));
} | javascript | {
"resource": ""
} |
q21559 | press | train | function press(event) {
if (event.keyCode === 39) {
Components.Run.make(Components.Direction.resolve('>'));
}
if (event.keyCode === 37) {
Components.Run.make(Components.Direction.resolve('<'));
}
} | javascript | {
"resource": ""
} |
q21560 | start | train | function start() {
var _this = this;
if (Glide.settings.autoplay) {
if (isUndefined(this._i)) {
this._i = setInterval(function () {
_this.stop();
Components.Run.make('>');
_this.start();
}, this.time);
}
}
} | javascript | {
"resource": ""
} |
q21561 | bind | train | function bind() {
var _this2 = this;
Binder.on('mouseover', Components.Html.root, function () {
_this2.stop();
});
Binder.on('mouseout', Components.Html.root, function () {
_this2.start();
});
} | javascript | {
"resource": ""
} |
q21562 | get | train | function get() {
var autoplay = Components.Html.slides[Glide.index].getAttribute('data-glide-autoplay');
if (autoplay) {
return toInt(autoplay);
}
return toInt(Glide.settings.autoplay);
} | javascript | {
"resource": ""
} |
q21563 | match | train | function match(points) {
if (typeof window.matchMedia !== 'undefined') {
for (var point in points) {
if (points.hasOwnProperty(point)) {
if (window.matchMedia('(max-width: ' + point + 'px)').matches) {
return points[point];
}
}
}
}
... | javascript | {
"resource": ""
} |
q21564 | createCallback | train | function createCallback(element,callback) {
var fn = function(originalEvent) {
!originalEvent && ( originalEvent = window.event );
// create a normalized event object
var event = {
// keep a ref to the original event object
originalEvent: originalEvent,
target: originalE... | javascript | {
"resource": ""
} |
q21565 | subclass$ | train | function subclass$(obj,sup) {
for (var k in sup) {
if (sup.hasOwnProperty(k)) obj[k] = sup[k];
};
// obj.__super__ = sup;
obj.prototype = Object.create(sup.prototype);
obj.__super__ = obj.prototype.__super__ = sup.prototype;
obj.prototype.initialize = obj.prototype.constructor = obj;
} | javascript | {
"resource": ""
} |
q21566 | Parens | train | function Parens(value,open,close){
this.setup();
this._open = open;
this._close = close;
this._value = this.load(value);
} | javascript | {
"resource": ""
} |
q21567 | Param | train | function Param(name,defaults,typ){
// could have introduced bugs by moving back to identifier here
this._traversed = false;
this._name = name;
this._defaults = defaults;
this._typ = typ;
this._variable = null;
} | javascript | {
"resource": ""
} |
q21568 | Root | train | function Root(body,opts){
this._traversed = false;
this._body = AST.blk(body);
this._scope = new RootScope(this,null);
this._options = {};
} | javascript | {
"resource": ""
} |
q21569 | Literal | train | function Literal(v){
this._traversed = false;
this._expression = true;
this._cache = null;
this._raw = null;
this._value = this.load(v);
} | javascript | {
"resource": ""
} |
q21570 | Str | train | function Str(v){
this._traversed = false;
this._expression = true;
this._cache = null;
this._value = v;
// should grab the actual value immediately?
} | javascript | {
"resource": ""
} |
q21571 | InterpolatedString | train | function InterpolatedString(nodes,o){
if(o === undefined) o = {};
this._nodes = nodes;
this._options = o;
this;
} | javascript | {
"resource": ""
} |
q21572 | Identifier | train | function Identifier(value){
this._value = this.load(value);
this._symbol = null;
this._setter = null;
if (("" + value).indexOf("?") >= 0) {
this._safechain = true;
};
// @safechain = ("" + value).indexOf("?") >= 0
this;
} | javascript | {
"resource": ""
} |
q21573 | For | train | function For(o){
if(o === undefined) o = {};
this._traversed = false;
this._options = o;
this._scope = new ForScope(this);
this._catcher = null;
} | javascript | {
"resource": ""
} |
q21574 | TagTree | train | function TagTree(owner,list,options){
if(options === undefined) options = {};
this._owner = owner;
this._nodes = this.load(list);
this._options = options;
this._conditions = [];
this._blocks = [this];
this._counter = 0;
this;
} | javascript | {
"resource": ""
} |
q21575 | RootScope | train | function RootScope(){
RootScope.prototype.__super__.constructor.apply(this,arguments);
this.register('global',this,{type: 'global'});
this.register('module',this,{type: 'global'});
this.register('window',this,{type: 'global'});
this.register('document',this,{type: 'global'});
this.register('exports',this,{type:... | javascript | {
"resource": ""
} |
q21576 | train | function(root,node,before) {
if (node instanceof Array) {
var i = 0;
var c = node.taglen;
var k = (c != null) ? ((node.domlen = c)) : node.length;
while (i < k){
insertNestedBefore(root,node[i++],before);
};
} else if (node && node._dom) {
root.insertBefore(node,before);
} else if (node != null && nod... | javascript | {
"resource": ""
} | |
q21577 | train | function(root,new$,old,caret) {
var nl = new$.length;
var ol = old.length;
var cl = new$.cache.i$; // cache-length
var i = 0,d = nl - ol;
// TODO support caret
// find the first index that is different
while (i < ol && i < nl && new$[i] === old[i]){
i++;
};
// conditionally prune cache
if (cl > 1000 &... | javascript | {
"resource": ""
} | |
q21578 | train | function(root,new$,old,caret) {
// var skipnew = new == null or new === false or new === true
var newIsNull = new$ == null || new$ === false;
var oldIsNull = old == null || old === false;
if (new$ === old) {
// remember that the caret must be an actual dom element
// we should instead move the actual care... | javascript | {
"resource": ""
} | |
q21579 | train | function(token,i,tokens) {
var type = token._type;
if (!seenSingle && token.fromThen) {
return true;
};
var ifelse = type == 'IF' || type == 'UNLESS' || type == 'ELSE';
if (ifelse || type === 'CATCH') {
seenSingle = true;
};
if (ifelse || type === 'SWITCH' || type == 'TRY') {
seenC... | javascript | {
"resource": ""
} | |
q21580 | processOperators | train | function processOperators (ops) {
if (!ops) return {};
var operators = {};
for (var i=0,k,prec;prec=ops[i]; i++) {
for (k=1;k < prec.length;k++) {
operators[prec[k]] = {precedence: i+1, assoc: prec[0]};
}
}
return operators;
} | javascript | {
"resource": ""
} |
q21581 | addSymbol | train | function addSymbol (s) {
if (s && !symbols_[s]) {
symbols_[s] = ++symbolId;
symbols.push(s);
}
} | javascript | {
"resource": ""
} |
q21582 | tokenStackLex | train | function tokenStackLex() {
var token;
token = tstack.pop() || lexer.lex() || EOF;
// if token isn't its numeric value, convert
if (typeof token !== 'number') {
if (token instanceof Array) {
tstack = token;
token = tstack.pop();
}
token = self.symbols_[toke... | javascript | {
"resource": ""
} |
q21583 | createVariable | train | function createVariable() {
var id = nextVariableId++;
var name = '$V';
do {
name += variableTokens[id % variableTokensLength];
id = ~~(id / variableTokensLength);
} while (id !== 0);
return name;
} | javascript | {
"resource": ""
} |
q21584 | locateNearestErrorRecoveryRule | train | function locateNearestErrorRecoveryRule(state) {
var stack_probe = stack.length - 1;
var depth = 0;
// try to recover from error
for(;;) {
// check for error recovery rule in this state
if ((TERROR.toString()) in table[state]) {
... | javascript | {
"resource": ""
} |
q21585 | LALR_buildNewGrammar | train | function LALR_buildNewGrammar () {
var self = this,
newg = this.newg;
this.states.forEach(function (state, i) {
state.forEach(function (item) {
if (item.dotPosition === 0) {
// new symbols are a combination of state and transition symbol
... | javascript | {
"resource": ""
} |
q21586 | focusTab | train | function focusTab(tabId) {
var updateProperties = { "active": true };
chrome.tabs.update(tabId, updateProperties, function (tab) { });
} | javascript | {
"resource": ""
} |
q21587 | save_options | train | function save_options() {
var showChangeLog = document.getElementById('show_changelog').checked;
chrome.storage.sync.set({
showChangeLog: showChangeLog
}, function () {
// Update status to let user know options were saved.
var status = document.getElementById('status');
status.textContent = 'Optio... | javascript | {
"resource": ""
} |
q21588 | restore_options | train | function restore_options() {
// Use default value showChangeLog = true.
chrome.storage.sync.get({
showChangeLog: true
}, function (items) {
document.getElementById('show_changelog').checked = items.showChangeLog;
});
} | javascript | {
"resource": ""
} |
q21589 | style | train | function style (s, t) {
if (!t) return (text) => style(s, text)
return cli.color[styles[s] || s](t)
} | javascript | {
"resource": ""
} |
q21590 | buildReporter | train | function buildReporter(methods) {
return {
supports: methods.supports,
begin: buildReporterMethod(methods.begin),
results: buildReporterMethod(methods.results),
log: {
debug: buildReporterMethod(methods.debug),
error: buildReporterMethod(methods.error, 'error'),
info: buildReporterMethod(methods.info)... | javascript | {
"resource": ""
} |
q21591 | buildReporterMethod | train | function buildReporterMethod(method, consoleMethod = 'log') {
if (typeof method !== 'function') {
method = () => {};
}
return async input => {
const output = await method(input);
if (output) {
console[consoleMethod](output);
}
};
} | javascript | {
"resource": ""
} |
q21592 | isValidAction | train | function isValidAction(actionString) {
return module.exports.actions.some(foundAction => {
return foundAction.match.test(actionString);
});
} | javascript | {
"resource": ""
} |
q21593 | pa11y | train | async function pa11y(url, options = {}, callback) {
const state = {};
/* eslint-disable prefer-rest-params */
// Check for presence of a callback function
if (typeof arguments[arguments.length - 1] === 'function') {
callback = arguments[arguments.length - 1];
} else {
callback = undefined;
}
/* eslint-enabl... | javascript | {
"resource": ""
} |
q21594 | defaultOptions | train | function defaultOptions(options) {
options = extend({}, pa11y.defaults, options);
options.ignore = options.ignore.map(ignored => ignored.toLowerCase());
if (!options.includeNotices) {
options.ignore.push('notice');
}
if (!options.includeWarnings) {
options.ignore.push('warning');
}
return options;
} | javascript | {
"resource": ""
} |
q21595 | verifyOptions | train | function verifyOptions(options) {
if (!pa11y.allowedStandards.includes(options.standard)) {
throw new Error(`Standard must be one of ${pa11y.allowedStandards.join(', ')}`);
}
if (options.page && !options.browser) {
throw new Error('The page option must only be set alongside the browser option');
}
} | javascript | {
"resource": ""
} |
q21596 | configureHtmlCodeSniffer | train | function configureHtmlCodeSniffer() {
if (options.rules.length && options.standard !== 'Section508') {
for (const rule of options.rules) {
if (window.HTMLCS_WCAG2AAA.sniffs.includes(rule)) {
window[`HTMLCS_${options.standard}`].sniffs[0].include.push(rule);
} else {
throw new Error(`${rule}... | javascript | {
"resource": ""
} |
q21597 | runHtmlCodeSniffer | train | function runHtmlCodeSniffer() {
return new Promise((resolve, reject) => {
window.HTMLCS.process(options.standard, window.document, error => {
if (error) {
return reject(error);
}
resolve(window.HTMLCS.getMessages());
});
});
} | javascript | {
"resource": ""
} |
q21598 | processIssues | train | function processIssues(issues) {
if (options.rootElement) {
issues = issues.filter(isIssueInTestArea);
}
if (options.hideElements) {
issues = issues.filter(isElementOutsideHiddenArea);
}
return issues.map(processIssue).filter(isIssueNotIgnored);
} | javascript | {
"resource": ""
} |
q21599 | processIssue | train | function processIssue(issue) {
return {
code: issue.code,
context: processIssueHtml(issue.element),
message: issue.msg,
type: issueTypeMap[issue.type] || 'unknown',
typeCode: issue.type,
selector: getCssSelectorForElement(issue.element)
};
} | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.