Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
findCard = (id) => {
const { data: { boardFeatures: issues } } = this.props;
const issue = find(issues, { issueId: id });
const index = findIndex(issues, { issueId: id });
// console.log(id, issue, index);
return {
issue,
index,
};
}
// * ensure we have access to captions data
if (!decodedData.includes('captionTracks'))
throw new Error(`Could not find captions for video: ${videoID}`);
const regex = /({"captionTracks":.*isTranslatable":(true|false)}])/;
const [match] = regex.exec(decodedData);
const { captionTracks } = JSON.parse(`${match}}`);
const subtitle =
find(captionTracks, {
vssId: `.${lang}`,
}) ||
find(captionTracks, {
vssId: `a.${lang}`,
}) ||
find(captionTracks, ({ vssId }) => vssId && vssId.match(`.${lang}`));
// * ensure we have found the correct subtitle lang
if (!subtitle || (subtitle && !subtitle.baseUrl))
throw new Error(`Could not find ${lang} captions for ${videoID}`);
const { data: transcript } = await axios.get(subtitle.baseUrl);
const lines = transcript
.replace('', '')
.replace('', '')
.split('')
.filter(line => line && line.trim())
.map(line => {
const startRegex = /start="([\d.]+)"/;
const durRegex = /dur="([\d.]+)"/;
const [, start] = startRegex.exec(line);
}
// find matched and (possibly) overlapping ranges
var nested = _.filter(ranges, function(item) {
return item.inside(selRange.end);
});
if (nested.length) {
return nested.sort(function(a, b) {
return a.length() - b.length();
})[0];
}
// return range next to caret
var test =
r = _.find(ranges, isBackward
? function(item) {return item.end < selRange.start;}
: function(item) {return item.end > selRange.start;}
);
if (!r) {
// can’t find anything, just pick first one
r = ranges[0];
}
return r;
}
hasUniqueNameAndSymbol(tokens: Token[], token: Token): boolean {
if (token.isRegistered) {
return true; // Since it's registered, it is the canonical token
}
const registeredTokens = _.filter(tokens, t => t.isRegistered);
const tokenWithSameNameIfExists = _.find(registeredTokens, {
name: token.name,
});
const isUniqueName = tokenWithSameNameIfExists === undefined;
const tokenWithSameSymbolIfExists = _.find(registeredTokens, {
name: token.symbol,
});
const isUniqueSymbol = tokenWithSameSymbolIfExists === undefined;
return isUniqueName && isUniqueSymbol;
},
zeroExErrToHumanReadableErrMsg(error: ContractWrappersError | ExchangeContractErrs, takerAddress: string): string {
const mapStateToProps = (state) => {
const {
isLoading,
snapshotIndex,
networkSummaries,
selectedNetwork,
selectedNetworkSummaryId,
selectedDrawing
} = state.neuralNetwork;
const selectedSnapshot = selectedNetwork.snapshots
&& selectedNetwork.snapshots[String(snapshotIndex)];
const selectedNetworkSummary = _.find(networkSummaries, {
path: selectedNetworkSummaryId
});
let testResultsSummary = null;
if (selectedSnapshot) {
const { testResults } = selectedSnapshot;
testResultsSummary = Object.keys(testResults).reduce((prev, curr) => {
const wrongCount = _.values(testResults[curr].wrong)
.reduce((prev1, curr2) => prev1 + curr2.length, 0);
return Object.assign({}, prev, {
[curr]: {
wrongCount,
correctCount: testResults[curr].correct.length
}
});
}, {});
}, (settings) => {
const oldWatchPage = _.find(settings.options, {key: 'oldWatchPage'}).on;
const link = !oldWatchPage ? 'https://t.bilibili.com/' : 'https://www.bilibili.com/account/dynamic';
const menuOptions = {};
_.each(settings.subPage.options, (option) => {
menuOptions[option.key] = option.on;
});
this.setState({
newWatchPageLink: link,
menuOptions: menuOptions,
options: settings.options,
});
});
setAdhocFilter(options: any) {
let variable: any = _.find(this.variables, {
type: 'adhoc',
datasource: options.datasource,
} as any);
if (!variable) {
variable = this.createVariableFromModel({
name: 'Filters',
type: 'adhoc',
datasource: options.datasource,
});
this.addVariable(variable);
}
const filters = variable.filters;
let filter: any = _.find(filters, { key: options.key, value: options.value });
if (!filter) {
_edit = (profile) => {
const { profiles, profileId } = this.props
let p
if (!profile) p = _.find(profiles, p => p.id === profileId)
else p = profile
if (!p) return
this.setState({
...this.state,
editId: p.id,
edit_inputs: {
name: p.name
}
})
}
{_.map(selectedIndices, selectedIndex => {
const selectedUngroupedOptionData = _.find(
ungroupedOptionData,
{ optionIndex: selectedIndex }
);
if (selectedUngroupedOptionData) {
const { optionProps } = selectedUngroupedOptionData;
const selectionProps = _.get(
getFirst(
optionProps,
SearchableMultiSelect.Option.Selection
),
'props'
);
return (
const filteredContacts = contacts.data.filter((contact) => {
return (
contact.phoneNumbers && find(contact.phoneNumbers, (p) => isValidPhoneNumber(p) !== undefined)
)
})