Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
tiles: tiles
});
assert.equal(job.size, size, 'size');
job.cleanupForQue();
assert.deepEqual(job._encodedTiles, expected, 'encoded');
let encjob = newJob({
zoom: zoom,
_encodedTiles: job._encodedTiles
});
assert.equal(encjob.size, size, 'size2');
let expectedDecoded = _.reject(tiles, v => Array.isArray(v) && v[0] === v[1]);
// Remove empty ranges
expectedDecoded = _.map(expectedDecoded, v => Array.isArray(v) && v[0] === v[1] + 1 ? v[0] : v);
assert.deepEqual(encjob.tiles, expectedDecoded, 'roundtrip');
} catch(err) {
err.message = msg + ': ' + err.message;
throw err;
}
};
var FixPassageRefs = itemData => {
if (itemData._multi) {
// We're in a multi-item. Don't do anything, just return the original
// item data.
return itemData;
}
var newQuestion = fixRendererPassageRefs(itemData.question);
var newHints = _.map(itemData.hints, hint => fixRendererPassageRefs(hint));
return _.extend({}, itemData, {
question: newQuestion,
hints: newHints,
});
};
}),
'_id')
// the SuperTimeline has an issue with resolving pieces that start at the 0 absolute time point
// we therefore need a constant offset that we can offset everything to make sure it's not at 0 point.
const TIMELINE_TEMP_OFFSET = 1
// create a lookup map to match original pieces to their resolved counterparts
let piecesLookup: IPieceExtendedDictionary = {}
// a buffer to store durations for the displayDuration groups
const displayDurationGroups: _.Dictionary = {}
let startsAt = 0
let previousPart: PartExtended
// fetch all the pieces for the parts
partsE = _.map(parts, (part, itIndex) => {
let partTimeline: SuperTimeline.TimelineObject[] = []
// extend objects to match the Extended interface
let partE: PartExtended = extendMandadory(part, {
pieces: _.map(Pieces.find({ partId: part._id }).fetch(), (piece) => {
return extendMandadory(piece, {
renderedDuration: 0,
renderedInPoint: 0
})
}),
renderedDuration: 0,
startsAt: 0,
willProbablyAutoNext: (
(previousPart || {}).autoNext || false
) && (
(previousPart || {}).expectedDuration !== 0
Environment.prototype.usersInfo = function() {
// Get infornmation on every use in the environment
return _.map(this.users, function(user) {
return user.info();
});
};
// Now we sort the sentences by weight
structure.ordered = structure.sentences.sort(function(a, b) {
return b.data.weights.total-a.data.weights.total;
});
// We only keep the top N (=quota)
structure.keep = structure.ordered.slice(0, quota);
// And now we reorder by index
structure.indexed = structure.keep.sort(function(a, b) {
return a.index-b.index;
});
// Finally, we join the sentences
structure.summary = _.map(structure.indexed, function(sentence) {
return sentence.text;
});
return {
data: structure,
text: structure.summary.join('\n')
}
}
exports.markupRows = function (datasets) {
return _.map(datasets, function (dataset) {
return exports.markup(dataset);
});
};
_setupCollection: function () {
var ramps = [];
if (this._customRampList) {
ramps = _.map(this._customRampList.models, function (ramp) {
return { name: ramp.get('name'), val: ramp.get('val') };
}, this);
} else {
ramps = _.map(rampList, function (ramp, name) {
return { name: name, val: ramp[this._bins] };
}, this);
}
this._collection = new CustomListCollection(ramps);
},
render() {
const { collection } = this.props;
const { title } = collection;
const games = map(collection.collectionGames, cg => cg.game);
const gameItems = map(games, (game, index) => {
const { coverUrl, stillCoverUrl } = game;
return (
);
});
const cols: JSX.Element[] = [];
each(gameItems, (item, i) => {
root.deep_clone = function(node) {
if (node instanceof Date) {
return node;
} else if (node instanceof RegExp) {
return node;
} else if (Array.isArray(node)) {
return _.map(node, root.deep_clone);
} else if (node instanceof Object) {
return _.object(_.map(_.pairs(node), function(x) {
return [x[0], root.deep_clone(x[1])];
}));
} else {
return node;
}
};
const groups = _.map(options.data, function(group) {
group.items = _.map(group.items, function(item) {
item.editable = !options.readonly;
return item;
});
if (options.readonly) {
group.items = _.map(group.items, function(item) {
item.editable = !options.readonly;
item.noAccess = item.access_level === accessLevels.NONE;
return item;
});
}
const itemsCollection = new BaseCollection(group.items, {
model: PermissionModel
});
this.listenTo(itemsCollection, 'change', _.bind(this.onAccessLevelChange, this, group.group));
return _.extend({}, group, {
editable: !options.readonly,