Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
register(function () {
return Promise.resolve().then(function () {
throw new Error('oh noes')
})
})
register(function () {
return Promise.resolve('pong')
})
function loadTreeDataWithAsync() {
return Promise.resolve(addedContent);
}
beforeEach(function(done) {
spyOn(player, 'resizeAd').and.returnValue(LiePromise.resolve(player));
container.style.width = '1024px';
container.style.height = '768px';
process.nextTick(done);
});
this.model.$.trigger( 'dataupdate', updated );
//add type="file" attribute for file references
if ( xmlDataType === 'binary' ) {
if ( newVal.length > 0 ) {
$target.attr( 'type', 'file' );
} else {
$target.removeAttr( 'type' );
}
}
return success;
}
if ( $target.length > 1 ) {
console.error( 'nodeset.setVal expected nodeset with one node, but received multiple' );
return Promise.resolve( null );
}
if ( $target.length === 0 ) {
console.log( 'Data node: ' + this.selector + ' with null-based index: ' + this.index + ' not found. Ignored.' );
return Promise.resolve( null );
}
//always validate if the new value is not empty, even if value didn't change (see validateAll() function)
//return (newVal.length > 0 && validateAll) ? this.validate(expr, xmlDataType) : true;
return Promise.resolve( null );
};
HTMLVideo.prototype.pauseAd = method(function pauseAd() {
var self = this;
var video = this.video;
if (this.video.paused) {
return LiePromise.resolve(this);
}
return new LiePromise(function callPause(resolve) {
once(video, HTML_MEDIA_EVENTS.PAUSE, function onpause() {
resolve(self);
self.emit(VPAID_EVENTS.AdPaused);
});
return video.pause();
});
}, true);
'use strict'
var Promise = require('lie')
var denodeify = require('denodeify')
var rimraf = denodeify(require('rimraf'))
var mkdirp = denodeify(require('mkdirp'))
var glob = require('glob-promise')
var streamToPromise = require('stream-to-promise')
var browserify = require('browserify')
var fs = require('fs')
var writeFile = denodeify(fs.writeFile)
var path = require('path')
Promise.resolve().then(function () {
return rimraf('test/bundle')
}).then(function () {
return mkdirp('test/bundle')
}).then(function () {
return glob('test/worker*js')
}).then(function (files) {
return Promise.all(files.map(function (file) {
var b = browserify(file, { debug: true })
if (process.env.COVERAGE === '1') {
b = b.transform('istanbulify')
}
b = b.bundle()
return streamToPromise(b).then(function (buff) {
var outputFile = 'bundle-' + path.basename(file)
return writeFile(outputFile, buff, 'utf-8')
})
function validate (state, doc) {
if (state.validate === undefined) {
return Promise.resolve()
}
return Promise.resolve()
.then(function () {
return state.validate(doc)
})
.catch(function (rejectValue) {
var error = new Error()
if (rejectValue instanceof Error) {
Object.keys(rejectValue).map(function (key) {
error[key] = rejectValue[key]
})
if (rejectValue.message) {
function push (state, docsOrIds) {
var pushedObjects = []
var errors = state.db.constructor.Errors
return Promise.resolve(state.remote)
.then(function (remote) {
return new Promise(function (resolve, reject) {
if (Array.isArray(docsOrIds)) {
docsOrIds = docsOrIds.map(toId)
} else {
docsOrIds = docsOrIds && [toId(docsOrIds)]
}
if (docsOrIds && docsOrIds.filter(Boolean).length !== docsOrIds.length) {
return Promise.reject(errors.NOT_AN_OBJECT)
}
var replication = state.db.replicate.to(remote, {
create_target: true,
doc_ids: docsOrIds,
function validate (state, doc) {
if (state.validate === undefined) {
return Promise.resolve()
}
return Promise.resolve()
.then(function () {
return state.validate(doc)
})
.catch(function (rejectValue) {
var error = new Error()
if (rejectValue instanceof Error) {
Object.keys(rejectValue).map(function (key) {
error[key] = rejectValue[key]
})
if (rejectValue.message) {
error.message = rejectValue.message
} else {
error.message = 'document validation failed'