Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@skava/modules / ___dist / state-tree / __identifier.js
Size: Mime:
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.autofixTransform = exports.transformWithMagicIdentifier = exports.stringifyClone = void 0;

var _exotic = require("../exotic");

var _identifier = require("../identifier");

// @todo validate - just means mainly no fns?
const stringifyClone = pureJSON => {
  const dead = JSON.stringify(pureJSON);
  const live = JSON.parse(dead);
  return live;
};

exports.stringifyClone = stringifyClone;

const transformWithMagicIdentifier = (snapshot, current = undefined) => {
  const cloned = stringifyClone(snapshot || {});
  cloned.__identifier = (0, _identifier.stateTreeIdentifier)(current || cloned);
  return (0, _exotic.autofixSafe)(cloned);
};

exports.autofixTransform = exports.transformWithMagicIdentifier = transformWithMagicIdentifier;