Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: import individual methods from lodash #141

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/CacheManager.ts
Original file line number Diff line number Diff line change
@@ -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";

Expand Down Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions src/Image.tsx
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -96,7 +96,7 @@ export default class Image extends React.Component<ImageProps, ImageState> {
const flattenedStyle = StyleSheet.flatten(style);
const computedStyle: StyleProp<ImageStyle> = [
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) })
)
];
Expand Down