GithubHelp home page GithubHelp logo

tomayac / fugu-api-data Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 0.0 173 KB

This repo contains raw data for Project Fugu 🐡 APIs.

Home Page: https://github.com/tomayac/fugu-api-data

License: Apache License 2.0

JavaScript 100.00%
fugu project-fugu capabilities web-capabilities

fugu-api-data's Introduction

Project Fugu 🐡 API Data

This repo contains raw data for Project Fugu 🐡 APIs. The data is available in two formats: pattern.js and pattern.mjs.

Data origin

The raw data in this repository comes from a Google spreadsheet that is published as a JSON file. The index.js script fetches this data, prettifies it, and saves it locally in a module and in a no-module variant.

Obtaining fresh data

You can trigger the data fetch process described above by running the start script:

npm start

Data usage

  • For the module version:

    import patterns from './patterns.mjs';
    
    console.log(patterns.WebBluetooth);
    /*
    {
      regEx: /navigator\.bluetooth\.requestDevice\s*\(/g,
      where: 'JavaScript',
      supported: (async () => 'bluetooth' in navigator)(),
      featureDetection: `(async () => 'bluetooth' in navigator)()`,
    }
    */
  • For the no-module version (for example to use it in a service worker):

    importScripts('patterns.js');
    console.log(patterns.WebBluetooth);
    /*
    {
      regEx: /navigator\.bluetooth\.requestDevice\s*\(/g,
      where: 'JavaScript',
      supported: (async () => 'bluetooth' in navigator)(),
      featureDetection: `(async () => 'bluetooth' in navigator)()`,
    }
    */

Data format

Each API is represented as an object with the following properties:

  • regEx: A regular expression that you can use to detect the API of interest in source code when you do static source code analysis.
  • where: The resource type where the regular expression needs to match in order to be valid. Either "JavaScript" or "Web App Manifest".
  • supported: A function that returns a promise that resolves with true, false, or undefined, dependent on whether the API is supported or not (undefined means no feature detection method exists).
  • featureDetection: The source code of the feature detection method, so you can use it in an eval() for example.

Depending projects

This data is used in the following projects:

License

Apache 2.0.

fugu-api-data's People

Contributors

tomayac avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

fugu-api-data's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.