@hint/utils
hint tools
Last updated 18 days ago by johnatms .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @hint/utils 
SYNC missed versions from official npm registry.

Utils (@hint/utils)

Set of tools for hint.

Installation

To install the package, you need to run:

npm install @hint/utils

Tools

The tools included in this package are:

  • asyncTry: Wrap an async function, returning null if the evaluation throws and exception.
  • get-hints-from-extends: Returns all hints in a configuration, including hints inside the extended configurations.

appInsights

  • isEnabled: Check if Application Insights is enabled or not.
  • enable: Enable Application Insight.
  • disable: Disable Application Insights for the future.
  • sendPendingData: Send pending data to Application Insights.
  • trackException: Track an exception in Application Insights.
  • trackEvent: Track an event in Application Insights.
  • getClient: Return the Application Insights client.
  • isConfigured: Check if Application Insights is configured.

compat

  • getFriendlyName: Get the friendly name of a browser from an id.
  • getUnsupported: Get browsers without support for CSS or HTML features.
  • getUnsupportedDetails: Get browsers without support with details on when support was added or removed.
  • isSupported: Query MDN for support of CSS or HTML features.

configStore

  • get: Get the value from the config store.
  • set: Set a value in the config store.

contentType

  • determineMediaTypeBasedOnFileExtension: Get a mime-type associated with the specified file extension.
  • determineMediaTypeBasedOnFileName: Get a mime-type associated with the specified filename.
  • determineMediaTypeForScript: Check if the provided mime-type is a recognized mime-type for JavaScript, returning the recommended mime-type if so, null otherwise.
  • getContentTypeData: Try to determine the correct mime-type for a response.
  • getFileExtension: Try to determine a resource's file extension.
  • getType: Returns the group to which the mediaType belongs to. E.g.: image, font, script, css, html, manifest, xml or unknown.
  • isTextMediaType: Check if a mime-type represents a text-based resource.

logger

  • error: Cover for console.error.
  • log: Cover for console.log.
  • warn: Cover for console.warn.

misc

  • askQuestion: Asks a y/n question to the user defaulting to Yes.
  • delay: Convenience wrapper to add a delay using promises.
  • mergeEnvWithOptions: Merges any webhint_ prefixed environment variable available with the given options object.

npm

  • installPackages: Install the given packages.
  • search: Searches all the packages in npm given searchTerm.
  • getOfficialPackages: Get core packages from npm.
  • getUnnoficialPackages: Get external packages from npm.

packages

  • findNodeModulesRoot: Find the node_modules folder where hint is installed as a dependency or returns the hint node_modules folder if not.
  • findPackageRoot: Searches for the first folder that contains the fileToFind going up the tree.
  • isOfficial: Returns if the hint that is going to be created is an official.
  • loadPackage: Returns the package found in the given pathString or an exception if no package is found.
  • hasMultipleResources: Returns true if a hint package is a multi-hint.
  • isFullPackageName: Returns true if the name is a full package name.
  • loadHintPackage: Returns the package hint.
  • loadResource: Returns a resource if it exists.
  • requirePackage: Require a package, compatible with webpack.

Current Tags

  • 7.0.4                                ...           latest (18 days ago)

20 Versions

  • 7.0.4                                ...           18 days ago
  • 7.0.3                                ...           2 months ago
  • 7.0.2                                ...           3 months ago
  • 7.0.1                                ...           6 months ago
  • 7.0.0                                ...           6 months ago
  • 6.1.0                                ...           7 months ago
  • 6.0.0                                ...           8 months ago
  • 5.0.2                                ...           8 months ago
  • 5.0.1                                ...           8 months ago
  • 5.0.0                                ...           9 months ago
  • 4.1.1                                ...           9 months ago
  • 4.1.0                                ...           9 months ago
  • 4.0.0                                ...           10 months ago
  • 3.1.2                                ...           10 months ago
  • 3.1.1                                ...           10 months ago
  • 3.1.0                                ...           10 months ago
  • 3.0.0                                ...           10 months ago
  • 2.1.0                                ...           a year ago
  • 2.0.0                                ...           a year ago
  • 1.0.0                                ...           a year ago
Maintainers (2)
Downloads
Today 0
This Week 1
This Month 1
Last Day 1
Last Week 42
Last Month 343
Dependencies (15)
Dev Dependencies (19)
Dependents (71)

Copyright 2014 - 2016 © taobao.org |