_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 27 233k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q14000 | relativeURI | train | function relativeURI(uri, base) {
// reduce base and uri strings to just their difference string
var baseParts = base.split('/');
baseParts.pop();
base = baseParts.join('/') + '/';
i = 0;
while (base.substr(i, 1) == uri.substr(i, 1))
i++;
while (base.substr(i, 1) != '/')
i--... | javascript | {
"resource": ""
} |
q14001 | partialAny | train | function partialAny(fn /* arguments */) {
var appliedArgs = Array.prototype.slice.call(arguments, 1);
if ( appliedArgs.length < 1 ) return fn;
return function () {
var args = _.deepClone(appliedArgs);
var partialArgs = _.toArray(arguments);
for (var i=0; i < args.length; i++) {
| javascript | {
"resource": ""
} |
q14002 | tryFn | train | function tryFn(fn, args) {
try {
return Promise.resolve(fn.apply(null, args));
} | javascript | {
"resource": ""
} |
q14003 | train | function (key, value) {
if (!supported) {
try {
$cookieStore.set(key, value);
return value;
} catch (e) {
console.log('Local Storage not | javascript | {
"resource": ""
} | |
q14004 | train | function (key) {
if (!supported) {
try {
return privateMethods.parseValue($cookieStore.get(key));
} catch (e) {
return null;
}
| javascript | {
"resource": ""
} | |
q14005 | train | function (key) {
if (!supported) {
try {
$cookieStore.remove(key);
return true;
} catch (e) {
return false;
| javascript | {
"resource": ""
} | |
q14006 | CanaryStore | train | function CanaryStore() {
var self = this;
EventEmitter.call(self);
var counter = self._counter = new Counter();
counter.on('resource', self._onresource.bind(self));
self._id = 0;
self._variants = {};
self._callbacks = {};
self._assigners = [];
self._assignments = {};
self._overrides = {};
self._p... | javascript | {
"resource": ""
} |
q14007 | isModuleInstalledGlobally | train | function isModuleInstalledGlobally(name, fn) {
var cmd = 'npm ls --global --json --depth=0';
exec(cmd, function(err, stdout) { | javascript | {
"resource": ""
} |
q14008 | controllerWrap | train | function controllerWrap(ctx, ctrl, hooks, next) {
let result
const preHooks = []
hooks.pre.map(pre => {
preHooks.push(() => pre(ctx))
})
return sequenceAndReturnOne(preHooks)
.then(() => {
return ctrl(ctx)
})
.then(data => {
if (!data && ctx.body && ctx.body.data) {
data =... | javascript | {
"resource": ""
} |
q14009 | train | function(arr, iterator, callback) {
callback = _doOnce(callback || noop);
var amount = arr.length;
if (!isArray(arr)) return callback();
var completed = 0;
doEach(arr, function(item) {
iterator(item, doOnce(function(err) {
if (err) {
| javascript | {
"resource": ""
} | |
q14010 | train | function(tasks, callback) {
var keys; var length; var i; var results; var kind;
var updated_tasks = [];
var is_object;
var counter = 0;
if (isArray(tasks)) {
length = tasks.length;
results = [];
} else if (isObject(tasks)) {
is_object = true;
keys... | javascript | {
"resource": ""
} | |
q14011 | train | function(tasks, callback) {
if (!isArray(tasks)) return callback();
var length = tasks.length;
var results = [];
function runTask(index) {
tasks[index](function(err, result) {
if (err) return callback(err);
results[index] = result;
| javascript | {
"resource": ""
} | |
q14012 | methodWrapper | train | function methodWrapper(fn) {
return function() {
var args = [].slice.call(arguments);
| javascript | {
"resource": ""
} |
q14013 | getNewFilename | train | function getNewFilename(list, name) {
if (list.indexOf(name) === -1) {
return name;
}
const parsed = parseFilename(name);
const base = parsed.base;
const ext = parsed.ext;
if (!base) {
const newName = getNextNumberName(ext);
| javascript | {
"resource": ""
} |
q14014 | processDirective | train | function processDirective(list, directive) {
_(options.paths).forEach(function(filepath) {
_.each(list, function(item) {
item = path.join(filepath, item);
| javascript | {
"resource": ""
} |
q14015 | create | train | function create (config) {
/** Generate each client as described. */
config.clients.forEach(function (client) {
if (client.type === 'node') { | javascript | {
"resource": ""
} |
q14016 | Multibundle | train | function Multibundle(config, components)
{
var tasks;
if (!(this instanceof Multibundle))
{
return new Multibundle(config, components);
}
// turn on object mode
Readable.call(this, {objectMode: true});
// prepare config options
this.config = lodash.merge({}, Multibundle._defaults, config);
this... | javascript | {
"resource": ""
} |
q14017 | train | function (tokens){
if (!this.next()) return;
if (this.current.type === "heading" &&
| javascript | {
"resource": ""
} | |
q14018 | train | function (option) {
if (!this.next()) return;
if (this.current.type === "paragraph") {
this.results.push({
name: option,
| javascript | {
"resource": ""
} | |
q14019 | LENGTH_VALIDATOR | train | function LENGTH_VALIDATOR(v) {
v = (v || '').toString()
var match = v.match(LENGTH_REGEXP)
if (match) {
var unit = match[1]
if (!unit) {
return {value: parseFloat(v)}
}
else if (SUPPORT_CSS_UNIT.indexOf(unit) > -1) {
return {value: v}
}
else {
return {
value: par... | javascript | {
"resource": ""
} |
q14020 | NUMBER_VALIDATOR | train | function NUMBER_VALIDATOR(v) {
v = (v || '').toString()
var match = v.match(LENGTH_REGEXP)
if (match && !match[1]) {
return {value: parseFloat(v)}
| javascript | {
"resource": ""
} |
q14021 | INTEGER_VALIDATOR | train | function INTEGER_VALIDATOR(v) {
v = (v || '').toString()
if (v.match(/^[-+]?\d+$/)) {
return {value: parseInt(v, 10)}
}
return {
value: null,
reason: function reason(k, v, result) {
| javascript | {
"resource": ""
} |
q14022 | genValidatorMap | train | function genValidatorMap() {
var groupName, group, name
for (groupName in PROP_NAME_GROUPS) {
group = PROP_NAME_GROUPS[groupName]
| javascript | {
"resource": ""
} |
q14023 | train | function(post) {
return $http({
url : '/api/v1/posts/' + post._id,
method : 'PUT',
| javascript | {
"resource": ""
} | |
q14024 | train | function(id) {
return $http({
url : '/api/v1/posts/' + id,
method : 'DELETE',
| javascript | {
"resource": ""
} | |
q14025 | train | function() {
if (!this.routes) {
return;
}
var routes = [];
for (var route in this.routes) {
if (this.routes.hasOwnProperty(route)) {
routes.unshift([route, this.routes[route]]);
}
}
for | javascript | {
"resource": ""
} | |
q14026 | train | function( editor, element ) {
// Transform the element into a CKEDITOR.dom.element instance.
this.base( element.$ || element );
this.editor = editor;
/**
* Indicates the initialization status of the editable element. The following statuses are available:
*
* * **unloaded** – the initial ... | javascript | {
"resource": ""
} | |
q14027 | train | function( cls ) {
var classes = this.getCustomData( 'classes' );
if ( !this.hasClass( cls ) ) {
!classes && ( classes = [] ), classes.push( cls ); | javascript | {
"resource": ""
} | |
q14028 | train | function( attr, val ) {
var orgVal = this.getAttribute( attr );
if ( val !== orgVal ) {
!this._.attrChanges && ( this._.attrChanges = {} );
// Saved the original attribute val.
| javascript | {
"resource": ""
} | |
q14029 | train | function( element, range ) {
var editor = this.editor,
enterMode = editor.config.enterMode,
elementName = element.getName(),
isBlock = CKEDITOR.dtd.$block[ elementName ];
if ( range.checkReadOnly() )
return false;
// Remove the original contents, merge split nodes.
range.deleteCont... | javascript | {
"resource": ""
} | |
q14030 | train | function( element ) {
// Prepare for the insertion. For example - focus editor (#11848).
beforeInsert( this );
var editor = this.editor,
enterMode = editor.activeEnterMode,
selection = editor.getSelection(),
range = selection.getRanges()[ 0 ],
elementName = element.getName(),
isBlo... | javascript | {
"resource": ""
} | |
q14031 | needsBrFiller | train | function needsBrFiller( selection, path ) {
// Fake selection does not need filler, because it is fake.
if ( selection.isFake )
return 0;
// Ensure bogus br could help to move cursor (out of styles) to the end of block. (#7041)
var pathBlock = path.block || path.blockLimit,
lastNode = pathBlock && pathBl... | javascript | {
"resource": ""
} |
q14032 | prepareRangeToDataInsertion | train | function prepareRangeToDataInsertion( that ) {
var range = that.range,
mergeCandidates = that.mergeCandidates,
node, marker, path, startPath, endPath, previous, bm;
// If range starts in inline element then insert a marker, so empty
// inline elements won't be removed while range.deleteContents
// ... | javascript | {
"resource": ""
} |
q14033 | stripBlockTagIfSingleLine | train | function stripBlockTagIfSingleLine( dataWrapper ) {
var block, children;
if ( dataWrapper.getChildCount() == 1 && // Only one node bein inserted.
checkIfElement( block = dataWrapper.getFirst() ) && // And it's an element.
block.is( stripSingleBlockTags ) ) // That's <p> or <div> or header.
{... | javascript | {
"resource": ""
} |
q14034 | Kernel | train | function Kernel(){
this.registrations = new Registrations()
this.decorators = new Decorators()
this.resolvers = {}
this.activators = {}
| javascript | {
"resource": ""
} |
q14035 | forkWorkers | train | function forkWorkers(numWorkers, env) {
var workers = [];
env = env || {};
for(var i = 0; i < numWorkers; i++) {
worker = cluster.fork(env);
console.info("Start | javascript | {
"resource": ""
} |
q14036 | run | train | function run(booleanOrString, anyDataType, functionOrObject, aNumber, anArray) {
/*
* if expectations aren't met, args checker will throw appropriate exceptions
| javascript | {
"resource": ""
} |
q14037 | catchError | train | function catchError (stream) {
return {
source: pull(
stream.source,
pullCatch((err) => {
if (err.message === 'Channel destroyed') {
| javascript | {
"resource": ""
} |
q14038 | datesOfToday | train | function datesOfToday () {
const ret = {}
ret.year = String(new Date().getFullYear())
ret.month = | javascript | {
"resource": ""
} |
q14039 | closureRequire | train | function closureRequire(symbol) {
closure.goog.require(symbol); | javascript | {
"resource": ""
} |
q14040 | buildURL | train | function buildURL(dbName, opts) {
var authentication
opts.scheme = opts.scheme || 'http'
opts.host = opts.host || '127.0.0.1'
opts.port = opts.port || '5984'
if (has(opts, 'auth')) {
if (typeof opts.auth === 'object') {
| javascript | {
"resource": ""
} |
q14041 | pushCouchapp | train | function pushCouchapp(dbName, opts) {
opts = opts || {}
if (!dbName && typeof dbName !== 'string') {
throw new PluginError(PLUGIN_NAME, 'Missing database name.');
}
return through.obj(function (file, enc, cb) {
var ddocObj = require(file.path)
var url = /^https?:\/\//.test(dbName) ? dbName : build... | javascript | {
"resource": ""
} |
q14042 | whiteOrBlack | train | function whiteOrBlack( color ) {
color = color.replace( /^#/, '' );
for ( var i = 0, rgb = []; i <= 2; i++ )
rgb[ i ] = parseInt( color.substr( i * 2, 2 ), 16 );
var luma = ( | javascript | {
"resource": ""
} |
q14043 | updateHighlight | train | function updateHighlight( event ) {
// Convert to event.
!event.name && ( event = new CKEDITOR.event( event ) );
var isFocus = !( /mouse/ ).test( event.name ),
target = event.data.getTarget(),
color;
if ( target.getName() == 'td' && ( color = target.getChild( 0 ).getHtml() ) ) {
removeHighli... | javascript | {
"resource": ""
} |
q14044 | removeHighlight | train | function removeHighlight( event ) {
var isFocus = !( /mouse/ ).test( event.name ),
target = isFocus && focused;
if ( target ) {
var color = target.getChild( 0 ).getHtml();
target.setStyle( 'border-color', color );
target.setStyle( 'border-style', 'solid' );
}
| javascript | {
"resource": ""
} |
q14045 | num | train | function num(type, value) {
var val;
if(type === NUMERIC.INTEGER) {
val = utils.strtoint(value);
| javascript | {
"resource": ""
} |
q14046 | type | train | function type(cmd, args, info) {
// definition provided by earlier command validation
/* istanbul ignore next: currently subcommands do not type validate */
var def = info.command.sub ? info.command.sub.def : info.command.def
// expected type of the value based on the supplied command
, expected = TYPES[c... | javascript | {
"resource": ""
} |
q14047 | getMeasurements | train | function getMeasurements(startDate, endDate, params, callback) {
params = params || {};
if(!startDate && !endDate) {
startDate = new Date();
startDate.setHours(startDate.getHours() - 24);
startDate = formatDate(startDate);
endDate = new Date();
endDate = formatDate(endDate);
}
| javascript | {
"resource": ""
} |
q14048 | validate | train | function validate(rules, args, cb) {
try {
_known(rules, args);
_required(rules, args);
Object.keys(args).forEach(function (arg) {
var value = args[arg],
ruleSet = rules[arg];
try {
ruleSet.forEach(function (rule) {
| javascript | {
"resource": ""
} |
q14049 | clone | train | function clone(obj1, obj2, index) {
index = index || 0;
for (var i in obj2) {
| javascript | {
"resource": ""
} |
q14050 | addContentsDirectoryToReaddirResultAndCallOriginalCallback | train | function addContentsDirectoryToReaddirResultAndCallOriginalCallback(err, entryNames) {
if (!err && Array.isArray(entryNames)) {
| javascript | {
"resource": ""
} |
q14051 | html | train | function html(template) {
var expressions = [];
for (var _i = 1; _i < arguments.length; _i++) {
expressions[_i - 1] = arguments[_i];
}
var result = "";
var i = 0;
// resolve each expression and build the result string
for (var _a = 0, template_1 = template; _a < template_1.length; _a... | javascript | {
"resource": ""
} |
q14052 | validatorNum | train | function validatorNum( msg ) {
return function() {
var value = this.getValue(),
pass = !!( CKEDITOR.dialog.validate.integer()( value ) && value > 0 );
| javascript | {
"resource": ""
} |
q14053 | train | function(monitor, callback) {
callback = callback || function(){};
var t = this,
monitorJSON = monitor.toMonitorJSON(),
probeJSON = null,
probeClass = monitorJSON.probeClass,
startTime = Date.now(),
monitorStr = probeClass + '.' + monitor.toServerString().r... | javascript | {
"resource": ""
} | |
q14054 | train | function(monitorJSON, callback) {
// Build a key for this probe from the probeClass and initParams
var t = this,
probeKey = t.buildProbeKey(monitorJSON),
probeClass = monitorJSON.probeClass,
initParams = monitorJSON.initParams,
probeImpl = null;
var whenDone =... | javascript | {
"resource": ""
} | |
q14055 | connect | train | function connect() {
// detect type of each argument
for (var i = 0; i < arguments.length; i++) {
if (arguments[i].constructor.name === 'Mongoose') {
// detected Mongoose
this.mongoose = arguments[i];
} | javascript | {
"resource": ""
} |
q14056 | mod | train | function mod(A, B) {
var C = 1, D = 0
var _B = B
if (B > A) return A
//shift B right until it it's just smaller than A.
while(B < A) {
B<<=1; C<<=1
}
//now, shift B back, while subtracting.
do {
B>>=1; C>>=1
//mark the bits where you could subtract.
//this becomes the quotent!
| javascript | {
"resource": ""
} |
q14057 | validate | train | function validate(json, done) {
var log = []
var err
try {
json = JSON.parse(JSON.stringify(json))
}
catch (e) {
err = e
json = {}
}
Object.keys(json).forEach(function (selector) {
var declarations = json[selector]
Object.keys(declarations).forEach(function (name) {
var value ... | javascript | {
"resource": ""
} |
q14058 | qParallel | train | function qParallel(funcs, count) {
var length = funcs.length;
if (!length) {
return q([]);
}
if (count == null) {
count = Infinity;
}
count = Math.max(count, 1);
count = Math.min(count, funcs.length);
var promises = [];
var values = [];
for (var i = 0; i < coun... | javascript | {
"resource": ""
} |
q14059 | Color | train | function Color(values, spaceAlpha, space) {
this.values = values;
this.alpha = 1;
this.space = 'rgb';
this.originalColor = null;
if (space !== undefined) {
this.alpha = spaceAlpha;
this.space = space;
} else if (spaceAlpha !== | javascript | {
"resource": ""
} |
q14060 | isCompassInstalled | train | function isCompassInstalled() {
var deferred = q.defer(),
cmd = 'compass';
exec(cmd, function (err) {
| javascript | {
"resource": ""
} |
q14061 | scino | train | function scino (num, precision, options) {
if (typeof precision === 'object') {
options = precision
precision = undefined
}
if (typeof num !== 'number') {
return num
}
var parsed = parse(num, precision)
var opts = getValidOptions(options)
var coefficient = parsed.coefficient
var exponent =... | javascript | {
"resource": ""
} |
q14062 | parse | train | function parse (num, precision) {
var exponent = Math.floor(Math.log10(Math.abs(num)))
var coefficient = new Decimal(num)
.mul(new Decimal(Math.pow(10, -1 * exponent)))
return {
coefficient: typeof precision === 'number' | javascript | {
"resource": ""
} |
q14063 | render | train | function render(content, store) {
var type = typeof content;
var node = content;
if(type === 'function') node = render(content(), store);
else if(type === 'string') {
node = document.createTextNode('');
bind(content, function(data) {
| javascript | {
"resource": ""
} |
q14064 | bind | train | function bind(text, fn, store) {
var data = store.data;
var tmpl = mouth(text, store.data);
var cb = tmpl[0];
var keys = tmpl[1];
fn(cb(store.data));
for(var l = keys.length; l--;) {
| javascript | {
"resource": ""
} |
q14065 | fragment | train | function fragment(arr, store) {
var el = document.createDocumentFragment();
for(var i = 0, l = arr.length; i < l; i++) {
| javascript | {
"resource": ""
} |
q14066 | attributes | train | function attributes(el, attrs, store) {
for(var key in attrs) {
var value = attrs[key];
if(typeof value === 'object') value = styles(value);
else if(typeof value === 'function') {
var bool = key.substring(0, 2) === 'on';
if(bool) el.addEventListener(key.slice(2), value);
else el.setAttri... | javascript | {
"resource": ""
} |
q14067 | styles | train | function styles(obj) {
var str = '';
for(var key in obj) {
str | javascript | {
"resource": ""
} |
q14068 | buildCommand | train | function buildCommand(options, dir) {
var cmd = options.bin;
if (options.reportFile) {
cmd += ' --log-pmd ' + options.reportFile;
}
cmd += ' --min-lines ' + options.minLines;
cmd += ' --min-tokens ' + options.minTokens;
if (options.exclude instanceof Array) {
for (var i = 0, l | javascript | {
"resource": ""
} |
q14069 | train | function(args, done) {
debug('checking required files with args', args);
var dir = path.resolve(args['<directory>']);
var tasks = [
'README*',
'LICENSE',
'.travis.yml',
'.gitignore'
].map(function requireFileExists(pattern) {
return function(cb) {
glob(pattern, {
cwd: dir
... | javascript | {
"resource": ""
} | |
q14070 | train | function(args, done) {
var dir = path.resolve(args['<directory>']);
var pkg = require(path.join(dir, 'package.json'));
var schema = Joi.object().keys({
name: Joi.string().min(1).max(30).regex(/^[a-zA-Z0-9][a-zA-Z0-9\.\-_]*$/).required(),
version: Joi.string().regex(/^[0-9]+\.[0-9]+[0-9+a-zA-Z\.\-]+$/).req... | javascript | {
"resource": ""
} | |
q14071 | train | function(args, done) {
function run(cmd) {
return function(cb) {
debug('testing `%s`', cmd);
var parts = cmd.split(' ');
var bin = parts.shift();
var args = parts;
var completed = false;
var child = spawn(bin, args, {
cwd: args['<directory>']
})
.on('erro... | javascript | {
"resource": ""
} | |
q14072 | toBoolean | train | function toBoolean(str, fallback) {
if (typeof str === 'boolean') {
return str;
}
if (REGEXP_TRUE.test(str)) {
return true;
| javascript | {
"resource": ""
} |
q14073 | hashCode | train | function hashCode(str) {
var hash = 0xdeadbeef;
for (var i = str.length; i >= 0; --i) {
hash = (hash * 33) ^ str.charCodeAt(--i); | javascript | {
"resource": ""
} |
q14074 | gravatarUrl | train | function gravatarUrl(email, size) {
var url = 'http://www.gravatar.com/avatar/';
if (email) {
| javascript | {
"resource": ""
} |
q14075 | placeholderUrl | train | function placeholderUrl(width, height, text) {
var url = 'http://placehold.it/' + width;
| javascript | {
"resource": ""
} |
q14076 | digestPassword | train | function digestPassword(password, salt, algorithm, encoding) {
var hash = (salt) ? crypto.createHmac(algorithm || 'sha1', salt) : | javascript | {
"resource": ""
} |
q14077 | digestFile | train | function digestFile(file, algorithm, encoding) {
return crypto.createHash(algorithm | javascript | {
"resource": ""
} |
q14078 | flatten | train | function flatten(a) {
return a.reduce(function(flat, val) {
if (val && typeof val.flatten === 'function') {
flat = flat.concat(val.flatten());
}
else if (Array.isArray(val)) {
| javascript | {
"resource": ""
} |
q14079 | StreamClient | train | function StreamClient(options) {
EventEmitter.call(this);
SockJS = options.SockJS || SockJS; // Facilitate testing
this.options = extend({}, options); // Clone
this.options.debug = this.options.debug || false;
this.options.retry = this.options.retry || 10; // Try to (re)connect 10 times before givin... | javascript | {
"resource": ""
} |
q14080 | train | function (Schema, key) {
if (!this.KEY_SCHEMA_REG_EXP.test(key)) {
throw new Error('invalid schema key format. must be | javascript | {
"resource": ""
} | |
q14081 | train | function (Schema, fieldName, parent) {
var schema = new Schema();
var name = fieldName.replace(this.KEY_FIELD_REG_EXP, | javascript | {
"resource": ""
} | |
q14082 | train | function(gl, vertices, uv) {
var verticesBuf = createBuffer(gl, new Float32Array(vertices))
var uvBuf = createBuffer(gl, new Float32Array(uv))
var mesh = createVAO(gl, [
{ buffer: verticesBuf,
size: 3
},
| javascript | {
"resource": ""
} | |
q14083 | parseQueryString | train | function parseQueryString(query, options) {
const result = {};
let parsedQueryString = qs.parse(query);
for (const key in parsedQueryString) {
const value = parsedQueryString[key];
if (value === '' || value == null) {
throw new MongoParseError('Incomplete key value pair for option');
}
con... | javascript | {
"resource": ""
} |
q14084 | varMatchingAny | train | function varMatchingAny(varnameAtom) {
return sl.list(sl.atom("::", | javascript | {
"resource": ""
} |
q14085 | train | function (url) {
// *WARNING WARNING WARNING*
// This method yields the most correct result we can get but it is EXPENSIVE!
// In ALL browsers! When called multiple times in a sequence, as if when
// we resolve dependencies for entries, it will cause garba... | javascript | {
"resource": ""
} | |
q14086 | train | function (name, value) {
if (typeof name === 'string') {
Boot.config[name] = value;
} else {
for (var s in name) { | javascript | {
"resource": ""
} | |
q14087 | train | function (indexMap, loadOrder) {
// In older versions indexMap was an object instead of a sparse array
if (!('length' in indexMap)) {
var indexArray = [],
index;
for (index in indexMap) {
... | javascript | {
"resource": ""
} | |
q14088 | train | function ( fn, context ) {
// Initialize variables
this.state = Promise.STATE.INITIALIZED;
this.handlers = [];
this.value = fn;
// Rebind control functions to be run always on this promise
this.resolve = this.resolve.bind( this );
this.fulfill = this.fulfill.bind( this );
this.reject = this.reject.bin... | javascript | {
"resource": ""
} | |
q14089 | train | function ( x ) {
if ( Util.is.Error( x ) ) {
return this.reject( x );
}
// Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure
try {
if ( x === this ) {
throw new TypeError('A promise cannot be resolved with itself.');
}
if ( Util.is... | javascript | {
"resource": ""
} | |
q14090 | train | function ( onRejected ) {
if ( onRejected && typeof onRejected !== 'function' ) throw new TypeError("onFulfilled is not a function");
var promise = this,
handler = new Promise.Handler({
onRejected: onRejected,
| javascript | {
"resource": ""
} | |
q14091 | resolve | train | function resolve() {
return whichNativeNodish('..')
.then(function (results) {
var nwVersion = results.nwVersion;
var asVersion = results.asVersion;
debug('which-native-nodish output: %j', results);
var prefix = '';
var target = '';
var debugArg = process.env.BUILD_DEBUG ? ' ... | javascript | {
"resource": ""
} |
q14092 | rgba | train | function rgba(r, g, b, a) {
return new | javascript | {
"resource": ""
} |
q14093 | train | function(cb) {
cb = cb || _.noop;
const self = this;
self._step = 0;
if (self._stack.length<=0) return cb();
(function next() {
const step = _getStep(self);
if (!step) {
cb();
} else if (_.isFunction(step)) {
| javascript | {
"resource": ""
} | |
q14094 | Menu | train | function Menu(arg,opt) {
if ($.isPlainObject(arg) || Array.isArray(arg)) { opt = arg; arg = null; }
/**
* Conteneur du menu contextuel
*/
if (!arg) arg = document.createElement('ul');
if (arg) this.container = $(arg)[0];
/**
*... | javascript | {
"resource": ""
} |
q14095 | train | function() {
var currentIndent = [];
var i;
for (i = 0; i < this._currentIndent; i++) | javascript | {
"resource": ""
} | |
q14096 | train | function() {
if (!this.quiet()) {
var prefix = this._callerInfo() + this._getIndent() + "#".magenta.bold;
var args = argsToArray(arguments).map(function(a) {
if (typeof a != "string") {
a = util.inspect(a);
}
| javascript | {
"resource": ""
} | |
q14097 | train | function() {
if (!this.quiet()) {
var hr = [];
for (var i = 0; i < 79; i++) {
hr[i] = "-";
}
| javascript | {
"resource": ""
} | |
q14098 | train | function(keyDownFn, keyUpFn) {
var g_keyState = {};
var g_oldKeyState = {};
var updateKey = function(keyCode, state) {
g_keyState[keyCode] = state;
if (g_oldKeyState !== g_keyState) {
g_oldKeyState = state;
if (state) {
keyDownFn(keyCode);
} else {
ke... | javascript | {
"resource": ""
} | |
q14099 | sinonDoublist | train | function sinonDoublist(sinon, test, disableAutoSandbox) {
if (typeof test === 'string') {
adapters[test](sinon, disableAutoSandbox);
return;
}
Object.keys(mixin).forEach(function forEachKey(method) {
| javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.