Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (!normalized || R.isEmpty(normalized)) { return Promise.resolve(null); }
const activitystreams = this.createActivityStream(normalized);
activitystreams.actor = {
id: R.path(['author', 'id'], normalized),
name: R.path(['author', 'name'], normalized),
type: 'Person',
};
// Note: we ignore the target data if the message is send to the public page
if (R.path(['target', '_isMe'], normalized)) {
activitystreams.target = activitystreams.actor;
} else {
activitystreams.target = {
id: R.path(['target', 'name'], normalized),
name: R.path(['target', 'name'], normalized),
type: R.path(['target', '_isMe'], normalized) ? 'Application' : 'Person',
};
}
const content = normalized.text;
const id = normalized.token.toString() || this.createIdentifier();
return Promise.resolve(activitystreams)
.then((as2) => {
if (normalized.url && (normalized.type === 'Image' || normalized.type === 'Video')) {
return fileInfo(normalized.url.split('?')[0], this.logger)
.then((infos) => {
as2.object = {
id,
mediaType: infos.mimetype,
type: normalized.type,
if (!normalized || R.isEmpty(normalized)) { return Promise.resolve(null); }
const activitystreams = this.createActivityStream(normalized);
activitystreams.actor = {
id: R.path(['user', 'id'], normalized),
name: R.path(['user', 'name'], normalized),
type: 'Person',
};
activitystreams.target = {
id: R.path(['address', 'bot', 'name'], normalized),
name: R.path(['address', 'bot', 'name'], normalized),
type: 'Person',
};
const addressID = R.path(['address', 'id'], normalized);
const addressChannelID = R.path(['address', 'channelId'], normalized);
const addressConversationID = R.path(['address', 'conversation', 'id'], normalized);
const addressBotID = R.path(['address', 'conversation', 'id'], normalized);
const context: IASContext = {
content: `${addressID}#${addressConversationID}#${addressChannelID}#${addressBotID}`,
name: 'address_id',
type: 'Object',
};
// Process potentially media.
const attachmentImages = R.filter(
(attachment: any) => attachment.contentType.startsWith('image'),
normalized.attachments);
const attachmentVideos = R.filter(
(attachment: any) => attachment.contentType.startsWith('video')
|| attachment.contentType === 'application/octet-stream',
getTrProps={(_: any, rowInfo: RowInfo) => {
// We don't want to see a hover on a row without data.
// If a row is selected we want to see the selected color.
const isSelected =
!!selectedUser &&
path(["original", "uuid"], rowInfo) === selectedUser.uuid;
const hasData = path(["original", "uuid"], rowInfo) !== undefined;
let className;
if (hasData) {
className = isSelected ? "selected hoverable" : "hoverable";
}
return {
className
};
}}
/>
);
const propB5: boolean = mDRight.a;
const propB6: boolean = mDRight.b;
const propB7: 15 = mDRight.values[0];
const objA = _.objOf("a", false);
//$ExpectError
const propAA: number = objA.a;
const om: Object = _.omit(["a", "d", "h"], { a: 1, b: 2, c: 3, d: 4 });
const omap1 = _.omit(["a", "d", "h"], { a: 1, b: 2, c: 3, d: 4, h: 7 });
const omap2 = _.omit(["a", "d", "h"])({ a: 1, b: 2, c: 3, d: 4 });
const path1: Object | number = _.path(["a", "b"], { a: { b: 2 } });
const path2: Object | number = _.path(["a", 1], { a: { "1": 2 } });
const path3: ?Object = _.path(["a", "b"], { c: { b: 2 } });
const path4: void = _.path(["a"], null);
const pathOr: string | Object | number = _.pathOr("N/A", ["a", "b", 0], {
a: { b: [2] }
});
describe('pick', () => {
it('should works', () => {
const pck = _.pick(["a", "d"], { a: 1, b: 2, c: 3, d: '4' });
const a: number = pck.a;
const d: string = pck.d;
//$ExpectError
const e = pck.e;
});
it('should fail with not existing props', () => {
ActionBody: attachment.url,
ActionType: actionType,
BgColor: '#2db9b9',
Text: attachment.name || attachment.content,
};
}, attachmentsButtons),
DefaultHeight: true,
Type: 'keyboard',
};
}
if (dataType === 'Note') {
return [new viber_bot_1.Message.Text(content, keyboard), message];
}
else if (dataType === 'Image' || dataType === 'Video') {
const url = R.path(['object', 'url'], message);
const preview = R.path(['object', 'preview'], message);
if (dataType === 'Image') {
return [new viber_bot_1.Message.Picture(url, content, preview, keyboard), message];
}
else {
return [new viber_bot_1.Message.Video(url, null, preview, null, keyboard), message];
}
}
else if (dataType === 'Place') {
const latitude = R.path(['object', 'latitude'], message);
const longitude = R.path(['object', 'longitude'], message);
return [new viber_bot_1.Message.Location(latitude, longitude, keyboard), message];
}
return [null, message];
})
.spread((messageBuilder, message) => {
getWidget() {
const id = this.getWidgetId()
return R.path(['widgets', id], this.props.field)
}
.mergeMap((message) => {
if (R.path(['source', 'type'], message) === 'user') {
return this.user(message.source.userId)
.then((authorInformation) => R.assoc('source', authorInformation, message));
}
return Promise.resolve(message);
})
.mergeMap((normalized) => this.parser.parse(normalized))
const npmPackage = (root: null, { name }: { name: string }): object =>
loaders.analysis.load(name).then(path(['collected', 'metadata']))
}
}
`;
const result = await runGQLQuery({
cerr,
query,
variables: { sitegroup },
});
const { errors } = result;
if (errors != null) {
return printGraphQLErrors(cerr, ...errors);
}
const sitegroupData = R.path(['data', 'siteGroupByName'])(result);
if (sitegroupData == null) {
return printErrors(clog, `No sitegroup '${sitegroup}' found`);
}
const sites = R.compose(
R.map(({ siteName, siteBranch }) => `${siteName}:${siteBranch}`),
R.pathOr([], ['data', 'siteGroupByName', 'sites']),
)(result);
const formatSlack = (slack) => {
if (slack == null) {
return '';
}
const webhook = R.prop('webhook', slack);
import ArpeggiatorSelector from '../molecules/ArpeggiatorSelector';
import ModalDialog from '../templates/ModalDialog';
import RangeSelector from '../molecules/RangeSelector';
import Selector from '../molecules/Selector';
import {updateArpeggiatorIsOn,
updateSelectedPattern,
updateSelectedRootNote,
updateSelectedScale} from '../../actions';
import noteNameFromPitch from '../../tools/noteNameFromPitch';
import {Provider} from 'react-redux';
import store from '../../store';
import render from '../../tools/render';
import PerformanceView from '../pages/PerformanceView';
const eventValuePath = path(['currentTarget', 'value']);
const eventCheckedPath = path(['currentTarget', 'checked']);
export default connect(identity)(({arpeggiator: {arpeggiatorIsOn, patterns, selectedPattern},
dispatch,
rootNote, scale: {scaleName, scales}}) =>