LocalDatastoreUtils.js 898 B

1234567891011121314151617181920212223242526272829303132
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.isLocalDatastoreKey = isLocalDatastoreKey;
  6. exports.OBJECT_PREFIX = exports.PIN_PREFIX = exports.DEFAULT_PIN = void 0;
  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. */
  17. var DEFAULT_PIN = '_default';
  18. exports.DEFAULT_PIN = DEFAULT_PIN;
  19. var PIN_PREFIX = 'parsePin_';
  20. exports.PIN_PREFIX = PIN_PREFIX;
  21. var OBJECT_PREFIX = 'Parse_LDS_';
  22. exports.OBJECT_PREFIX = OBJECT_PREFIX;
  23. function isLocalDatastoreKey(key
  24. /*: string*/
  25. )
  26. /*: boolean*/
  27. {
  28. return !!(key && (key === DEFAULT_PIN || key.startsWith(PIN_PREFIX) || key.startsWith(OBJECT_PREFIX)));
  29. }