OptimalBits / node_acl

Access control lists for node applications
2.62k stars 369 forks source link

ES6 syntax #240

Open ghost opened 7 years ago

ghost commented 7 years ago

How would you rephrase it in ES6 syntax ?

var acl = require('acl'); acl = new acl(new acl.mongodbBackend(dbInstance, prefix))

I tried let acl = require('acl'); acl = new acl(new acl.mongodbBackend(conn.db,'acl_'))

currently I get 2 errors A constructor name should not start with a lowercase letter new-cap

juanpaco commented 7 years ago

| A constructor name should not start with a lowercase letter new-cap

That sounds like a lint error. If you capitalize the variable you assign it to, I suspect that would go away.

let Acl = require('acl');

stephen-last commented 7 years ago

I'm using JavaScript Standard Style and Atom.

This is a linter warning... I get the same:

A constructor name should not start with a lowercase letter.

It's referring to both acl and acl.mongodbBackend(), which are a constructors.

You can change acl to Acl or ACL and that warning goes away, but I don't think you can do anything about mongodbBackend(), it comes from the library.

freeall commented 5 years ago

It's annoying, but this thing works:

const Acl = require('acl')
const MongodbBackend = Acl.mongodbBackend

const acl = new Acl(new MonbodbBackend())