-
Notifications
You must be signed in to change notification settings - Fork 0
Mangler.getIterator()
Robert Biro edited this page Sep 21, 2016
·
5 revisions
Returns the iterator function for an object.
Mangler.getIterator(object)| Parameter | Type | Default | Description |
|---|---|---|---|
| object | Instance | An object instance or its contructor to get the iterator function for. |
Returns an iterator function in the form of function(object, callback), or null if object is non-iterable.
Gets an iterator function for any object that's supported by Mangler.js:
a = Mangler([1, 2, 3]);
each = Mangler.getIterator(a);
if(each) each(a, function(key, value) { /* Do something */ });The above example is identical to:
a = Mangler([1, 2, 3]);
Mangler.each(a, function(key, value) { /* Do something */ });To check whether an object type is iterable:
isIterable = !!Mangler.getIterator(Date); // falseFor 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