blob: 724bf49519d1cb56d6bc9d315cf5b0eb3bd3448e [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 => {
return 'layers' in asset;
};
const isBinaryAsset = (asset: LottieAsset): asset is LottieBinaryAsset => {
return 'p' in asset;
};
export { isCompAsset, isBinaryAsset };