js Map 工具类 MapUtil

阅读更多

var MapUtil = {}

 

MapUtil.keyset = function(m){

var result = new Array();

for(var i in m){

result.push(i);

}

return result;

}

 

MapUtil.values = function(m){

var result = new Array();

for(var i in m){

result.push(m[i]);

}

return result;

}

 

MapUtil.valuesSet = function(m){

var result = {};

for(var i in m){

var tmp = m[i];

result[tmp] = 1;

}

return MapUtil.keyset(result);

}

  • MapUtil.zip (317 Bytes)
  • 下载次数: 5

你可能感兴趣的:(js,array,map,keyset)