This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function method(value: { prop?: string }) { | |
if (value.prop) { | |
otherMethod(); | |
value.prop.charAt(0); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var obj = { prop: "test" }; | |
function otherMethod() { | |
delete obj.prop; | |
} | |
function method(value: { prop?: string }) { | |
if (value.prop) { | |
otherMethod(); | |
value.prop.charAt(0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function method(value: { prop?: string }) { | |
const savedProp = value.prop; | |
if (savedProp) { | |
otherMethod(); | |
savedProp.charAt(0); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isKinjaVideo(blockNode: BlockNodeJSON): boolean { | |
return blockNode.type === 'KinjaVideo'; | |
} | |
export default function getKinjaVideoForPost(post: Post): Array<string> { | |
const videoNodes = post.body.filter(n => isKinjaVideo(n)); | |
return videoNodes.map(vn => vn.id); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isKinjaVideo(blockNode: BlockNodeJSON): boolean { | |
return blockNode.type === 'KinjaVideo'; | |
} | |
export default function getKinjaVideoForPost(post: Post): Array<string> { | |
const videoNodes = post.body.filter(n => isKinjaVideo(n)); | |
return videoNodes.map(vn => vn.id); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getKinjaVideoForPost(post: Post): Array<string> { | |
const videoNodes = post.body.reduce<Array<KinjaVideoJSON>>((acc, n) => { | |
if (n.type === 'KinjaVideo') { | |
return [...acc, n]; | |
} | |
return acc; | |
}, []); | |
return videoNodes.map(vn => vn.id); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get featuredVideoUrl(): ?string { | |
if (this.featuredMedia && this.featuredMedia.id) { | |
let videoParams; | |
switch (this.featuredMedia.type) { | |
case 'YoutubeVideo': | |
videoParams = { | |
id: `youtube-video-${this.featuredMedia.id}`, | |
start: this.featuredMedia.start | |
}; | |
break; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type DeletedEmbedJSON = { | |
type: 'DeletedEmbed', | |
originalContent: {type?: string}, | |
deletedReason: ?DeletedReason | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type DeletedEmbedJSON = { | |
type: 'DeletedEmbed', | |
originalContent: {type?: string}, | |
deletedReason: ?DeletedReason | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type DeletedEmbedJSON = {| | |
type: 'DeletedEmbed', | |
originalContent: {type?: string}, | |
deletedReason: ?DeletedReason | |
|}; |