blob: 176b2d1ce95638b742e7bf6138c9e77fa72eba8a [file] [log] [blame]
// Since LottieAssets don't have a single field to do discriminated unions,
// we are using type guards to narrow down Lottie asset types.
// link with some helpful information
// https://www.typescriptlang.org/docs/handbook/2/narrowing.html#using-type-predicates
import { LottieAsset, LottieCompAsset, LottieBinaryAsset } from '../types';
const isCompAsset = (asset: LottieAsset): asset is LottieCompAsset =>
'layers' in asset;
const isBinaryAsset = (asset: LottieAsset): asset is LottieBinaryAsset =>
'p' in asset;
export { isCompAsset, isBinaryAsset };