3 ms·
Here are things that I've added in Sciter's script (https://sciter.com https://sciter.com): 'like' operator that is used as a match if( obj like /[A-Z]/g
by c-smile 8y ago
Here are things that I've added in Sciter's script (https://sciter.com https://sciter.com):
'like' operator that is used as a match
if( obj like /[A-Z]/g ) … // "string".match
if( obj like {name:String} ) … // obj has name string field
if( obj like [String,Object] ) … // obj is an array of at least two elements, string and object.
extended switch() :
switch(obj) {
case 1: … // standard JS
like /[A-Z]/g: … // RegExp, Object, Array match
instanceof cls: … // obj instanceof cls
in [1,2,3]: … // obj
}
- c-smile 8y agoObject literals to allow `-` in identifiers, so these are valid constructs: var style = { font-size: 10px, border-width: 1em } New built-in value types: Length, Duration, Angle, Color. So these are valid constructs: this.timer(200ms, function() {...}); element.style.width = 1em; var c = rgb(128,128,0); assert c.r == 128; var (h,s,v) = c.toHSV(); Float and Integer are distinct types as these are different entities indeed.
- c-smile 8y ago'in' operator follows `contain` idiom for collections. 1 in [1,2,3] -> true "foo" in {foo:1,bar:2} -> true Real namespaces: namespace Foo { function a() { return "a"; } function b() { return a(); } // Foo.a() call } namespace Key { // enums const ENTER = 13; const SPACE = 32; } if( evt.keyCode == Key.ENTER ) ...
- c-smile 8y agoby value and by reference comparison: [1,2,3] == [1,2,3] -> true in Sciter, false in JS [1,2,3] === [1,2,3] -> false in Sciter and in JS {a:1} == {a:1} -> true in Sciter, false in JS {a:1} === {a:1} -> false in Sciter and in JS