From 1d5e5c9ff426aaf08fa4c763cec2821aca2ef7d8 Mon Sep 17 00:00:00 2001 From: Jesse Katsumata Date: Fri, 27 Dec 2019 16:01:53 +0900 Subject: [PATCH] chore: import individual methods from lodash --- src/CacheManager.ts | 5 ++--- src/Image.tsx | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/CacheManager.ts b/src/CacheManager.ts index 8ca7cb4..d63e7dd 100644 --- a/src/CacheManager.ts +++ b/src/CacheManager.ts @@ -1,5 +1,4 @@ -// @flow -import * as _ from "lodash"; +import uniqueId from "lodash/uniqueId"; import * as FileSystem from "expo-file-system"; import SHA1 from "crypto-js/sha1"; @@ -64,7 +63,7 @@ const getCacheEntry = async (uri: string): Promise<{ exists: boolean; path: stri const filename = uri.substring(uri.lastIndexOf("/"), uri.indexOf("?") === -1 ? uri.length : uri.indexOf("?")); const ext = filename.indexOf(".") === -1 ? ".jpg" : filename.substring(filename.lastIndexOf(".")); const path = `${BASE_DIR}${SHA1(uri)}${ext}`; - const tmpPath = `${BASE_DIR}${SHA1(uri)}-${_.uniqueId()}${ext}`; + const tmpPath = `${BASE_DIR}${SHA1(uri)}-${uniqueId()}${ext}`; // TODO: maybe we don't have to do this every time try { await FileSystem.makeDirectoryAsync(BASE_DIR); diff --git a/src/Image.tsx b/src/Image.tsx index 5e61792..e29f308 100644 --- a/src/Image.tsx +++ b/src/Image.tsx @@ -1,5 +1,5 @@ -// @flow -import * as _ from "lodash"; +import pickBy from "lodash/pickBy"; +import transform from "lodash/transform"; import * as React from "react"; import { Image as RNImage, @@ -96,7 +96,7 @@ export default class Image extends React.Component { const flattenedStyle = StyleSheet.flatten(style); const computedStyle: StyleProp = [ StyleSheet.absoluteFill, - _.transform(_.pickBy(flattenedStyle, (_val, key) => propsToCopy.indexOf(key) !== -1), (result, value: any, key) => + transform(pickBy(flattenedStyle, (_val, key) => propsToCopy.indexOf(key) !== -1), (result, value: any, key) => Object.assign(result, { [key]: value - (flattenedStyle.borderWidth || 0) }) ) ];