UNPKG

substance

Version:

Substance is a JavaScript library for web-based content editing. It provides building blocks for realizing custom text editors and web-based publishing systems.

16 lines (14 loc) 291 B
import isObject from './isObject' import isArray from './isArray' function clone(val) { if (isArray(val)) { return val.slice(0) } if (isObject(val)) { return Object.assign({}, val) } // we do not clone primitives // TODO: is that ok? return val } export default clone