Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
一种更优雅的JavaScript异步流程控制方式。
动画排序演示:http://bright.ucdok.com/simple/sort.html
npm install -g bright
npm install bright
新建文件 test.bright
var i = 10
for i >= 0 {
console.log(i)
sleep 500
i--
}
console.log('end')
在命令行下执行以下命令
bright test.bright
新建文件 test_module.bright
// 模块输出test函数,该函数接收一个参数
let exports.test = function (a) {
sleep a
return a
}
新建文件 test.js
// 先载入bright模块,以使用bright的JIT编译器
var bright = require('bright');
// 载入刚才的bright程序
var test_module = require('./test_module');
test_module.test(1000, function (err, ret) {
// 所有bright里面的函数的最后一个参数为回调函数
// 回调函数的第一个参数是出错信息,可以在程序中通过throw来返回
// 第二个参数起为通过return返回的多个值
if (err) console.log(err && err.stack);
console.log(ret);
});
先在HTML页面中加载文件 build/bright.js ,然后在<script type="text/bright"></script>
标签内输入bright代码即可。
<script type="text/bright">
var i = 10
for i >= 0 {
console.log(i)
sleep 500
i--
}
console.log('end')
</script>
参考文件 build/test/test_jit.html
新建文件 test.bright
var i = 10
for i >= 0 {
console.log(i)
sleep 500
i--
}
console.log('end')
使用Bright.js命令行工具来编译程序
bright -i test.bright -o test.js
先在HTML页面中加载Bright的运行时库 build/bright.runtime.js,然后再载入刚才编译的文件__test.js__即可运行。
参考文件 build/test/test_runtime.html
__Bright.js__命令行工具详细使用说明:bright --help
详见这里:https://github.com/leizongmin/js-bright/blob/master/doc/language-specification.md
Copyright (c) 2012 Lei Zongmin(雷宗民) <leizongmin@gmail.com>
http://ucdok.com
The MIT License
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
> the future is bright
The npm package bright receives a total of 2,711 weekly downloads. As such, bright popularity was classified as popular.
We found that bright demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.