Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
var type = component.getMetadataType();
if (!type) {
throw new Error('Could not determine type for filename ' + componentFileName);
}
// 1. container files
if (metadataFile instanceof MetadataFileContainer) {
// get all components with same fileName
var relatedComponents = _.where(manifest.manifestJSON, {
fileName: componentFileName
});
var containerComponent = _.where(relatedComponents, {
type: type.xmlName,
fullName: component.fullName
});
var vinylContainer = _.findWhere(self.vinyls, {
path: componentFileName
});
if (containerComponent && containerComponent.length) {
// container itself is being referenced in manifest
filteredMetadataContainer.add(vinylContainer, []);
} else {
// construct a new File containing only related components
var containerFile = new MetadataFileContainer({
path: componentFileName
});
relatedComponents.forEach(function(cmp) {
var c = _.findWhere(vinylContainer.components, {
type: cmp.type,
fullName: cmp.fullName
});
if (!c) {
mapStates = _.map(states(), (state) => {
let fee;
const feeState = _.findWhere(fees(), {
destination: state.acronym
});
const feeOthers = _.findWhere(fees(), {
destination: 'others'
});
if (feeState) {
fee = feeState.value;
} else if (feeOthers) {
fee = feeOthers.value;
}
return {
name: state.name,
value: state.acronym,
fee
};
});
if (reward.shipping_options === 'national') {
handleClubEdit: function(url) {
var club = _.findWhere(this.props.teachAPI.getClubs(), {
url: url
});
this.props.showModal(ModalAddOrChangeYourClub, {
club: club,
onSuccess: this.handleZoomToClub,
hideModal: this.props.hideModal
});
},
render: function() {
_.map(options.commentList, function (aComment) {
if (aComment._discussionId) {
aComment.discussion = modelParser.parseDiscussion(aComment._discussionId);
var category = _.findWhere(categories, { slug: aComment.discussion.category });
if (!category) {
category = modelParser.parseCategoryUnknown(aComment.discussion.category);
}
aComment.category = modelParser.parseCategory(category);
if (aComment.discussion.issue) {
aComment.script = {
scriptPageUrl: aComment.category.categoryPageUrl.replace('/issues', ''),
name: category.name
};
category.name = 'Issues';
} else {
aComment.script = {
scriptPageUrl: '/forum',
name: 'Forum'
};
_calculateBars: function () {
var data = this._dataviewModel.getData();
var min = this.model.get('min');
var max = this.model.get('max');
var loBarIndex = this.model.get('lo_index');
var hiBarIndex = this.model.get('hi_index');
var startMin;
var startMax;
if (data.length > 0) {
if (!_.isNumber(min) && !_.isNumber(loBarIndex)) {
loBarIndex = 0;
} else if (_.isNumber(min) && !_.isNumber(loBarIndex)) {
startMin = _.findWhere(data, {start: min});
loBarIndex = startMin && startMin.bin || 0;
}
if (!_.isNumber(max) && !_.isNumber(hiBarIndex)) {
hiBarIndex = data.length;
} else if (_.isNumber(max) && !_.isNumber(hiBarIndex)) {
startMax = _.findWhere(data, {end: max});
hiBarIndex = startMax && startMax.bin + 1 || data.length;
}
} else {
loBarIndex = 0;
hiBarIndex = data.length;
}
return {
loBarIndex: loBarIndex,
view: function(ctrl, args) {
const subsCollection = ctrl.subscriptions.collection(),
filterBuilder = ctrl.filterBuilder,
statusFilter = _.findWhere(filterBuilder, {
label: 'status_filter'
}),
textFilter = _.findWhere(filterBuilder, {
label: 'text_filter'
}),
rewardFilter = _.findWhere(filterBuilder, {
label: 'reward_filter'
}),
paymentFilter = _.findWhere(filterBuilder, {
label: 'payment_filter'
});
rewardFilter.data.options = ctrl.mapRewardsToOptions();
if (!ctrl.lProject()) {
return m('div', [
m.component(projectDashboardMenu, {
project: m.prop(_.first(ctrl.project()))
}),
m('.dashboard-header',
m('.w-container',
const mapStateToProps = (
state: IReactVaporState,
ownProps: INavigationPerPageOwnProps
): INavigationPerPageStateProps => {
const perPageNumber: number[] = ownProps.perPageNumbers || PER_PAGE_NUMBERS;
const defaultInitialPosition: number = Math.ceil(perPageNumber.length / 2) - 1;
const item: IPerPageState = _.findWhere(state.perPageComposite, {id: ownProps.id});
const pagination: IPaginationState = _.findWhere(state.paginationComposite, {id: `pagination-${ownProps.id}`});
const initialPosition: number = !_.isUndefined(ownProps.initialPosition)
? ownProps.initialPosition
: defaultInitialPosition;
return {
currentPerPage: item ? item.perPage : perPageNumber[initialPosition],
currentPage: pagination ? pagination.pageNb : 0,
};
};
function columnByName(model, columnName) {
return _.findWhere(model.columns, {name: columnName});
}
function associateModel(data, modelCb) {
if (data.associations !== undefined) {
var assocLength = Object.keys(data.associations).length
, called = 0
, model = _.findWhere(assocMap[modelName], { id: data.id });
Object.keys(data.associations).forEach(function(assocModelName) {
var required = data.associations[assocModelName]
, associations = [];
if (!(required instanceof Array)) {
required = [required];
}
required.forEach(function(requiredModels) {
if (!(requiredModels instanceof Array)) {
requiredModels = [requiredModels];
}
requiredModels.forEach(function(requiredModel) {
var associatedModel;
case 'UPDATE_POINTS_OF_INTEREST':
state.pointsOfInterest = action.pointsOfInterest
break
case 'UPDATE_POSTS':
state.posts = action.posts
break
case 'UPDATE_POST':
if ( ! findWhere( state.posts, {id: action.post.id} ) ) {
state.posts.push( action.post );
}
break;
case 'UPDATE_PAGES':
state.pages = action.pages
break
case 'UPDATE_PAGE':
if ( ! findWhere( state.pages, {id: action.page.id} ) ) {
state.pages.push( action.page );
}
break;
}
return state
}