Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should passes when used properly', () => {
const a = new Asset(requiredAssetOptions);
const b = new Asset({
hash: 'string',
width: 1,
height: 1,
...requiredAssetOptions,
});
const c = new Asset({
hash: null,
width: null,
height: null,
...requiredAssetOptions,
});
});
});
it('should passes when used properly', () => {
const a = new Asset(requiredAssetOptions);
const b = new Asset({
hash: 'string',
width: 1,
height: 1,
...requiredAssetOptions,
});
const c = new Asset({
hash: null,
width: null,
height: null,
...requiredAssetOptions,
});
});
});
it('should passes when used properly', () => {
const a = new Asset(requiredAssetOptions);
const b = new Asset({
hash: 'string',
width: 1,
height: 1,
...requiredAssetOptions,
});
const c = new Asset({
hash: null,
width: null,
height: null,
...requiredAssetOptions,
});
});
});
async function fromUriAsync(remoteUri, fileName) {
const { uri, name, hash } = await fileInfoAsync(remoteUri, fileName);
if (uri) {
const type = getExtension(name);
let width = undefined;
let height = undefined;
if (isImageType(type)) {
const size = await imageSizeAsync(uri);
width = size.width;
height = size.height;
}
return new expoAsset.Asset({ name, type, hash, uri, width, height });
}
}
async function fromUriAsync(remoteUri: string, fileName: ?string): Promise {
const { uri, name, hash } = await fileInfoAsync(remoteUri, fileName);
if (uri) {
const type = getExtension(name);
let width = undefined;
let height = undefined;
if (isImageType(type)) {
const size = await getSizeAsync(uri);
width = size.width;
height = size.height;
}
return new Asset({ name, type, hash, uri, width, height });
}
}