/*
@function create
@description Create a store data item from a local source
@param {Object} item [Data item]
@param {Object} store [Store element]
969709
function create(item, store) {
      var data = store.rootData.asObject();
      // New item has id
      if (item[store.idProperty]) {
        // Check item duplicated
        if (!data[item[store.idProperty]]) {
          // Create item
          data[item[store.idProperty]] = item;
        } else {
          // Item already exists
          return vcomet.error.log(
            "store",
            "Item with id " + item[store.idProperty] + " already exists"
          );
        }
      } else {
        // Add id value to item
        item[store.idProperty] = Object.keys(data).length.toString();
        // Create item
        data[item[store.idProperty]] = item;
      }
      if (item[store.idProperty]) {
        // Update store data
        store.rootData = store.data = new Result(data, store, store.data.__sorted);
        // Update store data items length
        store.size = Object.keys(store.data).length;
        // Trigger onSourceChanged event
        vcomet.triggerCallback("onSourceChanged", store);
        return item;
      } else {
        return vcomet.error.log("store", "Incorrect item format");
      }
    }
463821
function ItemsItem() {
    /**
     * The id value
     * @member
     */
    this.id = null;
    /**
     * The sku value
     * @member
     */
    this.sku = null;
    /**
     * The title value
     * @member
     */
    this.title = null;
    /**
     * The quantity value
     * @member
     */
    this.quantity = null;
    /**
     * The price value
     * @member
     */
    this.price = null;
    /**
     * The formattedPrice value
     * @member
     */
    this.formattedPrice = null;
    /**
     * The currency value
     * @member
     */
    this.currency = null;
    /**
     * The productLink value
     * @member
     */
    this.productLink = null;
    /**
     * The weight value
     * @member
     */
    this.weight = null;
    /**
     * The formattedWeight value
     * @member
     */
    this.formattedWeight = null;
    /**
     * The media of value
     * @member
     * @type { Media }
     */
    this.media = Object.create(Media.prototype);

}
1321921
function store(options) {
  options = options || {};
  var DataStore = lazy.DataStore();
  var opts = extend(options.store || {});
  return new DataStore('snippets', opts);
}
602651
function _addStore(app, item) {
  if (!item.name || item.name === '') {
    try {
      if (typeof item.fn.publicName === 'string') item.name = item.fn.publicName;
    } catch (e) {
    }
  }
  if (item.name.indexOf('thorin-store-') === 0) {  // we trim it.
    item.name = item.name.substr(13);
  }
  if (typeof app[stores][item.name] !== 'undefined') {
    throw new Error('Thorin.addStore: store ' + item.name + " is already registered. Please use a different name.");
  }
  let storeObj = new item.fn(app);
  storeObj.setName(item.name);
  app[stores][item.name] = storeObj;
}
1185982
@Override
    public DynamicDataStore create(StoreConfig config) throws IOException {
        try {
            return StoreFactory.createDynamicDataStore(config);
        } catch (Exception e) {
            if(e instanceof IOException) {
                throw (IOException)e;
            } else {
                throw new IOException(e);
            }
        }
    }
54277
function write (item) {

  var filename = item.file;
  var message = item.message;
  var header = item.header;
  var file = path.join(p_, filename);

  fs.exists(file, function (exists) {
    if (exists) {
      fs.appendFile(file, message, function () {
        task();
      });

    } else {
      if (header) {
        message = header + EOL + message;
      }

      var dir = path.dirname(file);
      fs.exists(dir, function (exists) {
        if (exists) {
          fs.appendFile(file, message, function () {
            task();
          });

        } else {
          fs.mkdirs(dir, function (err) {
            if (err) {
              console.error(err);
              task();
            } else {
              fs.appendFile(file, message, function () {
                task();
              });
            }
          });
        }
      });
    }
  });
}
219946
function initializeStore(config) {
		self.store = new Store(config.master, config);
		self.store.on('message', handleIncomingMessage);
		log.out('Store initialized.');
	}
206425
def create(self, item, **kwargs):
        
        response = self._new_response()
        if self._prototype_handler.check(item, 'create', response):
            self._encrypt(item)
            params = {'Item': item}
            self._call_ddb_method(self.table.put_item,
                                  params, response)
            if response.status == 'success':
                response.data = item
        response.prepare()
        return response
682777
function listByAttr(store, attrs) {
      var data = store.data.asObject();
      var listedData = {};
      var isArray = store.data.__sorted;
      var validItem;
      // If no attribute is specified retrieve root data
      if (attrs.length > 0) {
        if (isArray) {
          data = store.data.asArray();
          listedData = [];
          // Loop through store data
          for (var i = 0; i < data.length; i++) {
            // Loop through fields keys arguments
            for (var j = 0; j < attrs.length; j++) {
              var attr = attrs[j];
              // Use only string arguments as valid
              if (typeof attr == "string") {
                // Check result item existance
                if (!listedData[i]) {
                  var item = {};
                  item[store.idProperty] = data[i][store.idProperty];
                  item[attr] = data[i][attr];
                  // Create new item
                  listedData.push(item);
                } else {
                  // Declare a new item property
                  listedData[i][attr] = data[i][attr];
                }
              }
            }
          }
        } else {
          // Loop through store data
          for (var key in data) {
            // Loop through fields keys arguments
            for (var i = 0; i < attrs.length; i++) {
              var attr = attrs[i];
              // Use only string arguments as valid
              if (typeof attr == "string") {
                // Check result item existance
                if (!listedData[key]) {
                  // Create new item
                  listedData[key] = {};
                  listedData[key][store.idProperty] = data[key][store.idProperty];
                  listedData[key][attr] = data[key][attr];
                } else {
                  // Declare a new item property
                  listedData[key][attr] = data[key][attr];
                }
              }
            }
          }
        }
      } else {
        listedData = data;
      }
      store.rootData = store.data = new Result(listedData, store, store.data.__sorted);
      return listedData;
    }
530822
function (item) {
        // do not proceed on empty param, but empty strings are in fact valid.
        // eslint-disable-next-line lodash/prefer-is-nil
        if (_.isNull(item) || _.isUndefined(item) || _.isNaN(item)) { return; }

        // create new instance of the item based on the type specified if it is not already
        this.insert((item.constructor === this.Type) ? item :
            // if the property has a create static function, use it.
            // eslint-disable-next-line prefer-spread
            (_.has(this.Type, 'create') ? this.Type.create.apply(this.Type, arguments) : new this.Type(item)));
    }
222449
function (item) {
        let result = {};
        if (item === __private.local) {
            Object.keys(__private.local).forEach(function (e) {
                result = Object.assign(result, _getLocalItems(__private.local[e]));
            });
            return result;
        }
        switch (item.type) {
            case Type.STRING:
            case Type.NUMBER:
            case Type.BOOLEAN:
            case Type.UNDEFINED:
                result[item.key] = item.timestamp;
                break;
            case Type.ARRAY:
            case Type.OBJECT:
                item.value.forEach(function (e) {
                    result = Object.assign(result, _getLocalItems(e));
                });
                break;
            default:
                _logUnknownType(item.type);
        }
        return result;
    }
108068
function setItem$2(key, value, callback) {
    var self = this;

    key = normalizeKey(key);

    var promise = self.ready().then(function () {
        // Convert undefined values to null.
        // https://github.com/mozilla/localForage/pull/42
        if (value === undefined) {
            value = null;
        }

        // Save the original value to pass to the callback.
        var originalValue = value;

        return new Promise$1(function (resolve, reject) {
            var dbInfo = self._dbInfo;
            dbInfo.serializer.serialize(value, function (value, error) {
                if (error) {
                    reject(error);
                } else {
                    try {
                        localStorage.setItem(dbInfo.keyPrefix + key, value);
                        resolve(originalValue);
                    } catch (e) {
                        // localStorage capacity exceeded.
                        // TODO: Make this a specific error/event.
                        if (e.name === 'QuotaExceededError' || e.name === 'NS_ERROR_DOM_QUOTA_REACHED') {
                            reject(e);
                        }
                        reject(e);
                    }
                }
            });
        });
    });

    executeCallback(promise, callback);
    return promise;
}
400941
function createStore(descriptor) {
    var store = new pastore_1.XStore(descriptor.initState);
    store.name = descriptor.name;
    if (descriptor.actions)
        store.actions = descriptor.actions;
    if (descriptor.middlewares)
        store.actionMiddlewares = descriptor.middlewares;
    return store;
}
1152563
@Override
    public void save(T item) {
        Serializable idValue = getOrGenerateIdValue(item);
        save(idValue, item);
    }
269623
public function save(array $data, $locale, $userId = null, $item = null, $itemStatusId = null)
    {
        $itemEntity = $this->itemFactory->createEntity();
        $isNewItem = !$item;

        // check required data
        if ($isNewItem) {
            $this->checkRequiredData($data, true);
            $item = $this->itemFactory->createApiEntity($this->itemFactory->createEntity(), $locale);
        }

        if ($item instanceof ItemInterface) {
            $item = $this->itemFactory->createApiEntity($item, $locale);
        }

        // get user
        $user = $userId ? $this->userRepository->findUserById($userId) : null;

        $contact = null;
        $account = null;
        if ($user) {
            $contact = $user->getContact();
            $account = $contact->getMainAccount();
        }

        // set item data
        $item->setQuantity($this->getProperty($data, 'quantity', null));
        $item->setUseProductsPrice($this->getProperty($data, 'useProductsPrice', true));
        $this->setDate(
            $data,
            'deliveryDate',
            $item->getDeliveryDate(),
            array($item, 'setDeliveryDate')
        );

        // terms of delivery
        $product = null;
        if ($isNewItem) {
            $productData = $this->getProperty($data, 'product');
            if ($productData) {
                // get product and set Product's data to item
                $product = $this->setItemByProductData($productData, $item, $locale);
            }
        }

        // if product is not set, set data manually
        if (!$product) {
            if ($isNewItem) {
                $item->setUseProductsPrice(false);
            }
            $item->setName($this->getProperty($data, 'name', $item->getName()));
            // TODO: set supplier based on if its a string  or object (fetch account and set it to setSupplier)
            $item->setTax($this->getProperty($data, 'tax', $item->getTax()));
            $item->setNumber($this->getProperty($data, 'number', $item->getNumber()));
            $item->setDescription($this->getProperty($data, 'description', $item->getDescription()));
            $item->setQuantityUnit($this->getProperty($data, 'quantityUnit', $item->getQuantityUnit()));
        }

        if (method_exists($item, 'getSupplierName')) {
            $item->setSupplierName($this->getProperty($data, 'supplierName', $item->getSupplierName()));
        }

        // update prices
        $this->updatePrices($item, $data);

        $item->setDiscount($this->getProperty($data, 'discount', $item->getDiscount()));

        // set delivery-address for item
        if (isset($data['deliveryAddress'])) {
            $this->setItemDeliveryAddress($data['deliveryAddress'], $item, $contact, $account);
        }

        // create new item
        if ($item->getId() == null) {
            $item->setCreated(new DateTime());
            $item->setCreator($user);
            $this->em->persist($item->getEntity());

            if (!$itemStatusId = null) {
                $itemStatusId = $itemEntity::STATUS_CREATED;
            }
        }

        if ($itemStatusId) {
            $this->addStatus($item, $itemStatusId);
        }

        // handle attributes
        $this->processAttributes($data, $item, $locale);

        $item->setChanged(new DateTime());
        $item->setChanger($user);

        return $item;
    }
298474
function store(key, info) {
        var items = nodes[key];
        if (!items) {
            items = nodes[key] = [];
        }
        items.push(info);
    }
359965
def create_store():
    
    new_storage = _proxy('store')
    _state.store = type('store', (object,), {})
    new_storage.store = dict()
    return new_storage.store