module Dependabot::NpmAndYarn::Helpers

Public Class Methods

npm_version(lockfile_content) click to toggle source
# File lib/dependabot/npm_and_yarn/helpers.rb, line 6
def self.npm_version(lockfile_content)
  return "npm7" unless lockfile_content
  return "npm7" if JSON.parse(lockfile_content)["lockfileVersion"] == 2

  "npm6"
rescue JSON::ParserError
  "npm6"
end