node_acl icon indicating copy to clipboard operation
node_acl copied to clipboard

ES6 syntax

Open ghost opened this issue 8 years ago • 3 comments

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

ghost avatar May 12 '17 16:05 ghost

| 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');

juanpaco avatar May 18 '17 14:05 juanpaco

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.

stephen-last avatar Aug 15 '17 10:08 stephen-last

It's annoying, but this thing works:

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

const acl = new Acl(new MonbodbBackend())

freeall avatar Sep 10 '19 12:09 freeall