|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
570 bytes
|
| Line | |
|---|
| 1 | 'use strict';
|
|---|
| 2 | var getBuiltIn = require('../internals/get-built-in');
|
|---|
| 3 | var isCallable = require('../internals/is-callable');
|
|---|
| 4 | var isIterable = require('../internals/is-iterable');
|
|---|
| 5 | var isObject = require('../internals/is-object');
|
|---|
| 6 |
|
|---|
| 7 | var Set = getBuiltIn('Set');
|
|---|
| 8 |
|
|---|
| 9 | var isSetLike = function (it) {
|
|---|
| 10 | return isObject(it)
|
|---|
| 11 | && typeof it.size == 'number'
|
|---|
| 12 | && isCallable(it.has)
|
|---|
| 13 | && isCallable(it.keys);
|
|---|
| 14 | };
|
|---|
| 15 |
|
|---|
| 16 | // fallback old -> new set methods proposal arguments
|
|---|
| 17 | module.exports = function (it) {
|
|---|
| 18 | if (isSetLike(it)) return it;
|
|---|
| 19 | return isIterable(it) ? new Set(it) : it;
|
|---|
| 20 | };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.