Skip to content

Named parameters object? #18

@jwulf

Description

@jwulf

What about making the function parameters a named object?

So instead of:

conn.query("db-name", 
   "select distinct * where { ?s ?p ?o } limit 5", 
   null, 5, 0, function (data) {});

you get:

conn.query('db-name', {query: 'select distinct * where { ?s ?p ?o} limit 5',
   baseURI: null,
   limit: 5,
   offset: 0}, function cb(data){});

which is self-documenting, and collapses to:

conn.query('db-name', {query: 'select distinct * where { ?s ?p ?o} limit 5',
                  limit: 5}, function cb(data){});

since baseURI and offset are not required, they don't need to be set.

Code samples can look like this:

var query = {},
      query.query = "select distinct * where { ?s ?p ?o} limit 5",
      query.limit = 5;

conn.query("db-name", query, function cb(data) {});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions