LocalDatastoreUtils.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. "use strict";
  2. var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
  3. var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
  4. _Object$defineProperty(exports, "__esModule", {
  5. value: true
  6. });
  7. exports.PIN_PREFIX = exports.OBJECT_PREFIX = exports.DEFAULT_PIN = void 0;
  8. exports.isLocalDatastoreKey = isLocalDatastoreKey;
  9. var _startsWith = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/starts-with"));
  10. /**
  11. * Copyright (c) 2015-present, Parse, LLC.
  12. * All rights reserved.
  13. *
  14. * This source code is licensed under the BSD-style license found in the
  15. * LICENSE file in the root directory of this source tree. An additional grant
  16. * of patent rights can be found in the PATENTS file in the same directory.
  17. *
  18. * @flow
  19. * @private
  20. */
  21. var DEFAULT_PIN = '_default';
  22. exports.DEFAULT_PIN = DEFAULT_PIN;
  23. var PIN_PREFIX = 'parsePin_';
  24. exports.PIN_PREFIX = PIN_PREFIX;
  25. var OBJECT_PREFIX = 'Parse_LDS_';
  26. exports.OBJECT_PREFIX = OBJECT_PREFIX;
  27. function isLocalDatastoreKey(key
  28. /*: string*/
  29. )
  30. /*: boolean*/
  31. {
  32. return !!(key && (key === DEFAULT_PIN || (0, _startsWith.default)(key).call(key, PIN_PREFIX) || (0, _startsWith.default)(key).call(key, OBJECT_PREFIX)));
  33. }