{"size": 450, "ext": "js", "max_stars_repo_path": "examples/hacker-news/auth/create_strategy.js", "max_stars_repo_name": "artemjackson/resolve", "max_stars_repo_stars_event_min_datetime": "2020-02-20T06:43:48.000Z", "max_stars_repo_stars_event_max_datetime": "2020-05-03T20:02:29.000Z", "max_issues_repo_path": "examples/hacker-news/auth/create_strategy.js", "max_issues_repo_name": "artemjackson/resolve", "max_issues_repo_issues_event_min_datetime": "2020-02-18T16:47:48.000Z", "max_issues_repo_issues_event_max_datetime": "2021-05-10T15:14:31.000Z", "max_forks_repo_path": "examples/hacker-news/auth/create_strategy.js", "max_forks_repo_name": "artemjackson/resolve", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 2, "max_issues_count": 5, "max_forks_count": null, "avg_line_length": 26.4705882353, "max_line_length": 79, "alphanum_fraction": 0.6977777778}
import { Strategy as StrategyFactory } from 'passport-local'

const createStrategy = options => ({
  factory: StrategyFactory,
  options: {
    failureRedirect: error =>
      `/error?text=${encodeURIComponent(error.message)}`,
    errorRedirect: error => `/error?text=${encodeURIComponent(error.message)}`,
    usernameField: 'username',
    passwordField: 'username',
    successRedirect: null,
    ...options
  }
})

export default createStrategy
