LocalDatastoreUtils.js 916 B

123456789101112131415161718192021222324252627282930313233
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.PIN_PREFIX = exports.OBJECT_PREFIX = exports.DEFAULT_PIN = void 0;
  6. exports.isLocalDatastoreKey = isLocalDatastoreKey;
  7. /**
  8. * Copyright (c) 2015-present, Parse, LLC.
  9. * All rights reserved.
  10. *
  11. * This source code is licensed under the BSD-style license found in the
  12. * LICENSE file in the root directory of this source tree. An additional grant
  13. * of patent rights can be found in the PATENTS file in the same directory.
  14. *
  15. * @flow
  16. * @private
  17. */
  18. const DEFAULT_PIN = '_default';
  19. exports.DEFAULT_PIN = DEFAULT_PIN;
  20. const PIN_PREFIX = 'parsePin_';
  21. exports.PIN_PREFIX = PIN_PREFIX;
  22. const OBJECT_PREFIX = 'Parse_LDS_';
  23. exports.OBJECT_PREFIX = OBJECT_PREFIX;
  24. function isLocalDatastoreKey(key
  25. /*: string*/
  26. )
  27. /*: boolean*/
  28. {
  29. return !!(key && (key === DEFAULT_PIN || key.startsWith(PIN_PREFIX) || key.startsWith(OBJECT_PREFIX)));
  30. }