LocalDatastoreUtils.js 663 B

1234567891011121314151617181920212223
  1. /**
  2. * Copyright (c) 2015-present, Parse, LLC.
  3. * All rights reserved.
  4. *
  5. * This source code is licensed under the BSD-style license found in the
  6. * LICENSE file in the root directory of this source tree. An additional grant
  7. * of patent rights can be found in the PATENTS file in the same directory.
  8. *
  9. * @flow
  10. */
  11. const DEFAULT_PIN = '_default';
  12. const PIN_PREFIX = 'parsePin_';
  13. const OBJECT_PREFIX = 'Parse_LDS_';
  14. function isLocalDatastoreKey(key
  15. /*: string*/
  16. )
  17. /*: boolean*/
  18. {
  19. return !!(key && (key === DEFAULT_PIN || key.startsWith(PIN_PREFIX) || key.startsWith(OBJECT_PREFIX)));
  20. }
  21. export { DEFAULT_PIN, PIN_PREFIX, OBJECT_PREFIX, isLocalDatastoreKey };