@ -1351,30 +1351,31 @@ typeof Set === 'function' && isNative(Set) &&
// Set.prototype.keys
Set . prototype != null && typeof Set . prototype . keys === 'function' && isNative ( Set . prototype . keys ) ;
var setItem , getItem , removeItem , getItemIDs , addRoot , removeRoot , getRootIDs ;
if ( canUseCollections ) {
var itemMap = new Map ( ) ;
var rootIDSet = new Set ( ) ;
var setItem = function ( id , item ) {
setItem = function ( id , item ) {
itemMap . set ( id , item ) ;
} ;
var getItem = function ( id ) {
getItem = function ( id ) {
return itemMap . get ( id ) ;
} ;
var removeItem = function ( id ) {
removeItem = function ( id ) {
itemMap [ 'delete' ] ( id ) ;
} ;
var getItemIDs = function ( ) {
getItemIDs = function ( ) {
return Array . from ( itemMap . keys ( ) ) ;
} ;
var addRoot = function ( id ) {
addRoot = function ( id ) {
rootIDSet . add ( id ) ;
} ;
var removeRoot = function ( id ) {
removeRoot = function ( id ) {
rootIDSet [ 'delete' ] ( id ) ;
} ;
var getRootIDs = function ( ) {
getRootIDs = function ( ) {
return Array . from ( rootIDSet . keys ( ) ) ;
} ;
} else {
@ -1390,31 +1391,31 @@ if (canUseCollections) {
return parseInt ( key . substr ( 1 ) , 10 ) ;
} ;
var setItem = function ( id , item ) {
setItem = function ( id , item ) {
var key = getKeyFromID ( id ) ;
itemByKey [ key ] = item ;
} ;
var getItem = function ( id ) {
getItem = function ( id ) {
var key = getKeyFromID ( id ) ;
return itemByKey [ key ] ;
} ;
var removeItem = function ( id ) {
removeItem = function ( id ) {
var key = getKeyFromID ( id ) ;
delete itemByKey [ key ] ;
} ;
var getItemIDs = function ( ) {
getItemIDs = function ( ) {
return Object . keys ( itemByKey ) . map ( getIDFromKey ) ;
} ;
var addRoot = function ( id ) {
addRoot = function ( id ) {
var key = getKeyFromID ( id ) ;
rootByKey [ key ] = true ;
} ;
var removeRoot = function ( id ) {
removeRoot = function ( id ) {
var key = getKeyFromID ( id ) ;
delete rootByKey [ key ] ;
} ;
var getRootIDs = function ( ) {
getRootIDs = function ( ) {
return Object . keys ( rootByKey ) . map ( getIDFromKey ) ;
} ;
}
@ -3745,4 +3746,4 @@ module.exports = shouldUseNative() ? Object.assign : function (target, source) {
} ;
} , { } ] } , { } , [ 18 ] ) ( 18 )
} ) ;
} ) ;