Oliver Steele 씨가 JCON 이라는 이름의 JavaScript를 확인할 수 있는 gem(Ruby 언어의 모듈)을 만들었습니다. JSON 값이 ECMAScript 4 규칙에 맞는지를 확인합니다(예. { x:int, y:string }( 3, "foo" ) ).
또 다른 JSON 소식입니다. 새로운 ECMAScript 표준에서는 다음 단어들이 더 이상 예약어가 아니라고 합니다.
그리고 Douglas Crockford 씨가 저 단어들을 예약한 브라우저가 없으므로 jsLint 에서도 예약을 해제하겠다라고 밝혔습니다.
from Conform your JSON to ECMAScript4 with JCON
[code:ruby]
type = JCON::parse "[string, int]"
type = JCON::parse "[string, int]"
type.contains?([‘a’, 1]) # => true
type.contains?([‘a’, ‘b’]) # => false
type.contains?([‘a’, 1, 2]) # => true
// via RSpec
[1, ‘xyzzy’].should conform_to_js(‘[int, string]’)
[1, 2, ‘xyzzy’].should_not conform_to_js(‘[int, string]’) # 2 isn’t a string
{:x => 1}.should conform_to_js(‘{x: int}’)
// with JavaScript Fu
# this will succeed if e.g. response contains a script tag that includes
# fn("id", {x:1, y:2}, true)
response.should call_js(‘fn’) do |args|
args[0].should conform_to_js(‘string’)
args[1].should conform_to_js(‘{x:int, y:int}’)
args[2].should conform_to_js(‘boolean’)
# or:
args.should conform_to_js(‘[string, {x:int, y:int}, boolean]’)
end
또 다른 JSON 소식입니다. 새로운 ECMAScript 표준에서는 다음 단어들이 더 이상 예약어가 아니라고 합니다.
abstract boolean byte char double final float implements int interface
long native package private protected public short static synchronized
throws transient volatile
from Conform your JSON to ECMAScript4 with JCON
'[IT] Web Tech' 카테고리의 다른 글
JSONVid : 순수 JavaScript 동영상 플레이어 (0) | 2008.04.23 |
---|---|
Yahoo! BrowserPlus : 소문은 사실이었다 (0) | 2008.04.23 |
The Twubble with Bob Lee (0) | 2008.04.22 |
100줄짜리 Ajax Wrapper (0) | 2008.04.22 |
JCON으로 JSON의 ECMAScript4 적합성 판별 (0) | 2008.04.22 |
SEO 래퍼 (0) | 2008.04.22 |
JavaScript 개발자를 위한 Adobe AIR 포켓가이드 (2) | 2008.04.22 |
IE에서 unload 핸들러가 잘 사용된다고 확신하세요? (2) | 2008.04.22 |
JS를 사용할 수 없을 때도 쓸 수 있는 스포일러 차단기 (0) | 2008.04.21 |
댓글을 달아 주세요