New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

slippers

Package Overview
Dependencies
Maintainers
0
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

slippers

Confortable like wearing slippers.

latest
Source
npmnpm
Version
0.2.1
Version published
Maintainers
0
Created
Source

Slippers

Nodejs with slippers, confortable like wearing slippers, but INFORMAL, JUST FOR FUN.

Slippers is inspired by streamlinejs and Jscex. If you really need this feature, please try streamlinejs or Jscex

You just need end with a _ in the async call, you can got the magic.

Usage

run npm install slippers

edit test.js

var data = fs.readFile(filename, 'utf-8', _);
console.log(data);

run slippers test.js

var cb=global.cb || function(e){console.log(e)};fs.readFile(filename, 'utf-8', function(err,data ){if(err)return cb(err);
console.log(data);
});

See demo.js and demo.out.js for more information.

function define

function foo(args, _){
  return bar1, bar2;
}
// compile to =>
function foo(args, callback){
  callback(null, bar1, bar2);
}

parallel

var bar1, bar2, bar3, bar4;
parallel{
  bar1, bar2 = foo(args, _);
  bar3, bar4 = foo(args, _);
}
console.log(bar1 + bar2 + bar3 + bar4);
// compile to =>
var bar1, bar2, bar3, bar4;
(function(cb){
  function update(){
    if(--count==0) cb()
  }

  var count=2;

  foo(args, function(err, __bar1, __bar2){
    if(err)return cb(err);
    bar1=__bar1, bar2=__bar2;
    update();
  });

  foo(args, function(err, __bar3, __bar4){
    if(err)return cb(err);
    bar3=__bar3, bar4=__bar4;
    update();
  });

})(function(err){

  if(err)return cb(err);
  console.log(bar1 + bar2 + bar3 + bar4);

});

You can use //} for manually end up the async block if you want.

Map line-num for debug?

No need, the compiled js keep the same line number with source.

Note

  • It is not a really compiler, so you must pay attention to code style.
  • {} must be pairs, even in block comments.
  • close block in a single line without expression. e.g. foo.bar();} is wrong
  • close ONE block in ONE line, e.g. });}); is wrong , }} is wrong.
  • You should not use slippers in projects, the syntax are not stable yet, it's just an experiment for now.
  • It's welcome to let me know your idea on issue pages.

FAQs

Package last updated on 10 May 2011

Did you know?

Socket

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.

Install

Related posts