source: frontend/node_modules/underscore/amd/toArray.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 656 bytes
Line 
1define(['./isArray', './_setup', './isString', './_isArrayLike', './map', './identity', './values'], function (isArray, _setup, isString, _isArrayLike, map, identity, values) {
2
3 // Safely create a real, live array from anything iterable.
4 var reStrSymbol = /[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g;
5 function toArray(obj) {
6 if (!obj) return [];
7 if (isArray(obj)) return _setup.slice.call(obj);
8 if (isString(obj)) {
9 // Keep surrogate pair characters together.
10 return obj.match(reStrSymbol);
11 }
12 if (_isArrayLike(obj)) return map(obj, identity);
13 return values(obj);
14 }
15
16 return toArray;
17
18});
Note: See TracBrowser for help on using the repository browser.