Skip to content

Repository files navigation

JScriptExtender

Use Array#filter, map, reduce, String#trim, JSON.parse/stringify
...and more lovely functions on legacy JScript!

Overview

JScriptExtender is an extension library for Microsoft JScript.
This library provides following functions to lagacy JScript(e.g. v5.8 on Windows7).

Usage

Include dist/JScriptExtender.js in your .wsh script.

<job>
<!-- include at here -->
<scriptlanguage="JavaScript"src="dist/JScriptExtender.js"></script><scriptlanguage="JavaScript">
function test() {// Get arguments from command line// e.g. if you call script with args "arg0 arg1 /arg2:123"varargs=Arguments.Get();// => {'0': 'arg0', '1': 'arg1', 'arg2': '123'}// Array's cool methodsvarnum=[1,2,3,4,5].filter(function(v){return(v%2===0);}).map(function(v){returnv*v;}).reduce(function(prev,current,i,ar){returnprev+current;});WScript.Echo(num);// => 20// Generate JSON stringvarstr=JSON.stringify({'Hello': 123});WScript.Echo(str);// => '{"Hello":123}'// Load ini file into object(hash)variniReader=newIni('hoge.ini');variniObj=iniReader.Load();}
WScript.Quit(test());
</script></job>

API Document

See the url below.
(Only for additional functions, except es5-shim and JSON3)
http://poppycocker.github.io/JScriptExtender/doc/index.html

About

No description, website, or topics provided.

Resources

Stars

10 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages