Skip to content

Commit

Permalink
style: Fix example linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
notheotherben committed Mar 11, 2016
1 parent 4737e70 commit ea5d47b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
8 changes: 4 additions & 4 deletions example/IntelliSense.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/// <reference path="../iridium.d.ts" />
import Iridium = require('iridium');
import Iridium = require("iridium");

interface UserDoc {
_id?: string;
Expand Down Expand Up @@ -63,19 +63,19 @@ class MyDB extends Iridium.Core {
var db = new MyDB("mongodb://localhost/test");

db.connect().then(function () {
db.Users.insert({ fullname: 'test', username: 'test', passwordHash: 'test', email: 'test@test.com', dateOfBirth: new Date() }).then(function (user) {
db.Users.insert({ fullname: "test", username: "test", passwordHash: "test", email: "test@test.com", dateOfBirth: new Date() }).then(function (user) {
user.fullname;
user.dateOfBirth.getTime();
});

db.Users.insert([{ fullname: 'test', username: 'test', passwordHash: 'test', email: 'test@test.com', dateOfBirth: new Date() }]).then(function (users) {
db.Users.insert([{ fullname: "test", username: "test", passwordHash: "test", email: "test@test.com", dateOfBirth: new Date() }]).then(function (users) {
users[0].fullname;
});

db.Users.findOne().then(function (instance) {
instance.save().then(function (i) {
i.remove().then(function (i) {
i.username = 'test';
i.username = "test";
return i.save();
});
});
Expand Down
2 changes: 1 addition & 1 deletion example/ModelHookPlugin.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Iridium = require('../index');
import Iridium = require("../index");

export = LowercaseCollectionsPlugin;

Expand Down
24 changes: 12 additions & 12 deletions example/UserModel.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/// <reference path="../iridium.d.ts" />
/// <reference path="../_references.d.ts" />

import _ = require('lodash');
import Promise = require('bluebird');
import * as Iridium from 'iridium';
import {Index, Property} from 'iridium';
import _ = require("lodash");
import Promise = require("bluebird");
import * as Iridium from "iridium";
import {Index, Property} from "iridium";

var settings: any = {};

Expand Down Expand Up @@ -43,10 +43,10 @@ export interface UserDocument {
last_seen: Date;
}

@Iridium.Collection('user')
@Iridium.Collection("user")
@Index({ email: 1 }, { unique: true })
@Index({ sessions: 1 }, { sparse: true })
@Index({ 'skill.xp': -1 }, { background: true })
@Index({ "skill.xp": -1 }, { background: true })
export class User extends Iridium.Instance<UserDocument, User> implements UserDocument {
@Iridium.Property(/^[a-z][a-z0-9_]{7,}$/) _id: string;
get username() {
Expand Down Expand Up @@ -119,9 +119,9 @@ export class User extends Iridium.Instance<UserDocument, User> implements UserDo
static onCreating(user: UserDocument) {
var passwordTest = /(?=^.{8,}$)((?=.*\d)(?=.*[A-Z])(?=.*[a-z])|(?=.*\d)(?=.*[^A-Za-z0-9])(?=.*[a-z])|(?=.*[^A-Za-z0-9])(?=.*[A-Z])(?=.*[a-z])|(?=.*\d)(?=.*[A-Z])(?=.*[^A-Za-z0-9]))^.*/;

if (!passwordTest.test(user.password || '')) return Promise.reject(new Error('Password didn\'t meet the minimum safe password requirements. Passwords should be at least 8 characters long, and contain at least 3 of the following categories: lowercase letters, uppercase letters, numbers, characters'));
if (!passwordTest.test(user.password || "')) return Promise.reject(new Error("Password didn\"t meet the minimum safe password requirements. Passwords should be at least 8 characters long, and contain at least 3 of the following categories: lowercase letters, uppercase letters, numbers, characters"));

user.password = require('crypto').createHash('sha512').update(settings.security.salt).update(user.password).digest('hex');
user.password = require("crypto").createHash("sha512").update(settings.security.salt).update(user.password).digest("hex");

_.defaults(user, {
type: "Player",
Expand Down Expand Up @@ -173,9 +173,9 @@ export class User extends Iridium.Instance<UserDocument, User> implements UserDo
/// <param name="callback" type="Function">A function to be called once the user's password has been updated</param>

var passwordTest = /(?=^.{8,}$)((?=.*\d)(?=.*[A-Z])(?=.*[a-z])|(?=.*\d)(?=.*[^A-Za-z0-9])(?=.*[a-z])|(?=.*[^A-Za-z0-9])(?=.*[A-Z])(?=.*[a-z])|(?=.*\d)(?=.*[A-Z])(?=.*[^A-Za-z0-9]))^.*/;
if (!passwordTest.test(newPassword || '')) return callback(new Error('Password didn\'t meet the minimum safe password requirements. Passwords should be at least 8 characters long, and contain at least 3 of the following categories: lowercase letters, uppercase letters, numbers, characters'));
if (!passwordTest.test(newPassword || "")) return callback(new Error("Password didn\"t meet the minimum safe password requirements. Passwords should be at least 8 characters long, and contain at least 3 of the following categories: lowercase letters, uppercase letters, numbers, characters"));

var hashed = require('crypto').createHash('sha512').update(settings.security.salt).update(newPassword).digest('hex');
var hashed = require("crypto").createHash("sha512").update(settings.security.salt).update(newPassword).digest("hex");
this.password = hashed;
this.save(callback);
}
Expand All @@ -184,14 +184,14 @@ export class User extends Iridium.Instance<UserDocument, User> implements UserDo
/// <param name="password" type="String">The password to validate against the user's password hash.</param>
/// <returns type="Boolean"/>

var hashed = require('crypto').createHash('sha512').update(settings.security.salt).update(password).digest('hex');
var hashed = require("crypto").createHash("sha512").update(settings.security.salt).update(password).digest("hex");
return hashed == this.password;
}
addFriend(friend: string, callback: (err?: Error, user?: User) => void) {
this.save({ $push: { friends: friend } }, callback);
}
updateLevel() {
/// <summary>Update's the user's current level based on the amount of XP they have. Doesn't save the user instance.</summary>
/// <summary>Update"s the user"s current level based on the amount of XP they have. Doesn't save the user instance.</summary>

// Amount of XP required per level starts at 1200, doubles for each consecutive level
// tf. XP_n = XP_nm1 + 1200 * 2^n
Expand Down
4 changes: 2 additions & 2 deletions example/ValidationPlugin.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference path="../typings/skmatc/skmatc.d.ts"/>
import Iridium = require('../index');
import Skmatc = require('skmatc');
import Iridium = require("../index");
import Skmatc = require("skmatc");

export = StringCaseValidationPlugin;

Expand Down

0 comments on commit ea5d47b

Please sign in to comment.