Pot.Struct.firstKey

{*} Pot.Struct.firstKey ({Object|Array|*} o)

Pot.js で利用可能。 PotLite.js では利用できません。

引数 o の要素のうち最初のキー名を取得します。

引数 o の各要素のうち最初のキー名を取得し返します。

Pot.globalize() が適応されている場合、Pot.firstKey() が firstKey() で実行できます。

o の要素のうち最初のキー名が返ります。

Pot.debug(Pot.firstKey({a: 1, b: 2, c: 3}));   // 'a'
Pot.debug(Pot.firstKey({}));                   // undefined
Pot.debug(Pot.firstKey([1, 2, 3, 4, 5]));      // 0
Pot.debug(Pot.firstKey([]));                   // undefined
Pot.debug(Pot.firstKey({a: 'foo', b: 'bar'})); // 'a'
Pot.debug(Pot.firstKey(new Array(100)));       // undefined
Pot.debug(Pot.firstKey(null));                 // undefined
Pot.debug(Pot.firstKey((void 0)));             // undefined
Pot.debug(Pot.firstKey('hoge'));               // 0
Pot.debug(Pot.firstKey(''));                   // null
Pot.debug(Pot.firstKey(new String('hoge')));   // 0
Pot.debug(Pot.firstKey(123));                  // 0
Pot.debug(Pot.firstKey(0));                    // 0
Pot.debug(Pot.firstKey(-123));                 // 0