Created
June 11, 2010 02:38
-
-
Save mapiondev/433966 to your computer and use it in GitHub Desktop.
[JavaScript] 安全に配列型を取得
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 配列ならそのまま、非配列なら要素1の配列として返す | |
*/ | |
MAPION.lang.Snippets.asArray=function(o){ | |
if(o===null||o===void 0)return []; | |
if(o instanceof Array)return o; | |
else return [o]; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment