Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed generation step. Require directly from caniuse-db #47

Merged
merged 2 commits into from
Sep 5, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions generator.js

This file was deleted.

5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
"license": "MIT",
"main": "dist/index.js",
"files": [
"dist",
"generator.js"
"dist"
],
"dependencies": {
"browserslist": "^1.0.1",
Expand All @@ -36,9 +35,7 @@
"build": "babel src --out-dir dist",
"lint": "jshint src",
"prepublish": "npm run build",
"pretest": "babel-node src/generate-features.js",
"test": "npm run lint && babel-tape-runner test/*.js | tap-spec",
"postinstall": "node generator.js",
"release": "npmpub"
}
}
13 changes: 0 additions & 13 deletions src/generate-features.js

This file was deleted.

12 changes: 8 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ import memoize from "lodash.memoize"
import browserslist from "browserslist"

import {contains, parseCaniuseData, cleanBrowsersList} from "./utils"
import features from "../features"
import db from "caniuse-db/data.json"

const features = db.data

const featuresList = Object.keys(features)


var browsers
function setBrowserScope(browserList) {
browsers = cleanBrowsersList(browserList)
Expand All @@ -21,7 +25,7 @@ var parse = memoize(parseCaniuseData, function(feature, browsers) {
function getSupport(query) {
let feature
try {
feature = features[query]()
feature = features[query]
} catch(e) {
let res = find(query)
if (res.length === 1) return getSupport(res[0])
Expand All @@ -33,11 +37,11 @@ function getSupport(query) {
function isSupported(feature, browsers) {
let data
try {
data = features[feature]()
data = features[feature]
} catch(e) {
let res = find(feature)
if (res.length === 1) {
data = features[res[0]]()
data = features[res[0]]
} else {
throw new ReferenceError(`Please provide a proper feature name. Cannot find ${feature}`)
}
Expand Down
13 changes: 0 additions & 13 deletions test/generate-features.js

This file was deleted.