require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){"use strict";var merge=require("merge");var Row=module.exports=function(params){this.top=params.top;this.left=params.left;this.width=params.width;this.spacing=params.spacing;this.targetRowHeight=params.targetRowHeight;this.targetRowHeightTolerance=params.targetRowHeightTolerance;this.minAspectRatio=this.width/params.targetRowHeight*(1-params.targetRowHeightTolerance);this.maxAspectRatio=this.width/params.targetRowHeight*(1+params.targetRowHeightTolerance);this.edgeCaseMinRowHeight=params.edgeCaseMinRowHeight||Number.NEGATIVE_INFINITY;this.edgeCaseMaxRowHeight=params.edgeCaseMaxRowHeight||Number.POSITIVE_INFINITY;this.rightToLeft=params.rightToLeft;this.isBreakoutRow=params.isBreakoutRow;this.items=[];this.height=0};Row.prototype={addItem:function addItem(itemData){var newItems=this.items.concat(itemData),rowWidthWithoutSpacing=this.width-(newItems.length-1)*this.spacing,newAspectRatio=newItems.reduce(function(sum,item){return sum+item.aspectRatio},0),targetAspectRatio=rowWidthWithoutSpacing/this.targetRowHeight,previousRowWidthWithoutSpacing,previousAspectRatio,previousTargetAspectRatio;if(this.isBreakoutRow){if(this.items.length===0){if(itemData.aspectRatio>=1){this.items.push(itemData);this.completeLayout(rowWidthWithoutSpacing/itemData.aspectRatio);return true}}}if(newAspectRatio===0){return false}if(newAspectRatio<this.minAspectRatio){this.items.push(merge(itemData));return true}else if(newAspectRatio>this.maxAspectRatio){if(this.items.length===0){this.items.push(merge(itemData));this.completeLayout(rowWidthWithoutSpacing/newAspectRatio);return true}previousRowWidthWithoutSpacing=this.width-(this.items.length-1)*this.spacing;previousAspectRatio=this.items.reduce(function(sum,item){return sum+item.aspectRatio},0);previousTargetAspectRatio=previousRowWidthWithoutSpacing/this.targetRowHeight;if(Math.abs(newAspectRatio-targetAspectRatio)>Math.abs(previousAspectRatio-previousTargetAspectRatio)){this.completeLayout(previousRowWidthWithoutSpacing/previousAspectRatio);return false}else{this.items.push(merge(itemData));this.completeLayout(rowWidthWithoutSpacing/newAspectRatio);return true}}else{this.items.push(merge(itemData));this.completeLayout(rowWidthWithoutSpacing/newAspectRatio);return true}},isLayoutComplete:function isLayoutComplete(){return this.height>0},completeLayout:function completeLayout(newHeight,justify){var itemWidthSum=this.rightToLeft?-this.left:this.left,rowWidthWithoutSpacing=this.width-(this.items.length-1)*this.spacing,clampedToNativeRatio,roundedHeight,clampedHeight,errorWidthPerItem,roundedCumulativeErrors,singleItemGeometry,self=this;if(typeof justify==="undefined"){justify=true}roundedHeight=Math.round(newHeight);clampedHeight=Math.max(this.edgeCaseMinRowHeight,Math.min(roundedHeight,this.edgeCaseMaxRowHeight));if(roundedHeight!==clampedHeight){this.height=clampedHeight;clampedToNativeRatio=rowWidthWithoutSpacing/clampedHeight/(rowWidthWithoutSpacing/roundedHeight)}else{this.height=roundedHeight;clampedToNativeRatio=1}this.items.forEach(function(item,i){item.top=self.top;item.width=Math.round(item.aspectRatio*self.height*clampedToNativeRatio);item.height=self.height;if(self.rightToLeft){item.left=self.width-itemWidthSum-item.width}else{item.left=itemWidthSum}itemWidthSum+=item.width+self.spacing});if(justify){if(!this.rightToLeft){itemWidthSum-=this.spacing+this.left}errorWidthPerItem=(itemWidthSum-this.width)/this.items.length;roundedCumulativeErrors=this.items.map(function(item,i){return Math.round((i+1)*errorWidthPerItem)});if(this.items.length===1){singleItemGeometry=this.items[0];singleItemGeometry.width-=Math.round(errorWidthPerItem);if(this.rightToLeft){singleItemGeometry.left+=Math.round(errorWidthPerItem)}}else{this.items.forEach(function(item,i){if(i>0){item.left-=roundedCumulativeErrors[i-1];item.width-=roundedCumulativeErrors[i]-roundedCumulativeErrors[i-1]}else{item.width-=roundedCumulativeErrors[i]}})}}},forceComplete:function forceComplete(fitToWidth,rowHeight){var rowWidthWithoutSpacing=this.width-(this.items.length-1)*this.spacing,currentAspectRatio=this.items.reduce(function(sum,item){return sum+item.aspectRatio},0);if(typeof rowHeight==="number"){this.completeLayout(rowHeight,false)}else if(fitToWidth){this.completeLayout(rowWidthWithoutSpacing/currentAspectRatio)}else{this.completeLayout(this.targetRowHeight,false)}},getItems:function getItems(){return this.items}}},{merge:2}],2:[function(require,module,exports){(function(isNode){var Public=function(clone){return merge(clone===true,false,arguments)},publicName="merge";Public.recursive=function(clone){return merge(clone===true,true,arguments)};Public.clone=function(input){var output=input,type=typeOf(input),index,size;if(type==="array"){output=[];size=input.length;for(index=0;index<size;++index)output[index]=Public.clone(input[index])}else if(type==="object"){output={};for(index in input)output[index]=Public.clone(input[index])}return output};function merge_recursive(base,extend){if(typeOf(base)!=="object")return extend;for(var key in extend){if(typeOf(base[key])==="object"&&typeOf(extend[key])==="object"){base[key]=merge_recursive(base[key],extend[key])}else{base[key]=extend[key]}}return base}function merge(clone,recursive,argv){var result=argv[0],size=argv.length;if(clone||typeOf(result)!=="object")result={};for(var index=0;index<size;++index){var item=argv[index],type=typeOf(item);if(type!=="object")continue;for(var key in item){var sitem=clone?Public.clone(item[key]):item[key];if(recursive){result[key]=merge_recursive(result[key],sitem)}else{result[key]=sitem}}}return result}function typeOf(input){return{}.toString.call(input).slice(8,-1).toLowerCase()}if(isNode){module.exports=Public}else{window[publicName]=Public}})(typeof module==="object"&&module&&typeof module.exports==="object"&&module.exports)},{}],"justified-layout":[function(require,module,exports){"use strict";var merge=require("merge"),Row=require("./row"),layoutConfig={},layoutData={},currentRow=false;module.exports=function(input){var config=arguments.length<=1||arguments[1]===undefined?{}:arguments[1];var defaults={containerWidth:1060,containerPadding:10,boxSpacing:10,targetRowHeight:320,targetRowHeightTolerance:.25,maxNumRows:Number.POSITIVE_INFINITY,forceAspectRatio:false,showWidows:true,fullWidthBreakoutRowCadence:false};layoutConfig=merge(defaults,config);var containerPadding={};var boxSpacing={};containerPadding.top=!isNaN(parseFloat(layoutConfig.containerPadding.top))?layoutConfig.containerPadding.top:layoutConfig.containerPadding;containerPadding.right=!isNaN(parseFloat(layoutConfig.containerPadding.right))?layoutConfig.containerPadding.right:layoutConfig.containerPadding;containerPadding.bottom=!isNaN(parseFloat(layoutConfig.containerPadding.bottom))?layoutConfig.containerPadding.bottom:layoutConfig.containerPadding;containerPadding.left=!isNaN(parseFloat(layoutConfig.containerPadding.left))?layoutConfig.containerPadding.left:layoutConfig.containerPadding;boxSpacing.horizontal=!isNaN(parseFloat(layoutConfig.boxSpacing.horizontal))?layoutConfig.boxSpacing.horizontal:layoutConfig.boxSpacing;boxSpacing.vertical=!isNaN(parseFloat(layoutConfig.boxSpacing.vertical))?layoutConfig.boxSpacing.vertical:layoutConfig.boxSpacing;layoutConfig.containerPadding=containerPadding;layoutConfig.boxSpacing=boxSpacing;layoutData._layoutItems=[];layoutData._awakeItems=[];layoutData._inViewportItems=[];layoutData._leadingOrphans=[];layoutData._trailingOrphans=[];layoutData._containerHeight=layoutConfig.containerPadding.top;layoutData._rows=[];layoutData._orphans=[];return computeLayout(input.map(function(item){if(item.width&&item.width){return{aspectRatio:item.width/item.height}}else{return{aspectRatio:item}}}))};function computeLayout(itemLayoutData){var notAddedNotComplete,laidOutItems=[],itemAdded,currentRow,nextToLastRowHeight;if(layoutConfig.forceAspectRatio){itemLayoutData.forEach(function(itemData){itemData.forcedAspectRatio=true;itemData.aspectRatio=layoutConfig.forceAspectRatio})}itemLayoutData.some(function(itemData,i){notAddedNotComplete=false;if(!currentRow){currentRow=createNewRow()}itemAdded=currentRow.addItem(itemData);if(currentRow.isLayoutComplete()){laidOutItems=laidOutItems.concat(addRow(currentRow));if(layoutData._rows.length>=layoutConfig.maxNumRows){currentRow=null;return true}currentRow=createNewRow();if(!itemAdded){itemAdded=currentRow.addItem(itemData);if(currentRow.isLayoutComplete()){laidOutItems=laidOutItems.concat(addRow(currentRow));if(layoutData._rows.length>=layoutConfig.maxNumRows){currentRow=null;return true}currentRow=createNewRow()}else if(!itemAdded){notAddedNotComplete=true}}}else{if(!itemAdded){notAddedNotComplete=true}}});if(currentRow&¤tRow.getItems().length&&layoutConfig.showWidows){if(layoutData._rows.length){if(layoutData._rows[layoutData._rows.length-1].isBreakoutRow){nextToLastRowHeight=layoutData._rows[layoutData._rows.length-1].targetRowHeight}else{nextToLastRowHeight=layoutData._rows[layoutData._rows.length-1].height}currentRow.forceComplete(false,nextToLastRowHeight||layoutConfig.targetRowHeight)}else{currentRow.forceComplete(false)}laidOutItems=laidOutItems.concat(addRow(currentRow))}layoutData._containerHeight=layoutData._containerHeight-layoutConfig.boxSpacing.vertical;layoutData._containerHeight=layoutData._containerHeight+layoutConfig.containerPadding.bottom;return{containerHeight:layoutData._containerHeight,boxes:layoutData._layoutItems}}function createNewRow(){if(layoutConfig.fullWidthBreakoutRowCadence!==false){if((layoutData._rows.length+1)%layoutConfig.fullWidthBreakoutRowCadence===0){var isBreakoutRow=true}}return new Row({top:layoutData._containerHeight,left:layoutConfig.containerPadding.left,width:layoutConfig.containerWidth-layoutConfig.containerPadding.left-layoutConfig.containerPadding.right,spacing:layoutConfig.boxSpacing.horizontal,targetRowHeight:layoutConfig.targetRowHeight,targetRowHeightTolerance:layoutConfig.targetRowHeightTolerance,edgeCaseMinRowHeight:.5*layoutConfig.targetRowHeight,edgeCaseMaxRowHeight:2*layoutConfig.targetRowHeight,rightToLeft:false,isBreakoutRow:isBreakoutRow})}function addRow(row){layoutData._rows.push(row);layoutData._layoutItems=layoutData._layoutItems.concat(row.getItems());layoutData._containerHeight+=row.height+layoutConfig.boxSpacing.vertical;return row.items}},{"./row":1,merge:2}]},{},[]);
initialize: function (config) { RBrokerEngine.initialize.call(this, config); if (!config.credentials) { throw new Error('Broker failed to initialize, user credentials required.'); } var self = this, poolSize = this.parallelTaskLimit, pool = merge({ poolsize: poolSize }, config.pool || {}); /* * Prevents authenticated HTTP session from timing out due to inactivity to * ensure pool of RProject remain live and available to PooledTaskBroker. */ this.httpKeepAlive = { id: null, PING_INTERVAL: 60000, start: function(ruser) { this.stop(); this.id = setInterval(function() { deployr.io('/r/user/about').share(ruser.getCookies()).end(); }, this.PING_INTERVAL); }, stop: function() { clearInterval(this.id); } }; /* * Initialize the resourceTokenPool with RProject. */ function load(res) { var projects = res.get('projects'); if (projects.length > 0) { // inform caller of any `Grid Notification` errors usch as: // 'Concurrent authenticated project limit (10) reached for user XYZ.' // These 'errors' are more like warnings than runtime throwable errors. var warn = res.get('error'); if (warn) { self.emit('warning', warn); } projects.forEach(function(project) { self.resourceTokenPool.offer(project.project); }); self.parallelTaskLimit = self.resourceTokenPool.size(); self.httpKeepAlive.start(self.ruser); self.emit('ready'); } else { // No projects were created (projects.length == 0) self.emit('error', res.get('error')); } } // // Validate DeployR server `endpoint` and authenticate. // this.ruser = this.validateEndpoint().io('/r/user/login') .data(config.credentials) .ctx(this) .end(function() { // // Build the project pool. // if (config.releaseGridResources) { this.ruser.io('/r/user/release') .end() .io('/r/project/pool') .data(pool) .end(load); } else { this.ruser.io('/r/project/pool').data(pool).end(load); } }); },
module.exports = { parser: 'babel-eslint', env: { es6: true, }, parserOptions: { ecmaVersion: 7, sourceType: 'module', }, plugins: [ 'flowtype', 'shopify', ], settings: { flowtype: { onlyFilesWithFlowAnnotation: true, }, }, rules: merge( require('./rules/flowtype'), { 'shopify/require-flow': ['warn', 'explicit'], } ), };
treeForPublic: function() { var path = this.webfontPath(); var options = merge(true, { css:false }, this.options()); var fontTree = webfont(path, options); return fontTree; },
var transferStrategyMerge = createTransferStrategy(function(a, b) { // `merge` overrides the first object's (`props[key]` above) keys using the // second object's (`value`) keys. An object's style's existing `propA` would // get overridden. Flip the order here. return merge(b, a); });
function serve(options, app) { var startTimes = {}, failures = 0; options = merge({ logger: defaultLogger, cores: defaultCores, retryThreshold: 23, retryDelay: 10000, failureThreshold: 5000 }, options); var log = options.logger; function pid(worker) { return options.worker ? worker.pid : worker.process.pid; } function spawnMore() { var worker; if (options.worker) { worker = child.fork(options.worker, options.workerArgs); log.debug("Spawning worker %s as child process: %j %j", pid(worker), options.worker, options.workerArgs); } else { worker = cluster.fork(); log.debug("Spawning worker in cluster:", pid(worker)); } startTimes[pid(worker)] = Date.now(); if (!options.worker) { worker.on("listening", function (addr) { return log.info("Process", pid(worker), "is now listening on", addr.address + ":" + addr.port); }); } // Enable Erlang mode worker.on("exit", function (code, signal) { var lifetime = Date.now() - startTimes[pid(worker)]; var replacement; delete startTimes[pid(worker)]; if (worker.suicide) { log.info("Worker", pid(worker), "terminated voluntarily."); return; } log.info("Process", pid(worker), "terminated with signal", signal, "code", code + "; restarting."); if (lifetime < options.failureThreshold) { failures++; } else { failures = 0; } if (failures > options.retryThreshold) { log.warn(failures + " consecutive failures; pausing for", options.retryDelay + "ms before respawning."); } setTimeout(function () { replacement = spawnMore(); replacement.on("online", function () { return log.info("Process", replacement.process.pid, "has successfully replaced", pid(worker)); }); }, (failures > options.retryThreshold) ? options.retryDelay : 0); }); return worker; } if (cluster.isMaster) { // Spawn more overlords for (var i = 0; i < options.cores; i++) { spawnMore(); } log.info("Spawned", options.cores, options.worker ? "worker processes." : "server instances."); } else { log.handleExceptions(); options.worker || app(); } }
a.font.fontFamily !== b.font.fontFamily || a.font.fontSize !== b.font.fontSize || a.font.fontWeight !== b.font.fontWeight || a.font.fontStyle !== b.font.fontStyle ) { return true; } } return arrayDiffer(a.lines, b.lines); } // Native Attributes var SurfaceViewAttributes = merge(ReactNativeViewAttributes.UIView, { // This should contain pixel information such as width, height and // resolution to know what kind of buffer needs to be allocated. // Currently we rely on UIViews and style to figure that out. }); var NodeAttributes = { transform: { diff: arrayDiffer }, opacity: true, }; var GroupAttributes = merge(NodeAttributes, { clipping: { diff: arrayDiffer } }); var RenderableAttributes = merge(NodeAttributes, { fill: { diff: arrayDiffer }, stroke: { diff: arrayDiffer },
function YoutubeVideo(opts) { this._authenticated = false this.opts = merge({ saveTokens: true }, opts) }
YoutubeVideo.prototype.update = function (params, callback) { var options = merge({}, { part: 'status,snippet' }, this.opts.video, params) return this._command('update', options, callback) }
for (var bubblingTypeName in customBubblingEventTypes) { allTypesByEventName[bubblingTypeName] = customBubblingEventTypes[bubblingTypeName]; } for (var directTypeName in customDirectEventTypes) { warning( !customBubblingEventTypes[directTypeName], 'Event cannot be both direct and bubbling: %s', directTypeName ); allTypesByEventName[directTypeName] = customDirectEventTypes[directTypeName]; } var IOSNativeBridgeEventPlugin = { eventTypes: merge(customBubblingEventTypes, customDirectEventTypes), /** * @param {string} topLevelType Record from `EventConstants`. * @param {DOMEventTarget} topLevelTarget The listening component root node. * @param {string} topLevelTargetID ID of `topLevelTarget`. * @param {object} nativeEvent Native browser event. * @return {*} An accumulation of synthetic events. * @see {EventPluginHub.extractEvents} */ extractEvents: function( topLevelType: string, topLevelTarget: EventTarget, topLevelTargetID: string, nativeEvent: Event ): ?Object {
* style={styles.icon} * source={require('image!myIcon')} * /> * <Image * style={styles.logo} * source={{uri: 'http://facebook.github.io/react/img/logo_og.png'}} * /> * </View> * ); * }, * * More example code in ImageExample.js */ var ImageViewAttributes = merge(ReactNativeViewAttributes.UIView, { src: true, resizeMode: true, }); var Image = React.createClass({ propTypes: { /** * `uri` is a string representing the resource identifier for the image, which * could be an http address, a local file path, or the name of a static image * resource (which should be wrapped in the `require('image!name')` function). */ source: PropTypes.oneOfType([ PropTypes.shape({ uri: PropTypes.string, }), // Opaque type returned by require('./image.jpg') PropTypes.number,
var gutil = require('gulp-util'); var configDefault = { devPath: './dev', scssPath: './src/scss', cssPath: './static/css', lessPath: './src/less', jsPath: './src/js', jsMinPath: './static/js', fontPath: './static/fonts', componentsPath: './src/components', sync: false, syncTarget: 'http://localhost/' }, config = merge(configDefault, configLocal); // Run Bower gulp.task('bower', function() { bower() .pipe(gulp.dest(config.componentsPath)) .on('end', function() { // Add Glyphicons to fonts dir gulp.src(config.componentsPath + '/bootstrap-sass-official/assets/fonts/*/*') .pipe(gulp.dest(config.fontPath)); // Add Font Awesome fonts to fonts dir gulp.src(config.componentsPath + '/font-awesome/fonts/*') .pipe(gulp.dest(config.fontPath + '/font-awesome'));
alignItems: 'flex-end', height: NAV_BAR_HEIGHT, backgroundColor: 'transparent', }, }; // There are 3 stages: left, center, right. All previous navigation // items are in the left stage. The current navigation item is in the // center stage. All upcoming navigation items are in the right stage. // Another way to think of the stages is in terms of transitions. When // we move forward in the navigation stack, we perform a // right-to-center transition on the new navigation item and a // center-to-left transition on the current navigation item. var Stages = { Left: { Title: merge(BASE_STYLES.Title, { left: -SCREEN_WIDTH / 2, opacity: 0 }), LeftButton: merge(BASE_STYLES.LeftButton, { left: 0, opacity: 0 }), RightButton: merge(BASE_STYLES.RightButton, { opacity: 0 }), }, Center: { Title: merge(BASE_STYLES.Title, { left: 0, opacity: 1 }), LeftButton: merge(BASE_STYLES.LeftButton, { left: 0, opacity: 1 }), RightButton: merge(BASE_STYLES.RightButton, { opacity: 1 }), }, Right: { Title: merge(BASE_STYLES.Title, { left: SCREEN_WIDTH / 2, opacity: 0 }), LeftButton: merge(BASE_STYLES.LeftButton, { left: 0, opacity: 0 }), RightButton: merge(BASE_STYLES.RightButton, { opacity: 0 }), }, };
Seaport.prototype.createStream = function (addr) { var self = this; var p = new Protocol({ heartbeat: this.heartbeat, timeout: this.timeout, }); this.endpoints.push(p); p.on('end', onend); p.on('register', function onregister (id, meta) { if (!meta.host) meta.host = self._host; if (self.services[id]) { self.services[id] = meta; } else { self.known[id] = meta; } for (var i = 0; i < self.endpoints.length; i++) { var e = self.endpoints[i]; if (e === p) continue; e.send([ 'register', id, meta ]); } self.emit('register', meta, id); }); p.on('timeout', function () { onend(); stream.emit('timeout'); }); p.on('free', function (id) { var obj = self.known[id] ? self.known : self.services; var meta = obj[id]; if (!meta) return; delete obj[id]; self.emit('free', meta, id); }); p.on('synced', function () { stream.emit('synced'); self.emit('synced', stream); }); if (!addr && !self._host) { p.on('helo', function (addr) { self._host = addr; self.emit('address', addr); }); } this.emit('endpoint', p); var stream; if (this.secure) { stream = this.secure(function (s) { s.pipe(p.createStream()).pipe(s); }); stream.on('identify', function (id) { if (self._isAuthorized(id.key.public)) { id.accept(); self.emit('accept', id); } else { id.reject(); self.emit('reject', id); } }); } else { stream = p.createStream(); } stream.on('error', onend); p.once('close', function () { p.destroy(); var keys = objectKeys(p.known); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var meta = self.known[key]; if (!meta) continue; delete self.known[key]; self.emit('free', meta, key); } }); if (addr) p.send([ 'helo', addr ]); registerServices(merge(this.known, this.services), p); self.emit('stream', stream); self.emit('protocol', p); return stream; function onend () { if (p._ended) return; p._ended = true; p.destroy(); var ix = indexOf(self.endpoints, p); self.endpoints.splice(ix, 1); var keys = objectKeys(p.known); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var meta = self.known[key]; delete self.known[key]; self.emit('free', meta, key); } } };
'should be silent when not activated': function(test) { file = __dirname + '/fixures/guess-tabs.js'; validator = new Validator({ indentation: 'spaces' }); validator.validate(file); report = validator.getInvalidFiles(); expected = {}; expected[file] = { '2': [merge({}, Messages.INDENTATION_SPACES, {line: 2})], '3': [merge({}, Messages.INDENTATION_SPACES, {line: 3})], '5': [merge({}, Messages.INDENTATION_SPACES, {line: 5})], '6': [merge({}, Messages.INDENTATION_SPACES, {line: 6})], '7': [merge({}, Messages.INDENTATION_SPACES, {line: 7})], '9': [merge({}, Messages.INDENTATION_SPACES, {line: 9})], '10': [merge({}, Messages.INDENTATION_SPACES, {line: 10})], '11': [merge({}, Messages.INDENTATION_SPACES, {line: 11})], '13': [merge({}, Messages.INDENTATION_SPACES, {line: 13})], '14': [merge({}, Messages.INDENTATION_SPACES, {line: 14})], '15': [merge({}, Messages.INDENTATION_SPACES, {line: 15})], '16': [merge({}, Messages.INDENTATION_SPACES, {line: 16})], '17': [merge({}, Messages.INDENTATION_SPACES, {line: 17})], '18': [merge({}, Messages.INDENTATION_SPACES, {line: 18})], '19': [merge({}, Messages.INDENTATION_SPACES, {line: 19})], '20': [merge({}, Messages.INDENTATION_SPACES, {line: 20})], }; test.deepEqual(report, expected); test.done(); }
YoutubeVideo.prototype.thumbnails = function (id, media, callback) { var params = merge({ auth: this.oauth }, { videoId: id, media: media }) return youtube.thumbnails.set(params, callback) }
function gulpResponsive(config, options) { config = prepareConfig(config || []); options = merge({ strictMatchConfig: true, strictMatchImages: true, errorOnEnlargement: true }, options); return through2.obj(function (file, enc, done) { var that = this; if (file.isNull()) { this.push(file); return done(); } if (file.isStream()) { return done(new gutil.PluginError(PLUGIN_NAME, 'Streaming not supported')); } var matched = config.filter(function(conf) { return minimatch(file.relative, conf.name); }); if (options.strictMatchImages && matched.length === 0) { var message = 'Image does not match any config: ' + file.relative; return done(new gutil.PluginError(PLUGIN_NAME, message)); } async.each(matched, function(conf, cb) { // config item matched (can be matched multiple times) conf.mathed = true; sharpVinyl(file, conf, options, function(err, newFile) { if (err) { return cb(err); } that.push(newFile); cb(); }); }, done); }, function(cb) { if (options.strictMatchConfig) { var notMatched = config.filter(function(conf) { return !conf.mathed; }); if (notMatched.length > 0) { var message = 'Available images do not match following config:'; notMatched.forEach(function(conf) { message += '\n - `' + conf.name + '`'; }); return cb(new gutil.PluginError(PLUGIN_NAME, message)); } } cb(); } ); }
YoutubeVideo.prototype._command = function (action, params, callback) { if (!this._authenticated) return missingAuthentication(callback) var options = merge({ auth: this.oauth }, params) return youtube.videos[action](options, callback) }
let p12 = function(path, password) { if (log) { log.d('Reading certificate from %j', path); } password = password || undefined; var buffer = fs.readFileSync(path), asn1 = forge.asn1.fromDer(buffer.toString("binary"), false), p12 = forge.pkcs12.pkcs12FromAsn1(asn1, false, password); var ret = { id: path, title: undefined, key: undefined, cert: undefined, pfx: buffer, passphrase: password, topics: [], bundle: undefined, dev: undefined, prod: undefined }; p12.safeContents.forEach(safeContents => { safeContents.safeBags.forEach(safeBag => { if (safeBag.cert) { var title = safeBag.cert.subject.getField({type: '2.5.4.3'}); if (title) { ret.title = title.value; } if (safeBag.cert.getExtension({id: "1.2.840.113635.100.6.3.1"})) { ret.dev = true; } if (safeBag.cert.getExtension({id: "1.2.840.113635.100.6.3.2"})) { ret.prod = true; } var topics = safeBag.cert.getExtension({id: '1.2.840.113635.100.6.3.6'}); if (topics) { topics = topics.value.replace(/0[\x00-\x1f\(\)!]/gi, '') .replace('\f\f', '\f') .split('\f') .map(s => s.replace(/[\x00-\x1f\(\)!,$]/gi, '').trim()); topics.shift(); for (var i = 0; i < topics.length; i++) { for (var j = 0; j < topics.length; j++) { if (i !== j && topics[j].indexOf(topics[i]) === 0) { if (ret.topics.indexOf(topics[i]) === -1) { ret.topics.push(topics[i]); } if (ret.topics.indexOf(topics[j]) === -1) { ret.topics.push(topics[j]); } if (!ret.bundle) { ret.bundle = topics[i]; } } } } } } }); }); if (ret.title && !ret.bundle) { ret.bundle = ret.title.split(' ').pop(); } if (log) { var out = merge({}, ret); out.pfx = out.pfx instanceof Buffer ? 'Buffer' : out.pfx; log.d('Read certificate from %j: %j', path, out); } return ret; };
updatedFrames.forEach((newFrame) => { this._childFrames[newFrame.index] = merge(newFrame); });
orientation: orientation, }); return <RCTCamera {... nativeProps} /> }, switch: function() { this.state.type = this.state.type == 'Back' ? 'Front' : 'Back'; this.setState(this.state); }, takePicture: function(cb) { NativeModules.CameraManager.takePicture(cb); } }); var RCTCamera = createReactIOSNativeComponentClass({ validAttributes: merge(ReactIOSViewAttributes.UIView, { aspect: true, type: true, orientation: true }), uiViewClassName: 'RCTCamera', }); var styles = StyleSheet.create({ base: { }, }); module.exports = Camera;
merge: function (options) { if(options) { return merge(config, options); } else { return config; } }
mergeProps: function(oldProps, newProps) { return transferInto(merge(oldProps), newProps); },
var utilitiesStore = merge(EventEmitter.prototype, { emitChangeUtilities: function() { this.emit('change'); }, addChangeListenerUtilities: function(callback) { this.on('change', callback); }, removeChangeListenerUtilities: function(callback) { this.removeListener('change', callback); }, getPageTitle: function(callback) { return ciDataHostname; }, setPageTitle: function(newTitle) { ciDataHostname = newTitle; }, getStartDateUTC: function (callback) { return currentStartDateUTC; }, getStartDate: function (callback) { return currentStartDate; }, setStartDate: function (newDate) { currentStartDate = newDate; currentStartDateUTC = Date.UTC(moment(currentStartDate).format('YYYY'), moment(currentStartDate).month(), moment(currentStartDate).format('DD')); }, getEndDate: function (callback) { return currentEndDate; }, setEndDate: function (newDate) { currentEndDate = newDate; }, getDataPaths: function (callback) { return ciDataPaths; }, setDataPaths: function (newPaths) { ciDataPaths = newPaths; }, getCurrentPathID: function (callback) { return currentPathID; }, setCurrentPathID: function (newPathID) { currentPathID = newPathID; }, dispatcherIndex: Dispatcher.register(function(payload) { var action = payload.action; var change = false; switch(action.actionType) { case Constants.CHANGE_DATA_PATHS: utilitiesStore.setDataPaths(action.data); change = true; break; case Constants.CHANGE_PAGE_TITLE: utilitiesStore.setPageTitle(action.data); change = true; break; case Constants.CHANGE_PATH: utilitiesStore.setCurrentPathID(action.data); change = true; break; case Constants.CHANGE_START_DATE: utilitiesStore.setStartDate(action.data); change = true; break; case Constants.CHANGE_END_DATE: utilitiesStore.setEndDate(action.data); change = true; break; default: break; } if(change) { utilitiesStore.emitChangeUtilities(); } return true; }) });
let Image = ( props: ImagePropsType, forwardedRef: ?React.Ref<'RCTTextInlineImage' | 'ImageViewNativeComponent'>, ) => { let source = resolveAssetSource(props.source); const defaultSource = resolveAssetSource(props.defaultSource); const loadingIndicatorSource = resolveAssetSource( props.loadingIndicatorSource, ); if (source && source.uri === '') { console.warn('source.uri should not be an empty string'); } if (props.src) { console.warn( 'The <Image> component requires a `source` property rather than `src`.', ); } if (props.children) { throw new Error( 'The <Image> component cannot contain children. If you want to render content on top of the image, consider using the <ImageBackground> component or absolute positioning.', ); } if (props.defaultSource && props.loadingIndicatorSource) { throw new Error( 'The <Image> component cannot have defaultSource and loadingIndicatorSource at the same time. Please use either defaultSource or loadingIndicatorSource.', ); } if (source && !source.uri && !Array.isArray(source)) { source = null; } let style; let sources; if (source?.uri != null) { /* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found * when making Flow check .android.js files. */ const {width, height} = source; style = flattenStyle([{width, height}, styles.base, props.style]); /* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found * when making Flow check .android.js files. */ sources = [{uri: source.uri}]; } else { style = flattenStyle([styles.base, props.style]); sources = source; } const {onLoadStart, onLoad, onLoadEnd, onError} = props; const nativeProps = merge(props, { style, shouldNotifyLoadEvents: !!(onLoadStart || onLoad || onLoadEnd || onError), src: sources, /* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found * when making Flow check .android.js files. */ headers: source?.headers, defaultSrc: defaultSource ? defaultSource.uri : null, loadingIndicatorSrc: loadingIndicatorSource ? loadingIndicatorSource.uri : null, ref: forwardedRef, }); return ( <TextAncestor.Consumer> {hasTextAncestor => hasTextAncestor ? ( <TextInlineImageNativeComponent {...nativeProps} /> ) : ( <ImageViewNativeComponent {...nativeProps} /> ) } </TextAncestor.Consumer> ); };
selected={this.props.selected} badgeValue={this.props.badgeValue} title={this.props.title} style={[styles.tab, this.props.style]}> {tabContents} </RCTTabBarItem> ); } }); var styles = StyleSheet.create({ tab: { position: 'absolute', width: Dimensions.get('window').width, height: Dimensions.get('window').height, } }); var RCTTabBarItem = createReactIOSNativeComponentClass({ validAttributes: merge(ReactIOSViewAttributes.UIView, { title: true, icon: true, selectedIcon: true, selected: true, badgeValue: true, }), uiViewClassName: 'RCTTabBarItem', }); module.exports = TabBarItemIOS;
getInitialState: function() { return merge( this.touchableGetInitialState(), this.computeSyntheticState(this.props) ); },
function Sensors(config) { var files = [], that = this; this.config = merge(DEFAULT_CONFIG, config); if (this._isMock()) { var timestamp = Date.now(); // Mock console.log('Mocking sensors'); this.sensors = [{ name: "sensor1", path: "/tmp/sensor1", value: 12.3, timestamp: timestamp, tsd: [{timestamp: timestamp, value: 12.3}] }, { name: "sensor2", path: "/tmp/sensor2", value: 14.3, timestamp: timestamp, tsd: [{timestamp: timestamp, value: 14.3}] }, { name: "sensor3", path: "/tmp/sensor3", value: 17.3, timestamp: timestamp, tsd: [{timestamp: timestamp, value: 17.3}] }]; } else { // Real this.sensors = []; files = fs.readdirSync(W1PATH); files.forEach(function (f) { if (f.indexOf('w1_bus_master') == 0) { return; } var w1_sensor = W1PATH + f + "/w1_slave"; var sensor = { name: f, path: w1_sensor, value: null }; that._readSensorAtPath(w1_sensor, function(value) { sensor.value = value; sensor.timestamp = Date.now(); sensor.tsd = [{timestamp: sensor.timestamp, value: sensor.value}]; }); console.log("Found sensor at: " + w1_sensor); that.sensors.push(sensor); }); } setInterval(function() { that.sensors.forEach(function (f) { that._readSensor(f, function (value){ if (!that._isMock() && (value == 0 || Math.abs(f.value - value) > 5)) { console.log('Bogus value: ' + value); return; } f.value = value; f.timestamp = Date.now(); if (f.tsd.push({timestamp: f.timestamp, value: f.value}) > 300) { f.tsd.shift(); } if (that.config.onSensorUpdate) { that.config.onSensorUpdate(f); } }) }); }, 2000, this); }
grunt.registerMultiTask('optimus','Build a configuration for the R.JS optimizer from JS folder structure',function(){ var options = this.options(); var global = _globalmod=options.global; var inDir = options.inDir; // eg: 'src/js/' var outDir = options.outDir; // eg: 'static/js/' _outdir=outDir; var ssi = options.ssi; _ssifile= ssi; _nojquery = options.nojquery === true; _norequirejs = options.norequirejs === true; var relativeDir = options.relativeDir; var absoluteDir = options.inDir.split('/'); var subprefix = options.subprefix; // eg: '_' var configfile = options.configfile; // eg: 'requirepaths.out' var excludeforsub = typeof(options.excludeforsub)!=='undefined'?options.excludeforsub:[]; var excludeforglobal = typeof(options.excludeforglobal)!=='undefined'?options.excludeforglobal:[]; var exclude = options.exclude; var optimize = options.optimize; //uglify or none var files; var rj = grunt.config.get('requirejs'); var watch = grunt.config.get('watch'); var jshint = grunt.config.get('jshint'); var filesglob=[''+inDir+"**/*.js"]; if(!exclude){ files=grunt.file.expand(''+inDir+"**/*.js"); }else{ if(!Array.isArray(exclude)){ exclude=[exclude]; } for(var i=0;i<exclude.length;i++){ filesglob.push('!'+inDir+exclude[i]); } files=grunt.file.expand(filesglob); } if(typeof(options.jshinttask) !== 'undefined'){ if(typeof(jshint) === 'undefined' ){ jshint = {}; } _jshinttask = options.jshinttask; if(typeof(jshint[_jshinttask]) === 'undefined'){ grunt.config.set(['jshint',_jshinttask],filesglob); jshint=grunt.config.get('jshint'); grunt.log.writeln("Added jshint task (jshint:"+_jshinttask+")\n"+prettyjson.render(jshint)); } } if(typeof(options.watchtask) !== 'undefined'){ if(typeof(watch) === 'undefined'){ watch={}; } if(typeof(watch[options.watchtask]) === 'undefined'){ _watchtask = options.watchtask; _watchtarget = this.target; var watchlist = typeof(options.watchlist) !== 'undefined'?options.watchlist.split(','):[]; watchlist.unshift('optimus:'+_watchtarget); watch[_watchtask] = { files:filesglob, tasks: watchlist, options:{ spawn:false } } grunt.log.writeln("Added watch task:\n"+prettyjson.render(watch[_watchtask])); grunt.config.set('watch',watch); if(!_watchhooked){ grunt.event.on('watch',onWatchEvent); _watchhooked=true; } } } if(typeof(options.jquery) !== 'undefined'){ _jqueryfile=options.jquery; } if(absoluteDir[absoluteDir.length-1]===""){ absoluteDir.pop(); } absoluteDir=absoluteDir.join('/'); _outfile = options.loader; if(!rj){ rj={options:{}}; grunt.config.set('requirejs',rj); }else{ options.paths=options.paths!==undefined?merge(options.paths,rj.options.paths):rj.options.paths; } var paths = options.paths!==undefined ? options.paths:{}; var storage=grunt.config('require-storage'); if(!storage){ grunt.config('require-storage',{ paths:paths, dependencies:_dependencies }); } paths=grunt.config('require-storage.paths'); _dependencies=grunt.config('require-storage.dependencies'); if(!_dependencies){ grunt.log.writeln("dependencies are empty".red); _dependencies={}; } var watchcall = options.watchcall; var watchtarget = options.watchtarget; var target = this.target; // A file was added, we need to rebuild the paths if(watchcall==="added"){ paths={}; options.paths={}; _dependencies={}; } grunt.log.writeln("OPTIMUS : Preparing Javascript Configuration"+(watchcall?" WC["+watchcall+"]/"+watchtarget:".")); grunt.log.writeln("-----------------------------"); // If a file was added, or this is the only call, build paths from scratch if(watchcall!=="changed"){ //console.log("Starting paths:\n %j",paths); // Add optimus-post config entries var cfg = grunt.config.get('optimus'); var postcfg = {}; for(var itm in cfg){ postcfg[itm]={}; } grunt.config.set('optimus-post',postcfg); // end config entry generation grunt.log.writeln("\n\nFILES:".blue,files); grunt.log.writeln("\n\nGenerating module paths and dependencies".green.underline); grunt.util.async.forEach(files,function(file,next){ // Get the dependencies var fcont = grunt.file.read(file); var pat = /define\s*\(\s*\[([\s\S]*?)\]/m; var deps = fcont.match(pat); //if(deps!==null){ // grunt.log.writeln("--list:\n"+prettyjson.render(deps)); //} if(deps && deps.length>1){ deps=deps[1]; //grunt.log.writeln("dependencies:".yellow+deps); deps=deps.split("\n").join('').split("\t").join('').split('"').join('').split("'").join('').split(" ").join('').split(','); grunt.log.writeln(file,deps); }else{ deps=[]; } // store depencency if(deps.length>0){ grunt.util.async.forEach(deps,function(dep,next){ if(!_dependencies[dep])_dependencies[dep]=[]; if(_dependencies[dep].indexOf(file)<0){ _dependencies[dep].push(file); //grunt.log.writeln("added depency ".green+dep+" for ".green+file); } }); } // Insert a path entry var fileid=getModuleIDFromPath(file,relativeDir,absoluteDir,subprefix); grunt.log.writeln('>>'.blue+"path[".green+fileid[0]+"] = '".green+fileid[1]+"'".green); paths[fileid[0]]=fileid[1]; options.paths=paths; }); }else{ // If resulting from a changed file, find where it is referenced. files=[watchtarget,(options.relativeDir!=''?options.relativeDir+"/":'')+options.global+".js"]; var targetid=getModuleIDFromPath(watchtarget,relativeDir,absoluteDir,subprefix)[0]; grunt.log.writeln("Target ID:"+targetid); var targetdeps=_dependencies[targetid]; grunt.log.writeln("Dependencies:",targetdeps); if(targetdeps && targetdeps.length>0){ files=addDependencies(files,targetdeps,relativeDir,subprefix); } } if(!options.development){ var rjo=rj.options?rj.options:{}; if(options.shim){ // merge in the shim data from local config. rjo.shim = merge(rjo.shim,options.shim); options.shim=undefined; // clear once merged in } grunt.config.set('requirejs',{options:rjo}); rj = grunt.config.get('requirejs'); grunt.log.writeln("\n\nGenerating first level modules list".green.underline); grunt.util.async.forEach(files,function(file,next){ var fnp = file.split('/'); var fn=fnp[fnp.length-1]; if(fn.substr(0,subprefix.length) !== subprefix){ var fileid=getModuleIDFromPath(file,relativeDir,absoluteDir,subprefix); grunt.log.write(' >>'.yellow+(fileid[0]).green); var o={ options:{ baseUrl:'./'+relativeDir, paths:paths, name: fileid[0], out: outDir+fileid[1]+".js", optimize: options.optimize //uglify or none } }; if(fileid[0]!==global){ o.options.exclude=excludeforsub; }else{ o.options.exclude=excludeforglobal; grunt.log.writeln((fileid[0]+" is the root/global module").grey); } rj[fileid[0]]=o; } }); grunt.config.set('requirejs',rj); } if(configfile && watchcall!=="changed"){ var co=options.config?options.config:{}; co.paths=paths; _configdata=co; _configfile=configfile; } grunt.config(['require-storage','paths'],paths); grunt.config(['require-storage','dependencies'],_dependencies); grunt.log.writeln("\nOPTIMUS: Prepare complete".green); grunt.log.writeln("------------------------"); grunt.log.writeln("RJ:"+prettyjson.render(rj)); if(!options.development){ grunt.task.run("requirejs","filerev","optimus-post:"+this.target); }else{ _globalmod = ""; grunt.util.async.forEach(files,function(file,next){ var outfile=file.split('/'); var rel=relativeDir.split('/'); var outfile=outDir+file.split('/').slice(rel.length).join("/"); grunt.log.writeln("copying for development:".yellow+outfile); mkpath.sync(path.dirname(outfile)); fs.createReadStream(file).pipe(fs.createWriteStream(outfile)); }); if(typeof(_jshinttask) !== 'undefined'){ grunt.task.run("jshint:"+_jshinttask,"optimus-post:"+this.target); }else{ grunt.task.run("optimus-post:"+this.target); } } });
function CookieProcess(options) { BaseProcess.apply(this, arguments); merge(this._options, defaults, options); this._cookies = {}; }