我知道之前有人问过它,但是depcheck似乎根本不适合我。除了必须为“仅配置”库(如 babel、eslint 等)配置它之外,它还给了我大量的错误警报。
如果你接到这样的任务,你的方法是什么?你有什么最佳实践可以推荐给我吗?
谢谢!
我今天意识到,我无法再在 Chrome 中编辑或创建新的 cookie。目前它可以在 Firefox 和 Safari 中运行。
我转到“开发人员工具”>“应用程序”>“Cookie”并尝试更改它们的值。该线变成红色,如果我点击出去,它会重置为原来的样子。
我必须在某个地方停用某些东西吗?
许多教程都告诉您在 userSchema 页面中使用 bycrypt。保存新用户后,它会附带加密的密码。伟大的。然而,我认为,当我使用某些内容编辑用户时,它也会重新哈希密码,从而导致无法登录。您能给我建议一个解决方案吗?谢谢。
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const bcrypt = require('bcrypt-nodejs');
const eventSchema = require('./eventSchema');
const userSchema = new Schema({
email: { type: String, unique: true, lowercase: true },
password: String,
eventList: [{
type: Schema.ObjectId,
ref: "event"
}],
administrator: { type: Boolean, default: false }
});
// On Save Hook, encrypt password
// Before saving a model, run this function
userSchema.pre('save', function(next) {
// get access to the user model
const user = this;
// …Run Code Online (Sandbox Code Playgroud) 在本地节点 10.15.13 上,new Date('01.01.2017')结果为"2016-12-31T23:00:00.000Z"。
然而在浏览器中,或者在我构建的docker镜像(相同的节点版本)中,它的结果是“Sun Jan 01 2017 00:00:00 GMT+0100(中欧标准时间)”。
是什么导致了这种差异以及如何在单元测试中修复它?