user.js
function checknick(next) {
        if (args.nick) {
          userent.list$({ nick: args.nick }, function(err, users) {
            if (err) return done(err, { ok: false, user: user })
            for (var i = 0; i < users.length; i++) {
              var each = users[i]
              if (each.id !== user.id) {
                return done(null, {
                  ok: false,
                  why: 'nick-exists',
                  nick: args.nick
                })
              }
            }

            next()
          })
          return
        }
        next()
      }
function checknick(next) {
        if (args.nick) {
          userent.list$({ nick: args.nick }, function(err, users) {
            if (err) return done(err, { ok: false, user: user })
            for (var i = 0; i < users.length; i++) {
              var each = users[i]
              if (each.id !== user.id) {
                return done(null, {
                  ok: false,
                  why: 'nick-exists',
                  nick: args.nick
                })
              }
            }

            next()
          })
          return
        }
        next()
      }
function checknick ( next ) { if ( args . nick ) { userent . list$ ( { nick : args . nick } , function ( err , users ) { if ( err ) return done ( err , { ok : false , user : user } ) for ( var i = 0 ; i < users . length ; i ++ ) { var each = users [ i ] if ( each . id !== user . id ) { return done ( null , { ok : false , why : 'nick-exists' , nick : args . nick } ) } } next ( ) } ) return } next ( ) }
unsafe nick unique check, data store should also enforce !!
unsafe nick unique check data store should also enforce !!