text stringlengths 9 39.2M | dir stringlengths 25 226 | lang stringclasses 163
values | created_date timestamp[s] | updated_date timestamp[s] | repo_name stringclasses 751
values | repo_full_name stringclasses 752
values | star int64 1.01k 183k | len_tokens int64 1 18.5M |
|---|---|---|---|---|---|---|---|---|
```javascript
/* @flow strict-local */
import { NativeModules, Platform, Linking } from 'react-native';
import * as WebBrowser from 'expo-web-browser';
import OpenNotification from 'react-native-open-notification';
import type { BrowserPreference, GlobalSettingsState } from '../types';
const { ZLPConstants } = Native... | /content/code_sandbox/src/utils/openLink.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 541 |
```javascript
/* @flow strict-local */
import { ExtendableError } from './logging';
export class TimeoutError extends ExtendableError {}
/**
* Time-out a Promise after `timeLimitMs` has passed.
*
* Returns a new Promise that rejects with a TimeoutError if the
* passed `promise` doesn't settle (resolve/reject) wit... | /content/code_sandbox/src/utils/async.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 782 |
```javascript
/* @flow strict-local */
import { objectFromEntries } from '../jsBackport';
export const caseInsensitiveCompareFunc = (a: string, b: string): number =>
a.toLowerCase().localeCompare(b.toLowerCase());
export function deeperMerge<K, V>(
obj1: $ReadOnly<{| [K]: V |}>,
obj2: $ReadOnly<{| [K]: V |}>,
... | /content/code_sandbox/src/utils/misc.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 307 |
```javascript
// @flow strict-local
import { objectFromEntries } from '../jsBackport';
/**
* Return an object where each property value equals the key.
*
* This is a handy idiom for making objects that function like enums.
* For an example, see:
* path_to_url#toc-keymirror
*
* The main reason to use this hel... | /content/code_sandbox/src/utils/keyMirror.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 212 |
```javascript
/* @flow strict-local */
import { nativeApplicationVersion } from 'expo-application';
import { Platform } from 'react-native';
import { androidRelease } from '../reactNativeUtils';
const systemName =
// prettier-ignore
Platform.OS === 'ios'
// Probably "iOS" on all iOS devices we support (was "i... | /content/code_sandbox/src/utils/userAgent.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 216 |
```javascript
/* @flow strict-local */
/* eslint-disable no-underscore-dangle */
/* eslint-disable no-use-before-define */
// $FlowFixMe[untyped-import]
import md5 from 'blueimp-md5';
import * as logging from './logging';
import { ensureUnreachable } from '../generics';
import { type UserId } from '../api/idTypes';
im... | /content/code_sandbox/src/utils/avatar.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 3,549 |
```javascript
/* @flow strict-local */
/* eslint-disable no-underscore-dangle */
type VersionElements = {|
major: number | void,
minor: number | void,
patch: number | void,
flag: 'dev' | ['rc', number] | void,
numCommits: number | void,
commitId: string | void,
|};
/**
* Parsed form of a Zulip server ver... | /content/code_sandbox/src/utils/zulipVersion.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 1,453 |
```javascript
/* @flow strict-local */
import { Alert } from 'react-native';
import Toast from 'react-native-simple-toast';
import type { GlobalSettingsState, GetText, LocalizableText } from '../types';
import { openLinkWithUserPreference } from './openLink';
export const showToast = (message: string) => {
Toast.sh... | /content/code_sandbox/src/utils/info.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 498 |
```javascript
/* @flow strict-local */
import {
captureException,
captureMessage,
configureScope,
withScope as withScopeImpl,
} from '@sentry/react-native';
import type { ZulipVersion } from './zulipVersion';
import type { JSONable } from './jsonable';
import { objectEntries } from '../flowPonyfill';
import co... | /content/code_sandbox/src/utils/logging.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 1,968 |
```javascript
/* @flow strict-local */
import base64 from 'base-64';
export const xorHexStrings = (hex1: string, hex2: string): string => {
if (hex1.length !== hex2.length) {
throw new Error('Both inputs must have the same length.');
}
return hex1
.split('')
.map((char, i) => (parseInt(hex1[i], 16) ... | /content/code_sandbox/src/utils/encoding.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 563 |
```javascript
/* @flow strict-local */
// $FlowFixMe[untyped-import]
import isEqual from 'lodash.isequal';
import { mapOrNull } from '../collections';
import * as logging from './logging';
import type {
PmRecipientUser,
Message,
StreamMessage,
PmMessage,
Outbox,
StreamOutbox,
PmOutbox,
UserId,
UserOr... | /content/code_sandbox/src/utils/recipient.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 4,484 |
```javascript
/* @flow strict-local */
import format from 'date-fns/format';
import isToday from 'date-fns/isToday';
import isYesterday from 'date-fns/isYesterday';
import isSameYear from 'date-fns/isSameYear';
import addMinutes from 'date-fns/addMinutes';
// $FlowFixMe[untyped-import]
import tz from 'timezone/loaded';... | /content/code_sandbox/src/utils/date.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 882 |
```javascript
/* @flow strict-local */
import { makeUserId } from '../api/idTypes';
import type { ApiNarrow, Message, Outbox, Stream, UserId, UserOrBot } from '../types';
import {
normalizeRecipientsAsUserIdsSansMe,
pmKeyRecipientsFromMessage,
recipientsOfPrivateMessage,
type PmKeyRecipients,
type PmKeyUsers... | /content/code_sandbox/src/utils/narrow.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 5,188 |
```javascript
/* @flow strict-local */
import { StatusBar, Platform } from 'react-native';
// Network activity indicators should be visible if *any* network activity is occurring
let activityCounter = 0;
export const networkActivityStart = (isSilent: boolean) => {
if (isSilent) {
return;
}
activityCounter... | /content/code_sandbox/src/utils/networkActivity.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 153 |
```javascript
/* @flow strict-local */
import type { FlagsState, Message, Outbox } from '../types';
export const filterUnreadMessageIds = (
messageIds: $ReadOnlyArray<number>,
flags: FlagsState,
): number[] => messageIds.filter((msgId: number) => !flags || !flags.read || !flags.read[msgId]);
export const filterUn... | /content/code_sandbox/src/utils/unread.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 174 |
```javascript
/* @flow strict-local */
import { addBreadcrumb } from '@sentry/react-native';
import * as internal_url from '@zulip/shared/lib/internal_url';
import { makeUserId } from '../api/idTypes';
import type { Narrow, Stream, UserId, Message, Outbox, PmMessage, PmOutbox } from '../types';
import { topicNarrow, st... | /content/code_sandbox/src/utils/internalLinks.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 3,160 |
```javascript
// @flow strict-local
/**
* A wrapper around Map, akin to Python's `defaultdict`.
*/
// This could be a subclass of Map instead. That would also mean it gets
// all the handy methods of Map.
//
// The slightly tricky bit is that that would mean it could enter our Redux
// state where the type says sim... | /content/code_sandbox/src/utils/DefaultMap.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 255 |
```javascript
// @flow strict-local
import DefaultMap from '../DefaultMap';
describe('DefaultMap', () => {
test('smoke', () => {
const m = new DefaultMap(() => []);
expect([...m.map.entries()].sort()).toEqual([]);
// Create a value.
m.getOrCreate('a').push(1);
expect([...m.map.entries()].sort()... | /content/code_sandbox/src/utils/__tests__/DefaultMap-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 194 |
```javascript
/* @flow strict-local */
import { foregroundColorFromBackground, colorHashFromString } from '../color';
describe('foregroundColorFromBackground', () => {
test('returns "black" for light backgrounds', () => {
expect(foregroundColorFromBackground('#ffffff')).toEqual('black');
expect(foregroundCol... | /content/code_sandbox/src/utils/__tests__/color-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 351 |
```javascript
/* @flow strict-local */
import { objectEntries } from '../flowPonyfill';
/**
* An object `encodeParamsForUrl` can flatten.
*
* In principle the values should be strings; but we include some other
* primitive types for which `toString` is just as good as `JSON.stringify`.
*/
export type UrlParamValu... | /content/code_sandbox/src/utils/url.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 1,117 |
```javascript
/* @flow strict-local */
import { sleep, BackoffMachine } from '../async';
import { assertUsingFakeTimers } from '../../__tests__/lib/fakeTimers';
describe('BackoffMachine', () => {
beforeAll(() => {
assertUsingFakeTimers();
});
afterEach(() => {
expect(jest.getTimerCount()).toBe(0);
j... | /content/code_sandbox/src/utils/__tests__/async-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 992 |
```javascript
// @flow strict-local
import { randString } from '../misc';
import { ZulipVersion } from '../zulipVersion';
import * as eg from '../../__tests__/lib/exampleData';
describe('ZulipVersion.prototype.isAtLeast(otherZulipVersion)', () => {
// if i > j, versions[i][k] > versions[j][l] for all k, l
// if i... | /content/code_sandbox/src/utils/__tests__/zulipVersion-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 1,228 |
```javascript
/* @flow strict-local */
import { promiseTimeout, TimeoutError } from '../async';
import { fakeSleep } from '../../__tests__/lib/fakeTimers';
const ONE_MINUTE_MS: number = 1000 * 60;
describe('promiseTimeout', () => {
afterEach(() => {
// clear any unset timers
expect(jest.getTimerCount()).toB... | /content/code_sandbox/src/utils/__tests__/promiseTimeout-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 332 |
```javascript
import deepFreeze from 'deep-freeze';
import { removeItemsFromArray, filterArray, replaceItemInArray } from '../immutability';
describe('removeItemsFromArray', () => {
test('return a new array with items removed, do not mutate input', () => {
const inputArray = deepFreeze([1, 2, 3, 4, 5]);
con... | /content/code_sandbox/src/utils/__tests__/immutability-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 666 |
```javascript
/* @flow strict-local */
import {
normalizeRecipientsAsUserIdsSansMe,
isSameRecipient,
pmKeyRecipientUsersFromIds,
} from '../recipient';
import * as eg from '../../__tests__/lib/exampleData';
import { makeUserId } from '../../api/idTypes';
import { randString } from '../misc';
describe('normalize... | /content/code_sandbox/src/utils/__tests__/recipient-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 773 |
```javascript
import { filterUnreadMessageIds, filterUnreadMessagesInRange } from '../unread';
describe('filterUnreadMessageIds', () => {
test('empty message list has no unread messages', () => {
const messages = [];
const flags = {};
const expectedUnread = [];
const actualUnread = filterUnreadMessa... | /content/code_sandbox/src/utils/__tests__/unread-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 804 |
```javascript
/* @flow strict-local */
import {
HOME_NARROW,
isHomeNarrow,
pm1to1NarrowFromUser,
is1to1PmNarrow,
pmNarrowFromUsersUnsafe,
isSpecialNarrow,
ALL_PRIVATE_NARROW,
streamNarrow,
isStreamNarrow,
topicNarrow,
isTopicNarrow,
SEARCH_NARROW,
isSearchNarrow,
isPmNarrow,
isMessageInNa... | /content/code_sandbox/src/utils/__tests__/narrow-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 4,054 |
```javascript
import { shortTime, shortDate, longDate, daysInDate, humanDate } from '../date';
describe('Timezones (for test environment only)', () => {
test('Timezone has been set to UTC, unless on Windows', () => {
expect(
new Date().getTimezoneOffset() === 0
// 'win32' is the only possible value... | /content/code_sandbox/src/utils/__tests__/date-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 653 |
```javascript
/* @flow strict-local */
// $FlowFixMe[untyped-import]
import md5 from 'blueimp-md5';
import {
AvatarURL,
GravatarURL,
FallbackAvatarURL,
UploadedAvatarURL,
DEFAULT_UPLOAD_SIZE_PX,
MEDIUM_UPLOAD_SIZE_PX,
} from '../avatar';
import * as eg from '../../__tests__/lib/exampleData';
describe('Ava... | /content/code_sandbox/src/utils/__tests__/avatar-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 1,741 |
```javascript
/* @flow strict-local */
import {
base64ToHex,
hexToBase64,
hexToAscii,
asciiToHex,
xorHexStrings,
base64Utf8Encode,
} from '../encoding';
describe('base64ToHex', () => {
test('correctly converts a base64 string to a hex string', () => {
const hex = your_sha256_hash;
const base64 = ... | /content/code_sandbox/src/utils/__tests__/encoding-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 664 |
```javascript
/* @flow strict-local */
import invariant from 'invariant';
// Tell ESLint to recognize `expectStream` as a helper function that
// runs assertions.
/* eslint jest/expect-expect: ["error", { "assertFunctionNames": ["expect", "check", "expectStream"] }] */
import type { Stream } from '../../types';
impor... | /content/code_sandbox/src/utils/__tests__/internalLinks-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 5,574 |
```javascript
/* @flow strict-local */
import { isUrlOnRealm, isUrlAbsolute, isUrlRelative, isUrlPathAbsolute } from '../url';
const urlClassifierCases = {
// These data are mostly a selection from this resource:
// path_to_url
// which is referred to at the top of the URL Standard.
absolute: ['path_to_url '... | /content/code_sandbox/src/utils/__tests__/url-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 653 |
```javascript
/* @flow strict-local */
import { isValidEmailFormat, deeperMerge } from '../misc';
describe('deeperMerge', () => {
test('two empty objects merge into an empty object', () => {
const a = {};
const b = {};
const expectedResult = {};
const result = deeperMerge(a, b);
expect(result).... | /content/code_sandbox/src/utils/__tests__/misc-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 574 |
```javascript
/* @flow strict-local */
import type { Reaction, AggregatedReaction, UserId } from '../types';
export default (
reactions: $ReadOnlyArray<Reaction>,
ownUserId: UserId,
): $ReadOnlyArray<AggregatedReaction> => {
const reactionMap = new Map();
reactions.forEach(x => {
let item = reactionMap.get... | /content/code_sandbox/src/reactions/aggregateReactions.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 220 |
```javascript
/* @flow strict-local */
import React from 'react';
import type { Node } from 'react';
import { FlatList } from 'react-native';
import type { UserId, UserOrBot } from '../types';
import UserItem from '../users/UserItem';
import { useNavigation } from '../react-navigation';
type Props = $ReadOnly<{|
re... | /content/code_sandbox/src/reactions/ReactionUserList.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 222 |
```javascript
/* @flow strict-local */
import React, { useEffect } from 'react';
import type { Node } from 'react';
import { View } from 'react-native';
import { createMaterialTopTabNavigator } from '@react-navigation/material-top-tabs';
import type { RouteProp } from '../react-navigation';
import type { AppNavigation... | /content/code_sandbox/src/reactions/MessageReactionsScreen.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 964 |
```javascript
import deepFreeze from 'deep-freeze';
import aggregateReactions from '../aggregateReactions';
describe('aggregateReactions', () => {
test('empty input results in empty aggregate list', () => {
const reactions = deepFreeze([]);
const expectedResult = [];
const actualResult = aggregateReac... | /content/code_sandbox/src/reactions/__tests__/aggregateReactions-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 622 |
```javascript
/**
* The core of the user-status model, without dependencies on other models.
*
* @flow strict-local
*/
import Immutable from 'immutable';
import type { UserId } from '../api/apiTypes';
import type { UserStatus } from '../api/modelTypes';
/**
* The canonical default, "unset" user status.
*
* Thi... | /content/code_sandbox/src/user-statuses/userStatusesCore.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 382 |
```javascript
/* @flow strict-local */
// $FlowFixMe[untyped-import]
import isEqual from 'lodash.isequal';
import React, { useState, useContext, useCallback } from 'react';
import type { Node } from 'react';
import { FlatList, View, Pressable } from 'react-native';
import { TranslationContext } from '../boot/Translati... | /content/code_sandbox/src/user-statuses/UserStatusScreen.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 1,750 |
```javascript
/* @flow strict-local */
import Immutable from 'immutable';
import type { UserStatus, UserStatusUpdate } from '../api/modelTypes';
import { makeUserId } from '../api/idTypes';
import { objectEntries } from '../flowPonyfill';
import type { PerAccountState, PerAccountApplicableAction, UserId } from '../typ... | /content/code_sandbox/src/user-statuses/userStatusesModel.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 640 |
```javascript
/* @flow strict-local */
import React, { useContext, useCallback, useMemo } from 'react';
import type { Node } from 'react';
import { Platform } from 'react-native';
import type { AppNavigationProp } from '../nav/AppNavigator';
import { ThemeContext } from '../styles/theme';
import Touchable from '../com... | /content/code_sandbox/src/user-statuses/EmojiInput.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 579 |
```javascript
/* @flow strict-local */
import Immutable from 'immutable';
import { objectFromEntries } from '../../jsBackport';
import { makeUserId, type UserId } from '../../api/idTypes';
import type { UserStatusesState } from '../../types';
import type { UserStatusUpdate } from '../../api/modelTypes';
import * as eg... | /content/code_sandbox/src/user-statuses/__tests__/userStatusesModel-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 1,376 |
```javascript
/* @flow strict-local */
// $FlowFixMe[untyped-import]
import omit from 'lodash.omit';
import Immutable from 'immutable';
import type {
MessagesState,
Message,
PerAccountApplicableAction,
PerAccountState,
UpdateMessageEvent,
} from '../types';
import {
REGISTER_COMPLETE,
MESSAGE_FETCH_COMPL... | /content/code_sandbox/src/message/messagesReducer.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 2,217 |
```javascript
/* @flow strict-local */
import React from 'react';
import type { Node } from 'react';
import { View } from 'react-native';
import ZulipTextIntl from '../common/ZulipTextIntl';
import styles from '../styles';
export default function AnnouncementOnly(props: {||}): Node {
return (
<View style={style... | /content/code_sandbox/src/message/AnnouncementOnly.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 116 |
```javascript
/* @flow strict-local */
import { createSelector, defaultMemoize } from 'reselect';
import invariant from 'invariant';
import type { Message, PmMessage, Outbox, Narrow, Selector, MessageListElement } from '../types';
import { getAllNarrows, getFlags, getMessages } from '../directSelectors';
import * as l... | /content/code_sandbox/src/message/messageSelectors.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 1,038 |
```javascript
/* @flow strict-local */
import React from 'react';
import type { Node } from 'react';
import { View } from 'react-native';
import type { Narrow } from '../types';
import { createStyleSheet } from '../styles';
import ZulipTextIntl from '../common/ZulipTextIntl';
import {
isHomeNarrow,
is1to1PmNarro... | /content/code_sandbox/src/message/NoMessages.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 476 |
```javascript
/* @flow strict-local */
import React, { useCallback, useContext, useMemo } from 'react';
import type { Node } from 'react';
import { View, FlatList } from 'react-native';
import { SafeAreaView } from 'react-native-safe-area-context';
import useFetchedDataWithRefresh from '../common/useFetchedDataWithRe... | /content/code_sandbox/src/message/ReadReceiptsScreen.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 1,527 |
```javascript
/* @flow strict-local */
// $FlowFixMe[untyped-import]
import isEqual from 'lodash.isequal';
import type { Narrow } from '../types';
// TODO: Consider completing this and making it exact, once
// `MessageList`'s props are type-checked.
type Props = $ReadOnly<{
narrow: Narrow,
messages: $ReadOnlyArray... | /content/code_sandbox/src/message/scrollStrategy.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 400 |
```javascript
/* @flow strict-local */
import React, { useCallback } from 'react';
import type { Node } from 'react';
import { View } from 'react-native';
import type { Stream, Narrow } from '../types';
import { useSelector } from '../react-redux';
import * as api from '../api';
import ZulipButton from '../common/Zul... | /content/code_sandbox/src/message/NotSubscribed.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 315 |
```javascript
/* @flow strict-local */
import * as logging from '../utils/logging';
import * as NavigationService from '../nav/NavigationService';
import type { GetText, Message, Narrow, ThunkAction } from '../types';
import { getAuth, getRealm, getMessages, getZulipFeatureLevel } from '../selectors';
import {
getNea... | /content/code_sandbox/src/message/messagesActions.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 2,531 |
```javascript
/* @flow strict-local */
import type { Message, Narrow, Outbox, MessageListElement } from '../types';
import { isConversationNarrow, isStreamNarrow } from '../utils/narrow';
import { isSameRecipient } from '../utils/recipient';
import { isSameDay } from '../utils/date';
// Prefer getMessageListElementsMe... | /content/code_sandbox/src/message/getMessageListElements.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 604 |
```javascript
/* @flow strict-local */
import * as logging from '../utils/logging';
import type {
Auth,
Narrow,
PerAccountState,
Message,
PerAccountAction,
Stream,
ThunkAction,
UserId,
LocalizableText,
} from '../types';
import * as api from '../api';
import {
Server5xxError,
NetworkError,
ApiEr... | /content/code_sandbox/src/message/fetchActions.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 3,322 |
```javascript
/* @flow strict-local */
import React, { useCallback } from 'react';
import type { Node } from 'react';
import { View, TouchableOpacity } from 'react-native';
import type { Stream, UserOrBot, Subscription } from '../types';
import { createStyleSheet } from '../styles';
import { useSelector } from '../re... | /content/code_sandbox/src/message/MentionedUserNotSubscribed.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 659 |
```javascript
/* @flow strict-local */
import * as eg from '../../__tests__/lib/exampleData';
import { HOME_NARROW } from '../../utils/narrow';
import getMessageListElements from '../getMessageListElements';
describe('getMessageListElements', () => {
const narrow = HOME_NARROW;
test('empty messages results in no ... | /content/code_sandbox/src/message/__tests__/getMessageListElements-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 872 |
```javascript
/* @flow strict-local */
import configureStore from 'redux-mock-store';
// $FlowFixMe[untyped-import]
import thunk from 'redux-thunk';
import { combinedThunkExtras } from '../../boot/store';
import { navigateToChat } from '../../nav/navActions';
import * as NavigationService from '../../nav/NavigationSer... | /content/code_sandbox/src/message/__tests__/messageActions-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 1,039 |
```javascript
/* @flow strict-local */
import { streamNarrow } from '../../utils/narrow';
import { getScrollStrategy } from '../scrollStrategy';
import * as eg from '../../__tests__/lib/exampleData';
const someNarrow = streamNarrow(eg.stream.stream_id);
const anotherStream = eg.makeStream();
const anotherNarrow = str... | /content/code_sandbox/src/message/__tests__/scrollStrategy-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 1,080 |
```javascript
/* @flow strict-local */
import invariant from 'invariant';
import configureStore from 'redux-mock-store';
// $FlowFixMe[untyped-import]
import thunk from 'redux-thunk';
import Immutable from 'immutable';
import type { GlobalState } from '../../reduxTypes';
import type { Action } from '../../actionTypes'... | /content/code_sandbox/src/message/__tests__/fetchActions-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 3,799 |
```javascript
/* @flow strict-local */
// $FlowFixMe[untyped-import]
import Color from 'color';
import React, { useCallback, useContext, useMemo } from 'react';
import type { Node } from 'react';
import { Platform, View, Alert, Linking, Pressable } from 'react-native';
import DocumentPicker from 'react-native-document-... | /content/code_sandbox/src/compose/ComposeMenu.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 2,902 |
```javascript
/* @flow strict-local */
import deepFreeze from 'deep-freeze';
import type { Submessage } from '../../types';
import messagesReducer from '../messagesReducer';
import { FIRST_UNREAD_ANCHOR } from '../../anchor';
import {
MESSAGE_FETCH_COMPLETE,
EVENT_SUBMESSAGE,
EVENT_MESSAGE_DELETE,
EVENT_REACTI... | /content/code_sandbox/src/message/__tests__/messagesReducer-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 7,179 |
```javascript
/* @flow strict-local */
import type { Narrow, Stream, UserId, UserOrBot, LocalizableText, GetText } from '../types';
import { getFullNameText } from '../users/userSelectors';
import { caseNarrowDefault } from '../utils/narrow';
export default (
narrow: Narrow,
ownUserId: UserId,
allUsersById: Map<... | /content/code_sandbox/src/compose/getComposeInputPlaceholder.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 331 |
```javascript
/* @flow strict-local */
import React, { useState, useCallback, useContext, forwardRef, useImperativeHandle } from 'react';
import type { AbstractComponent, Node } from 'react';
import type { Stream, Narrow, UserOrBot, Subscription, UserId } from '../types';
import { useSelector } from '../react-redux';... | /content/code_sandbox/src/compose/MentionWarnings.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 1,172 |
```javascript
/* @flow strict-local */
import deepFreeze from 'deep-freeze';
import getComposeInputPlaceholder from '../getComposeInputPlaceholder';
import {
pm1to1NarrowFromUser,
streamNarrow,
topicNarrow,
pmNarrowFromUsersUnsafe,
} from '../../utils/narrow';
import * as eg from '../../__tests__/lib/exampleDa... | /content/code_sandbox/src/compose/__tests__/getComposeInputPlaceholder-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 621 |
```javascript
/* @flow strict-local */
import * as logging from '../../utils/logging';
import { chooseUploadImageFilename } from '../ComposeMenu';
describe('chooseUploadImageFilename', () => {
test('Does nothing if the image uri does not end with an extension for the JPEG format', () => {
expect(chooseUploadImag... | /content/code_sandbox/src/compose/__tests__/ComposeMenu-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 247 |
```javascript
/* @flow strict-local */
import { mapOrNull, symmetricDiff } from '../collections';
describe('mapOrNull', () => {
test('behaves right in happy case', () => {
expect(mapOrNull([10, 20], (x, i, a) => x + i + a.length)).toEqual([12, 23]);
});
test('returns null on nullish item', () => {
expe... | /content/code_sandbox/src/__tests__/collections-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 489 |
```javascript
/* @flow strict-local */
import isAppOwnDomain from '../isAppOwnDomain';
describe('isAppOwnDomain', () => {
test.each([
['path_to_url true],
['path_to_url true],
['path_to_url true],
['path_to_url true],
['path_to_url true],
['path_to_url true],
['path_to_url true],
['... | /content/code_sandbox/src/__tests__/isAppOwnDomain-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 148 |
```javascript
/* @flow strict-local */
import React from 'react';
import type { ComponentType } from 'react';
// $FlowFixMe[untyped-import]
import { create, act } from 'react-test-renderer';
// $FlowFixMe[untyped-import]
import * as ReactHooksTesting from '@testing-library/react-hooks';
import { fakeSleep } from './li... | /content/code_sandbox/src/__tests__/reactUtils-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 2,743 |
```javascript
/* @flow strict-local */
import { objectFromEntries } from '../jsBackport';
describe('objectFromEntries', () => {
test('basic', () => {
expect(
// prettier-ignore
objectFromEntries([['number', 1], ['null', null], ['obj', {}], ['undef', undefined]]),
).toStrictEqual({ number: 1, nul... | /content/code_sandbox/src/__tests__/jsBackport-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 96 |
```javascript
/** @jest-environment jest-environment-jsdom-global */
// @flow strict-local
import { assertUsingFakeTimers } from './lib/fakeTimers';
/**
* This file should not test any part of the application. It exists to test that
* certain functionality is present in the development environment used to run
* ot... | /content/code_sandbox/src/__tests__/test-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 1,353 |
```javascript
/*
* @flow strict-local
*/
import * as Sentry from '@sentry/react-native';
import { isSentryActive } from '../sentry';
describe('sentry', () => {
describe('is usable without initialization', () => {
// Sentry shouldn't be active at all in debug mode -- certainly not while
// we're specifical... | /content/code_sandbox/src/__tests__/sentry-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 246 |
```javascript
/* @flow strict-local */
import React, {
useContext,
useRef,
useState,
useEffect,
useCallback,
useMemo,
useImperativeHandle,
forwardRef,
} from 'react';
import { Platform, View } from 'react-native';
import type { LayoutEvent } from 'react-native/Libraries/Types/CoreEventTypes';
import { S... | /content/code_sandbox/src/compose/ComposeBox.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 6,175 |
```javascript
/* @flow strict-local */
import invariant from 'invariant';
import { getOwnUser, tryGetActiveAccountState, getRealm } from '../selectors';
import {
Role,
CreatePublicOrPrivateStreamPolicy,
type CreatePublicOrPrivateStreamPolicyT,
CreateWebPublicStreamPolicy,
} from '../api/permissionsTypes';
impo... | /content/code_sandbox/src/__tests__/permissionSelectors-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 3,557 |
```javascript
/* @flow strict-local */
import { sleep } from '../../utils/async';
/**
* Ensure the fake-timer implementation is used.
*
* By setting `timers: 'fake'` in our Jest config, the fake-timer
* implementation is the default. May be used to double-check that
* this default is in fact set, in our Jest setu... | /content/code_sandbox/src/__tests__/lib/fakeTimers.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 326 |
```javascript
/* @flow strict-local */
import type { GetText } from '../../types';
// Our translation function, usually given the name _.
// eslint-disable-next-line no-underscore-dangle
export const mock_: GetText = m => {
if (typeof m === 'object') {
if (m.text === '{_}') {
// $FlowIgnore[incompatible-i... | /content/code_sandbox/src/__tests__/lib/intl.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 138 |
```javascript
/* @flow strict-local */
import type {
RealmState,
PerAccountApplicableAction,
RealmEmojiById,
VideoChatProvider,
} from '../types';
import {
CreatePublicOrPrivateStreamPolicy,
CreateWebPublicStreamPolicy,
} from '../api/permissionsTypes';
import { EventTypes } from '../api/eventTypes';
import... | /content/code_sandbox/src/realm/realmReducer.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 2,381 |
```javascript
/* @flow strict-local */
import deepFreeze from 'deep-freeze';
import { createStore } from 'redux';
import Immutable from 'immutable';
import type {
CrossRealmBot,
Message,
PmMessage,
StreamMessage,
PmRecipientUser,
Reaction,
Stream,
Subscription,
User,
UserGroup,
UserId,
UserStat... | /content/code_sandbox/src/__tests__/lib/exampleData.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 8,297 |
```javascript
/* @flow strict-local */
import deepFreeze from 'deep-freeze';
import type { RealmState } from '../../types';
import realmReducer from '../realmReducer';
import {
EVENT_REALM_EMOJI_UPDATE,
EVENT_UPDATE_DISPLAY_SETTINGS,
EVENT_REALM_FILTERS,
EVENT,
} from '../../actionConstants';
import type { Use... | /content/code_sandbox/src/realm/__tests__/realmReducer-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 4,534 |
```javascript
/* @flow strict-local */
import React from 'react';
import type { Node } from 'react';
import { View } from 'react-native';
import type { Narrow } from '../types';
import { createStyleSheet } from '../styles';
import { useSelector } from '../react-redux';
import { getUnreadCountForNarrow } from '../sele... | /content/code_sandbox/src/chat/UnreadNotice.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 410 |
```javascript
/* @flow strict-local */
import React, { useCallback } from 'react';
import type { Node } from 'react';
import type { Narrow } from '../types';
import { createStyleSheet } from '../styles';
import { useSelector } from '../react-redux';
import ZulipButton from '../common/ZulipButton';
import * as api fro... | /content/code_sandbox/src/chat/MarkAsReadButton.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 667 |
```javascript
/* @flow strict-local */
import type { Fetching, PerAccountState, Narrow } from '../types';
import { getFetching } from '../directSelectors';
import { keyFromNarrow } from '../utils/narrow';
/** The value implicitly represented by a missing entry in FetchingState. */
export const DEFAULT_FETCHING = { old... | /content/code_sandbox/src/chat/fetchingSelectors.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 115 |
```javascript
/* @flow strict-local */
import React from 'react';
import type { Node } from 'react';
import { StyleSheet, View } from 'react-native';
import type { Narrow } from '../types';
import ZulipTextIntl from '../common/ZulipTextIntl';
const styles = StyleSheet.create({
container: {
flex: 1,
alignIt... | /content/code_sandbox/src/chat/InvalidNarrow.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 179 |
```javascript
/* @flow strict-local */
// $FlowFixMe[untyped-import]
import isEqual from 'lodash.isequal';
import { createSelector } from 'reselect';
import type {
PerAccountState,
Message,
Narrow,
Outbox,
Selector,
Stream,
Subscription,
} from '../types';
import { getAllNarrows, getMessages, getOutbox, ... | /content/code_sandbox/src/chat/narrowsSelectors.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 1,815 |
```javascript
/* @flow strict-local */
import React, { useCallback } from 'react';
import type { Node } from 'react';
import { FlatList } from 'react-native';
import type { RouteProp } from '../react-navigation';
import type { AppNavigationProp } from '../nav/AppNavigator';
import { useSelector } from '../react-redux'... | /content/code_sandbox/src/chat/PmConversationDetailsScreen.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 350 |
```javascript
/* @flow strict-local */
import React, { useCallback, useContext } from 'react';
import type { Node } from 'react';
import { useIsFocused } from '@react-navigation/native';
import { useSelector, useDispatch } from '../react-redux';
import type { RouteProp } from '../react-navigation';
import type { AppNa... | /content/code_sandbox/src/chat/ChatScreen.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 2,602 |
```javascript
/* @flow strict-local */
// $FlowFixMe[untyped-import]
import union from 'lodash.union';
import Immutable from 'immutable';
import type { NarrowsState, PerAccountApplicableAction } from '../types';
import { ensureUnreachable } from '../types';
import {
REGISTER_COMPLETE,
MESSAGE_FETCH_START,
MESSAG... | /content/code_sandbox/src/chat/narrowsReducer.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 2,173 |
```javascript
/* @flow strict-local */
import React from 'react';
import type { Node } from 'react';
import { StyleSheet, View } from 'react-native';
import type { Narrow } from '../types';
import ZulipTextIntl from '../common/ZulipTextIntl';
import { TimeoutError } from '../utils/async';
const styles = StyleSheet.c... | /content/code_sandbox/src/chat/FetchError.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 238 |
```javascript
/* @flow strict-local */
import invariant from 'invariant';
import type { ReadWrite } from '../generics';
import type { PerAccountApplicableAction, FlagsState, Message } from '../types';
import {
REGISTER_COMPLETE,
MESSAGE_FETCH_COMPLETE,
EVENT_NEW_MESSAGE,
EVENT_UPDATE_MESSAGE_FLAGS,
RESET_ACC... | /content/code_sandbox/src/chat/flagsReducer.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 1,155 |
```javascript
import deepFreeze from 'deep-freeze';
import { getFetchingForNarrow } from '../fetchingSelectors';
import { HOME_NARROW, HOME_NARROW_STR } from '../../utils/narrow';
describe('getFetchingForNarrow', () => {
test('if no narrow information exists in state, return a null fetching object', () => {
con... | /content/code_sandbox/src/chat/__tests__/fetchingSelectors-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 223 |
```javascript
/* @flow strict-local */
import type { FetchingState, PerAccountApplicableAction } from '../types';
import {
MESSAGE_FETCH_START,
MESSAGE_FETCH_ERROR,
MESSAGE_FETCH_COMPLETE,
RESET_ACCOUNT_DATA,
REGISTER_COMPLETE,
} from '../actionConstants';
import { NULL_OBJECT } from '../nullObjects';
import ... | /content/code_sandbox/src/chat/fetchingReducer.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 648 |
```javascript
/* @flow strict-local */
import Immutable from 'immutable';
import {
getFirstMessageId,
getLastMessageId,
getMessagesForNarrow,
getStreamInNarrow,
isNarrowValid,
getShownMessagesForNarrow,
} from '../narrowsSelectors';
import {
HOME_NARROW,
HOME_NARROW_STR,
pm1to1NarrowFromUser,
strea... | /content/code_sandbox/src/chat/__tests__/narrowsSelectors-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 3,294 |
```javascript
/* @flow strict-local */
import deepFreeze from 'deep-freeze';
import Immutable from 'immutable';
import narrowsReducer from '../narrowsReducer';
import {
HOME_NARROW,
HOME_NARROW_STR,
pm1to1NarrowFromUser,
ALL_PRIVATE_NARROW_STR,
pmNarrowFromUsersUnsafe,
streamNarrow,
topicNarrow,
STARRE... | /content/code_sandbox/src/chat/__tests__/narrowsReducer-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 4,752 |
```javascript
/* @flow strict-local */
import deepFreeze from 'deep-freeze';
import * as eg from '../../__tests__/lib/exampleData';
import fetchingReducer from '../fetchingReducer';
import {
HOME_NARROW,
HOME_NARROW_STR,
streamNarrow,
keyFromNarrow,
SEARCH_NARROW,
} from '../../utils/narrow';
import { MESSAG... | /content/code_sandbox/src/chat/__tests__/fetchingReducer-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 1,002 |
```javascript
// @flow strict-local
import autoRehydrate from './autoRehydrate';
import createPersistor from './createPersistor';
import persistStore from './persistStore';
export type { Persistor, Config } from './types';
export { autoRehydrate, createPersistor, persistStore };
``` | /content/code_sandbox/src/third/redux-persist/index.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 60 |
```javascript
/* @flow strict-local */
import { REHYDRATE } from './constants';
export type Storage = interface {
multiSet(keyValuePairs: Array<Array<string>>): Promise<mixed>,
getItem(key: string): Promise<string | null>,
removeItem(string): Promise<mixed>,
getAllKeys(): Promise<$ReadOnlyArray<string>>,
};
... | /content/code_sandbox/src/third/redux-persist/types.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 439 |
```javascript
/* @flow strict-local */
import deepFreeze from 'deep-freeze';
import * as eg from '../../__tests__/lib/exampleData';
import flagsReducer from '../flagsReducer';
import { EVENT_UPDATE_MESSAGE_FLAGS } from '../../actionConstants';
describe('flagsReducer', () => {
describe('REGISTER_COMPLETE', () => {
... | /content/code_sandbox/src/chat/__tests__/flagsReducer-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 2,111 |
```javascript
/* @flow strict-local */
import type { Config } from './types';
import { KEY_PREFIX } from './constants';
import * as logging from '../../utils/logging';
import { allSettled } from '../../jsBackport';
export default async function getStoredState(config: Config): Promise<{ ... }> {
const storage = conf... | /content/code_sandbox/src/third/redux-persist/getStoredState.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 497 |
```javascript
/* @flow strict-local */
import type { Store } from 'redux';
import { historicalCacheKeys24 } from '../../storage/migrations';
import type { Config, OverpromisedRehydrateAction, Persistor } from './types';
import { REHYDRATE } from './constants';
import getStoredState from './getStoredState';
import cre... | /content/code_sandbox/src/third/redux-persist/persistStore.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 1,558 |
```javascript
/* @flow strict-local */
export const KEY_PREFIX: string = 'reduxPersist:';
export const REHYDRATE: 'persist/REHYDRATE' = 'persist/REHYDRATE';
``` | /content/code_sandbox/src/third/redux-persist/constants.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 42 |
```javascript
/* @flow strict-local */
import type { StoreEnhancer, Reducer } from 'redux';
import invariant from 'invariant';
import * as logging from '../../utils/logging';
import { REHYDRATE } from './constants';
import isStatePlainEnough from './utils/isStatePlainEnough';
export default function autoRehydrate<S: ... | /content/code_sandbox/src/third/redux-persist/autoRehydrate.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 1,010 |
```javascript
/* @flow strict-local */
import invariant from 'invariant';
import * as logging from '../../utils/logging';
import { KEY_PREFIX } from './constants';
import type { Storage } from './types';
export default function purgeStoredState(
config: { +storage: Storage, +keyPrefix?: string, ... },
keys: void ... | /content/code_sandbox/src/third/redux-persist/purgeStoredState.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 473 |
```javascript
/* @flow strict-local */
export default function isStatePlainEnough(a: mixed): boolean {
// isPlainObject + duck type not immutable
if (a === null) {
return false;
}
if (typeof a !== 'object') {
return false;
}
if (typeof a.asMutable === 'function') {
return false;
}
const pro... | /content/code_sandbox/src/third/redux-persist/utils/isStatePlainEnough.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 103 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.