-
Notifications
You must be signed in to change notification settings - Fork 0
Mangler.getCloner()
Robert Biro edited this page Sep 5, 2016
·
5 revisions
Returns the cloning function for an object.
Mangler.getCloner(object)
object
An object to get the cloning function for. Alternatively you can pass a type name string, as returned by Mangler.getType().
Returns a cloning function in the form of function(object), or null if object is not clonable.
Gets a cloning function for any object that's supported by Mangler.js:
var a = Mangler([1, 2, 3]);
var func = Mangler.getCloner(a);
var cloned_a = func ? func(a) : a;
The above example is identical to:
var a = Mangler([1, 2, 3]);
var cloned_a = Mangler.clone(a);
To check whether an object type is clonable:
var isClonable = !!Mangler.getCloner('Date'); // true
For supported object types and to add support for other objects, see Mangler.registerType().
Mangler.js - JavaScript object processing library
Copyright (C) 2014-2016
Project: http://codebin.co.uk/projects/mangler-js/
GitHub: https://github.com/DarthJDG/Mangler.js
- Home
- About the documentation
- Getting started
- Searching and querying
- Transforming data
- Advanced