update
This commit is contained in:
@@ -0,0 +1,91 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [v1.1.0](https://github.com/inspect-js/has-symbols/compare/v1.0.3...v1.1.0) - 2024-12-02
|
||||
|
||||
### Commits
|
||||
|
||||
- [actions] update workflows [`548c0bf`](https://github.com/inspect-js/has-symbols/commit/548c0bf8c9b1235458df7a1c0490b0064647a282)
|
||||
- [actions] further shard; update action deps [`bec56bb`](https://github.com/inspect-js/has-symbols/commit/bec56bb0fb44b43a786686b944875a3175cf3ff3)
|
||||
- [meta] use `npmignore` to autogenerate an npmignore file [`ac81032`](https://github.com/inspect-js/has-symbols/commit/ac81032809157e0a079e5264e9ce9b6f1275777e)
|
||||
- [New] add types [`6469cbf`](https://github.com/inspect-js/has-symbols/commit/6469cbff1866cfe367b2b3d181d9296ec14b2a3d)
|
||||
- [actions] update rebase action to use reusable workflow [`9c9d4d0`](https://github.com/inspect-js/has-symbols/commit/9c9d4d0d8938e4b267acdf8e421f4e92d1716d72)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`adb5887`](https://github.com/inspect-js/has-symbols/commit/adb5887ca9444849b08beb5caaa9e1d42320cdfb)
|
||||
- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`13ec198`](https://github.com/inspect-js/has-symbols/commit/13ec198ec80f1993a87710af1606a1970b22c7cb)
|
||||
- [Dev Deps] update `auto-changelog`, `core-js`, `tape` [`941be52`](https://github.com/inspect-js/has-symbols/commit/941be5248387cab1da72509b22acf3fdb223f057)
|
||||
- [Tests] replace `aud` with `npm audit` [`74f49e9`](https://github.com/inspect-js/has-symbols/commit/74f49e9a9d17a443020784234a1c53ce765b3559)
|
||||
- [Dev Deps] update `npmignore` [`9c0ac04`](https://github.com/inspect-js/has-symbols/commit/9c0ac0452a834f4c2a4b54044f2d6a89f17e9a70)
|
||||
- [Dev Deps] add missing peer dep [`52337a5`](https://github.com/inspect-js/has-symbols/commit/52337a5621cced61f846f2afdab7707a8132cc12)
|
||||
|
||||
## [v1.0.3](https://github.com/inspect-js/has-symbols/compare/v1.0.2...v1.0.3) - 2022-03-01
|
||||
|
||||
### Commits
|
||||
|
||||
- [actions] use `node/install` instead of `node/run`; use `codecov` action [`518b28f`](https://github.com/inspect-js/has-symbols/commit/518b28f6c5a516cbccae30794e40aa9f738b1693)
|
||||
- [meta] add `bugs` and `homepage` fields; reorder package.json [`c480b13`](https://github.com/inspect-js/has-symbols/commit/c480b13fd6802b557e1cef9749872cb5fdeef744)
|
||||
- [actions] reuse common workflows [`01d0ee0`](https://github.com/inspect-js/has-symbols/commit/01d0ee0a8d97c0947f5edb73eb722027a77b2b07)
|
||||
- [actions] update codecov uploader [`6424ebe`](https://github.com/inspect-js/has-symbols/commit/6424ebe86b2c9c7c3d2e9bd4413a4e4f168cb275)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`dfa7e7f`](https://github.com/inspect-js/has-symbols/commit/dfa7e7ff38b594645d8c8222aab895157fa7e282)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `safe-publish-latest`, `tape` [`0c8d436`](https://github.com/inspect-js/has-symbols/commit/0c8d43685c45189cea9018191d4fd7eca91c9d02)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`9026554`](https://github.com/inspect-js/has-symbols/commit/902655442a1bf88e72b42345494ef0c60f5d36ab)
|
||||
- [readme] add actions and codecov badges [`eaa9682`](https://github.com/inspect-js/has-symbols/commit/eaa9682f990f481d3acf7a1c7600bec36f7b3adc)
|
||||
- [Dev Deps] update `eslint`, `tape` [`bc7a3ba`](https://github.com/inspect-js/has-symbols/commit/bc7a3ba46f27b7743f8a2579732d59d1b9ac791e)
|
||||
- [Dev Deps] update `eslint`, `auto-changelog` [`0ace00a`](https://github.com/inspect-js/has-symbols/commit/0ace00af08a88cdd1e6ce0d60357d941c60c2d9f)
|
||||
- [meta] use `prepublishOnly` script for npm 7+ [`093f72b`](https://github.com/inspect-js/has-symbols/commit/093f72bc2b0ed00c781f444922a5034257bf561d)
|
||||
- [Tests] test on all 16 minors [`9b80d3d`](https://github.com/inspect-js/has-symbols/commit/9b80d3d9102529f04c20ec5b1fcc6e38426c6b03)
|
||||
|
||||
## [v1.0.2](https://github.com/inspect-js/has-symbols/compare/v1.0.1...v1.0.2) - 2021-02-27
|
||||
|
||||
### Fixed
|
||||
|
||||
- [Fix] use a universal way to get the original Symbol [`#11`](https://github.com/inspect-js/has-symbols/issues/11)
|
||||
|
||||
### Commits
|
||||
|
||||
- [Tests] migrate tests to Github Actions [`90ae798`](https://github.com/inspect-js/has-symbols/commit/90ae79820bdfe7bc703d67f5f3c5e205f98556d3)
|
||||
- [meta] do not publish github action workflow files [`29e60a1`](https://github.com/inspect-js/has-symbols/commit/29e60a1b7c25c7f1acf7acff4a9320d0d10c49b4)
|
||||
- [Tests] run `nyc` on all tests [`8476b91`](https://github.com/inspect-js/has-symbols/commit/8476b915650d360915abe2522505abf4b0e8f0ae)
|
||||
- [readme] fix repo URLs, remove defunct badges [`126288e`](https://github.com/inspect-js/has-symbols/commit/126288ecc1797c0a40247a6b78bcb2e0bc5d7036)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `core-js`, `get-own-property-symbols` [`d84bdfa`](https://github.com/inspect-js/has-symbols/commit/d84bdfa48ac5188abbb4904b42614cd6c030940a)
|
||||
- [Tests] fix linting errors [`0df3070`](https://github.com/inspect-js/has-symbols/commit/0df3070b981b6c9f2ee530c09189a7f5c6def839)
|
||||
- [actions] add "Allow Edits" workflow [`1e6bc29`](https://github.com/inspect-js/has-symbols/commit/1e6bc29b188f32b9648657b07eda08504be5aa9c)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`36cea2a`](https://github.com/inspect-js/has-symbols/commit/36cea2addd4e6ec435f35a2656b4e9ef82498e9b)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`1278338`](https://github.com/inspect-js/has-symbols/commit/127833801865fbc2cc8979beb9ca869c7bfe8222)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`1493254`](https://github.com/inspect-js/has-symbols/commit/1493254eda13db5fb8fc5e4a3e8324b3d196029d)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `core-js` [`b090bf2`](https://github.com/inspect-js/has-symbols/commit/b090bf214d3679a30edc1e2d729d466ab5183e1d)
|
||||
- [actions] switch Automatic Rebase workflow to `pull_request_target` event [`4addb7a`](https://github.com/inspect-js/has-symbols/commit/4addb7ab4dc73f927ae99928d68817554fc21dc0)
|
||||
- [Dev Deps] update `auto-changelog`, `tape` [`81d0baf`](https://github.com/inspect-js/has-symbols/commit/81d0baf3816096a89a8558e8043895f7a7d10d8b)
|
||||
- [Dev Deps] update `auto-changelog`; add `aud` [`1a4e561`](https://github.com/inspect-js/has-symbols/commit/1a4e5612c25d91c3a03d509721d02630bc4fe3da)
|
||||
- [readme] remove unused testling URLs [`3000941`](https://github.com/inspect-js/has-symbols/commit/3000941f958046e923ed8152edb1ef4a599e6fcc)
|
||||
- [Tests] only audit prod deps [`692e974`](https://github.com/inspect-js/has-symbols/commit/692e9743c912410e9440207631a643a34b4741a1)
|
||||
- [Dev Deps] update `@ljharb/eslint-config` [`51c946c`](https://github.com/inspect-js/has-symbols/commit/51c946c7f6baa793ec5390bb5a45cdce16b4ba76)
|
||||
|
||||
## [v1.0.1](https://github.com/inspect-js/has-symbols/compare/v1.0.0...v1.0.1) - 2019-11-16
|
||||
|
||||
### Commits
|
||||
|
||||
- [Tests] use shared travis-ci configs [`ce396c9`](https://github.com/inspect-js/has-symbols/commit/ce396c9419ff11c43d0da5d05cdbb79f7fb42229)
|
||||
- [Tests] up to `node` `v12.4`, `v11.15`, `v10.15`, `v9.11`, `v8.15`, `v7.10`, `v6.17`, `v4.9`; use `nvm install-latest-npm` [`0690732`](https://github.com/inspect-js/has-symbols/commit/0690732801f47ab429f39ba1962f522d5c462d6b)
|
||||
- [meta] add `auto-changelog` [`2163d0b`](https://github.com/inspect-js/has-symbols/commit/2163d0b7f36343076b8f947cd1667dd1750f26fc)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `core-js`, `safe-publish-latest`, `tape` [`8e0951f`](https://github.com/inspect-js/has-symbols/commit/8e0951f1a7a2e52068222b7bb73511761e6e4d9c)
|
||||
- [actions] add automatic rebasing / merge commit blocking [`b09cdb7`](https://github.com/inspect-js/has-symbols/commit/b09cdb7cd7ee39e7a769878f56e2d6066f5ccd1d)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `safe-publish-latest`, `core-js`, `get-own-property-symbols`, `tape` [`1dd42cd`](https://github.com/inspect-js/has-symbols/commit/1dd42cd86183ed0c50f99b1062345c458babca91)
|
||||
- [meta] create FUNDING.yml [`aa57a17`](https://github.com/inspect-js/has-symbols/commit/aa57a17b19708906d1927f821ea8e73394d84ca4)
|
||||
- Only apps should have lockfiles [`a2d8bea`](https://github.com/inspect-js/has-symbols/commit/a2d8bea23a97d15c09eaf60f5b107fcf9a4d57aa)
|
||||
- [Tests] use `npx aud` instead of `nsp` or `npm audit` with hoops [`9e96cb7`](https://github.com/inspect-js/has-symbols/commit/9e96cb783746cbed0c10ef78e599a8eaa7ebe193)
|
||||
- [meta] add `funding` field [`a0b32cf`](https://github.com/inspect-js/has-symbols/commit/a0b32cf68e803f963c1639b6d47b0a9d6440bab0)
|
||||
- [Dev Deps] update `safe-publish-latest` [`cb9f0a5`](https://github.com/inspect-js/has-symbols/commit/cb9f0a521a3a1790f1064d437edd33bb6c3d6af0)
|
||||
|
||||
## v1.0.0 - 2016-09-19
|
||||
|
||||
### Commits
|
||||
|
||||
- Tests. [`ecb6eb9`](https://github.com/inspect-js/has-symbols/commit/ecb6eb934e4883137f3f93b965ba5e0a98df430d)
|
||||
- package.json [`88a337c`](https://github.com/inspect-js/has-symbols/commit/88a337cee0864a0da35f5d19e69ff0ef0150e46a)
|
||||
- Initial commit [`42e1e55`](https://github.com/inspect-js/has-symbols/commit/42e1e5502536a2b8ac529c9443984acd14836b1c)
|
||||
- Initial implementation. [`33f5cc6`](https://github.com/inspect-js/has-symbols/commit/33f5cc6cdff86e2194b081ee842bfdc63caf43fb)
|
||||
- read me [`01f1170`](https://github.com/inspect-js/has-symbols/commit/01f1170188ff7cb1558aa297f6ba5b516c6d7b0c)
|
||||
@@ -0,0 +1,8 @@
|
||||
'use strict'
|
||||
|
||||
const parse = require('./parse')
|
||||
const clean = (version, options) => {
|
||||
const s = parse(version.trim().replace(/^[=v]+/, ''), options)
|
||||
return s ? s.version : null
|
||||
}
|
||||
module.exports = clean
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "mutter",
|
||||
"version": "1.0.1",
|
||||
"description": "A rather simple event emitter",
|
||||
"repository": "daryl/mutter",
|
||||
"license": "MIT",
|
||||
"author": {
|
||||
"name": "Daryl Ginn",
|
||||
"email": "hi@daryl.im",
|
||||
"url": "daryl.im"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"emitter",
|
||||
"events",
|
||||
"event",
|
||||
"bus"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,202 @@
|
||||
{
|
||||
"name": "prettier",
|
||||
"version": "3.6.1",
|
||||
"description": "Prettier is an opinionated code formatter",
|
||||
"bin": "./bin/prettier.cjs",
|
||||
"repository": "prettier/prettier",
|
||||
"funding": "https://github.com/prettier/prettier?sponsor=1",
|
||||
"homepage": "https://prettier.io",
|
||||
"author": "James Long",
|
||||
"license": "MIT",
|
||||
"main": "./index.cjs",
|
||||
"browser": "./standalone.js",
|
||||
"unpkg": "./standalone.js",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./index.d.ts",
|
||||
"require": "./index.cjs",
|
||||
"browser": {
|
||||
"import": "./standalone.mjs",
|
||||
"default": "./standalone.js"
|
||||
},
|
||||
"default": "./index.mjs"
|
||||
},
|
||||
"./*": "./*",
|
||||
"./doc": {
|
||||
"types": "./doc.d.ts",
|
||||
"require": "./doc.js",
|
||||
"default": "./doc.mjs"
|
||||
},
|
||||
"./standalone": {
|
||||
"types": "./standalone.d.ts",
|
||||
"require": "./standalone.js",
|
||||
"default": "./standalone.mjs"
|
||||
},
|
||||
"./plugins/estree": {
|
||||
"types": "./plugins/estree.d.ts",
|
||||
"require": "./plugins/estree.js",
|
||||
"default": "./plugins/estree.mjs"
|
||||
},
|
||||
"./plugins/babel": {
|
||||
"types": "./plugins/babel.d.ts",
|
||||
"require": "./plugins/babel.js",
|
||||
"default": "./plugins/babel.mjs"
|
||||
},
|
||||
"./plugins/flow": {
|
||||
"types": "./plugins/flow.d.ts",
|
||||
"require": "./plugins/flow.js",
|
||||
"default": "./plugins/flow.mjs"
|
||||
},
|
||||
"./plugins/typescript": {
|
||||
"types": "./plugins/typescript.d.ts",
|
||||
"require": "./plugins/typescript.js",
|
||||
"default": "./plugins/typescript.mjs"
|
||||
},
|
||||
"./plugins/acorn": {
|
||||
"types": "./plugins/acorn.d.ts",
|
||||
"require": "./plugins/acorn.js",
|
||||
"default": "./plugins/acorn.mjs"
|
||||
},
|
||||
"./plugins/meriyah": {
|
||||
"types": "./plugins/meriyah.d.ts",
|
||||
"require": "./plugins/meriyah.js",
|
||||
"default": "./plugins/meriyah.mjs"
|
||||
},
|
||||
"./plugins/angular": {
|
||||
"types": "./plugins/angular.d.ts",
|
||||
"require": "./plugins/angular.js",
|
||||
"default": "./plugins/angular.mjs"
|
||||
},
|
||||
"./plugins/postcss": {
|
||||
"types": "./plugins/postcss.d.ts",
|
||||
"require": "./plugins/postcss.js",
|
||||
"default": "./plugins/postcss.mjs"
|
||||
},
|
||||
"./plugins/graphql": {
|
||||
"types": "./plugins/graphql.d.ts",
|
||||
"require": "./plugins/graphql.js",
|
||||
"default": "./plugins/graphql.mjs"
|
||||
},
|
||||
"./plugins/markdown": {
|
||||
"types": "./plugins/markdown.d.ts",
|
||||
"require": "./plugins/markdown.js",
|
||||
"default": "./plugins/markdown.mjs"
|
||||
},
|
||||
"./plugins/glimmer": {
|
||||
"types": "./plugins/glimmer.d.ts",
|
||||
"require": "./plugins/glimmer.js",
|
||||
"default": "./plugins/glimmer.mjs"
|
||||
},
|
||||
"./plugins/html": {
|
||||
"types": "./plugins/html.d.ts",
|
||||
"require": "./plugins/html.js",
|
||||
"default": "./plugins/html.mjs"
|
||||
},
|
||||
"./plugins/yaml": {
|
||||
"types": "./plugins/yaml.d.ts",
|
||||
"require": "./plugins/yaml.js",
|
||||
"default": "./plugins/yaml.mjs"
|
||||
},
|
||||
"./esm/standalone.mjs": "./standalone.mjs",
|
||||
"./parser-babel": "./plugins/babel.js",
|
||||
"./parser-babel.js": "./plugins/babel.js",
|
||||
"./esm/parser-babel.mjs": "./plugins/babel.mjs",
|
||||
"./parser-flow": "./plugins/flow.js",
|
||||
"./parser-flow.js": "./plugins/flow.js",
|
||||
"./esm/parser-flow.mjs": "./plugins/flow.mjs",
|
||||
"./parser-typescript": "./plugins/typescript.js",
|
||||
"./parser-typescript.js": "./plugins/typescript.js",
|
||||
"./esm/parser-typescript.mjs": "./plugins/typescript.mjs",
|
||||
"./parser-espree": "./plugins/acorn.js",
|
||||
"./parser-espree.js": "./plugins/acorn.js",
|
||||
"./esm/parser-espree.mjs": "./plugins/acorn.mjs",
|
||||
"./parser-meriyah": "./plugins/meriyah.js",
|
||||
"./parser-meriyah.js": "./plugins/meriyah.js",
|
||||
"./esm/parser-meriyah.mjs": "./plugins/meriyah.mjs",
|
||||
"./parser-angular": "./plugins/angular.js",
|
||||
"./parser-angular.js": "./plugins/angular.js",
|
||||
"./esm/parser-angular.mjs": "./plugins/angular.mjs",
|
||||
"./parser-postcss": "./plugins/postcss.js",
|
||||
"./parser-postcss.js": "./plugins/postcss.js",
|
||||
"./esm/parser-postcss.mjs": "./plugins/postcss.mjs",
|
||||
"./parser-graphql": "./plugins/graphql.js",
|
||||
"./parser-graphql.js": "./plugins/graphql.js",
|
||||
"./esm/parser-graphql.mjs": "./plugins/graphql.mjs",
|
||||
"./parser-markdown": "./plugins/markdown.js",
|
||||
"./parser-markdown.js": "./plugins/markdown.js",
|
||||
"./esm/parser-markdown.mjs": "./plugins/markdown.mjs",
|
||||
"./parser-glimmer": "./plugins/glimmer.js",
|
||||
"./parser-glimmer.js": "./plugins/glimmer.js",
|
||||
"./esm/parser-glimmer.mjs": "./plugins/glimmer.mjs",
|
||||
"./parser-html": "./plugins/html.js",
|
||||
"./parser-html.js": "./plugins/html.js",
|
||||
"./esm/parser-html.mjs": "./plugins/html.mjs",
|
||||
"./parser-yaml": "./plugins/yaml.js",
|
||||
"./parser-yaml.js": "./plugins/yaml.js",
|
||||
"./esm/parser-yaml.mjs": "./plugins/yaml.mjs"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
},
|
||||
"files": [
|
||||
"LICENSE",
|
||||
"README.md",
|
||||
"THIRD-PARTY-NOTICES.md",
|
||||
"bin/prettier.cjs",
|
||||
"doc.d.ts",
|
||||
"doc.js",
|
||||
"doc.mjs",
|
||||
"index.cjs",
|
||||
"index.d.ts",
|
||||
"index.d.ts",
|
||||
"index.mjs",
|
||||
"internal/experimental-cli-worker.mjs",
|
||||
"internal/experimental-cli.mjs",
|
||||
"internal/legacy-cli.mjs",
|
||||
"package.json",
|
||||
"plugins/acorn.d.ts",
|
||||
"plugins/acorn.js",
|
||||
"plugins/acorn.mjs",
|
||||
"plugins/angular.d.ts",
|
||||
"plugins/angular.js",
|
||||
"plugins/angular.mjs",
|
||||
"plugins/babel.d.ts",
|
||||
"plugins/babel.js",
|
||||
"plugins/babel.mjs",
|
||||
"plugins/estree.d.ts",
|
||||
"plugins/estree.js",
|
||||
"plugins/estree.mjs",
|
||||
"plugins/flow.d.ts",
|
||||
"plugins/flow.js",
|
||||
"plugins/flow.mjs",
|
||||
"plugins/glimmer.d.ts",
|
||||
"plugins/glimmer.js",
|
||||
"plugins/glimmer.mjs",
|
||||
"plugins/graphql.d.ts",
|
||||
"plugins/graphql.js",
|
||||
"plugins/graphql.mjs",
|
||||
"plugins/html.d.ts",
|
||||
"plugins/html.js",
|
||||
"plugins/html.mjs",
|
||||
"plugins/markdown.d.ts",
|
||||
"plugins/markdown.js",
|
||||
"plugins/markdown.mjs",
|
||||
"plugins/meriyah.d.ts",
|
||||
"plugins/meriyah.js",
|
||||
"plugins/meriyah.mjs",
|
||||
"plugins/postcss.d.ts",
|
||||
"plugins/postcss.js",
|
||||
"plugins/postcss.mjs",
|
||||
"plugins/typescript.d.ts",
|
||||
"plugins/typescript.js",
|
||||
"plugins/typescript.mjs",
|
||||
"plugins/yaml.d.ts",
|
||||
"plugins/yaml.js",
|
||||
"plugins/yaml.mjs",
|
||||
"standalone.d.ts",
|
||||
"standalone.js",
|
||||
"standalone.mjs"
|
||||
],
|
||||
"preferUnplugged": true,
|
||||
"type": "commonjs"
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
# accepts
|
||||
|
||||
[![NPM Version][npm-version-image]][npm-url]
|
||||
[![NPM Downloads][npm-downloads-image]][npm-url]
|
||||
[![Node.js Version][node-version-image]][node-version-url]
|
||||
[![Build Status][github-actions-ci-image]][github-actions-ci-url]
|
||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||
|
||||
Higher level content negotiation based on [negotiator](https://www.npmjs.com/package/negotiator).
|
||||
Extracted from [koa](https://www.npmjs.com/package/koa) for general use.
|
||||
|
||||
In addition to negotiator, it allows:
|
||||
|
||||
- Allows types as an array or arguments list, ie `(['text/html', 'application/json'])`
|
||||
as well as `('text/html', 'application/json')`.
|
||||
- Allows type shorthands such as `json`.
|
||||
- Returns `false` when no types match
|
||||
- Treats non-existent headers as `*`
|
||||
|
||||
## Installation
|
||||
|
||||
This is a [Node.js](https://nodejs.org/en/) module available through the
|
||||
[npm registry](https://www.npmjs.com/). Installation is done using the
|
||||
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
|
||||
|
||||
```sh
|
||||
$ npm install accepts
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
```js
|
||||
var accepts = require('accepts')
|
||||
```
|
||||
|
||||
### accepts(req)
|
||||
|
||||
Create a new `Accepts` object for the given `req`.
|
||||
|
||||
#### .charset(charsets)
|
||||
|
||||
Return the first accepted charset. If nothing in `charsets` is accepted,
|
||||
then `false` is returned.
|
||||
|
||||
#### .charsets()
|
||||
|
||||
Return the charsets that the request accepts, in the order of the client's
|
||||
preference (most preferred first).
|
||||
|
||||
#### .encoding(encodings)
|
||||
|
||||
Return the first accepted encoding. If nothing in `encodings` is accepted,
|
||||
then `false` is returned.
|
||||
|
||||
#### .encodings()
|
||||
|
||||
Return the encodings that the request accepts, in the order of the client's
|
||||
preference (most preferred first).
|
||||
|
||||
#### .language(languages)
|
||||
|
||||
Return the first accepted language. If nothing in `languages` is accepted,
|
||||
then `false` is returned.
|
||||
|
||||
#### .languages()
|
||||
|
||||
Return the languages that the request accepts, in the order of the client's
|
||||
preference (most preferred first).
|
||||
|
||||
#### .type(types)
|
||||
|
||||
Return the first accepted type (and it is returned as the same text as what
|
||||
appears in the `types` array). If nothing in `types` is accepted, then `false`
|
||||
is returned.
|
||||
|
||||
The `types` array can contain full MIME types or file extensions. Any value
|
||||
that is not a full MIME type is passed to `require('mime-types').lookup`.
|
||||
|
||||
#### .types()
|
||||
|
||||
Return the types that the request accepts, in the order of the client's
|
||||
preference (most preferred first).
|
||||
|
||||
## Examples
|
||||
|
||||
### Simple type negotiation
|
||||
|
||||
This simple example shows how to use `accepts` to return a different typed
|
||||
respond body based on what the client wants to accept. The server lists it's
|
||||
preferences in order and will get back the best match between the client and
|
||||
server.
|
||||
|
||||
```js
|
||||
var accepts = require('accepts')
|
||||
var http = require('http')
|
||||
|
||||
function app (req, res) {
|
||||
var accept = accepts(req)
|
||||
|
||||
// the order of this list is significant; should be server preferred order
|
||||
switch (accept.type(['json', 'html'])) {
|
||||
case 'json':
|
||||
res.setHeader('Content-Type', 'application/json')
|
||||
res.write('{"hello":"world!"}')
|
||||
break
|
||||
case 'html':
|
||||
res.setHeader('Content-Type', 'text/html')
|
||||
res.write('<b>hello, world!</b>')
|
||||
break
|
||||
default:
|
||||
// the fallback is text/plain, so no need to specify it above
|
||||
res.setHeader('Content-Type', 'text/plain')
|
||||
res.write('hello, world!')
|
||||
break
|
||||
}
|
||||
|
||||
res.end()
|
||||
}
|
||||
|
||||
http.createServer(app).listen(3000)
|
||||
```
|
||||
|
||||
You can test this out with the cURL program:
|
||||
```sh
|
||||
curl -I -H'Accept: text/html' http://localhost:3000/
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/accepts/master
|
||||
[coveralls-url]: https://coveralls.io/r/jshttp/accepts?branch=master
|
||||
[github-actions-ci-image]: https://badgen.net/github/checks/jshttp/accepts/master?label=ci
|
||||
[github-actions-ci-url]: https://github.com/jshttp/accepts/actions/workflows/ci.yml
|
||||
[node-version-image]: https://badgen.net/npm/node/accepts
|
||||
[node-version-url]: https://nodejs.org/en/download
|
||||
[npm-downloads-image]: https://badgen.net/npm/dm/accepts
|
||||
[npm-url]: https://npmjs.org/package/accepts
|
||||
[npm-version-image]: https://badgen.net/npm/v/accepts
|
||||
@@ -0,0 +1,4 @@
|
||||
module.exports = {
|
||||
run: require('./run'),
|
||||
watch: require('./watch').watch,
|
||||
};
|
||||
@@ -0,0 +1,71 @@
|
||||
# get-intrinsic <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
|
||||
|
||||
[![github actions][actions-image]][actions-url]
|
||||
[![coverage][codecov-image]][codecov-url]
|
||||
[![dependency status][deps-svg]][deps-url]
|
||||
[![dev dependency status][dev-deps-svg]][dev-deps-url]
|
||||
[![License][license-image]][license-url]
|
||||
[![Downloads][downloads-image]][downloads-url]
|
||||
|
||||
[![npm badge][npm-badge-png]][package-url]
|
||||
|
||||
Get and robustly cache all JS language-level intrinsics at first require time.
|
||||
|
||||
See the syntax described [in the JS spec](https://tc39.es/ecma262/#sec-well-known-intrinsic-objects) for reference.
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
var assert = require('assert');
|
||||
|
||||
// static methods
|
||||
assert.equal(GetIntrinsic('%Math.pow%'), Math.pow);
|
||||
assert.equal(Math.pow(2, 3), 8);
|
||||
assert.equal(GetIntrinsic('%Math.pow%')(2, 3), 8);
|
||||
delete Math.pow;
|
||||
assert.equal(GetIntrinsic('%Math.pow%')(2, 3), 8);
|
||||
|
||||
// instance methods
|
||||
var arr = [1];
|
||||
assert.equal(GetIntrinsic('%Array.prototype.push%'), Array.prototype.push);
|
||||
assert.deepEqual(arr, [1]);
|
||||
|
||||
arr.push(2);
|
||||
assert.deepEqual(arr, [1, 2]);
|
||||
|
||||
GetIntrinsic('%Array.prototype.push%').call(arr, 3);
|
||||
assert.deepEqual(arr, [1, 2, 3]);
|
||||
|
||||
delete Array.prototype.push;
|
||||
GetIntrinsic('%Array.prototype.push%').call(arr, 4);
|
||||
assert.deepEqual(arr, [1, 2, 3, 4]);
|
||||
|
||||
// missing features
|
||||
delete JSON.parse; // to simulate a real intrinsic that is missing in the environment
|
||||
assert.throws(() => GetIntrinsic('%JSON.parse%'));
|
||||
assert.equal(undefined, GetIntrinsic('%JSON.parse%', true));
|
||||
```
|
||||
|
||||
## Tests
|
||||
Simply clone the repo, `npm install`, and run `npm test`
|
||||
|
||||
## Security
|
||||
|
||||
Please email [@ljharb](https://github.com/ljharb) or see https://tidelift.com/security if you have a potential security vulnerability to report.
|
||||
|
||||
[package-url]: https://npmjs.org/package/get-intrinsic
|
||||
[npm-version-svg]: https://versionbadg.es/ljharb/get-intrinsic.svg
|
||||
[deps-svg]: https://david-dm.org/ljharb/get-intrinsic.svg
|
||||
[deps-url]: https://david-dm.org/ljharb/get-intrinsic
|
||||
[dev-deps-svg]: https://david-dm.org/ljharb/get-intrinsic/dev-status.svg
|
||||
[dev-deps-url]: https://david-dm.org/ljharb/get-intrinsic#info=devDependencies
|
||||
[npm-badge-png]: https://nodei.co/npm/get-intrinsic.png?downloads=true&stars=true
|
||||
[license-image]: https://img.shields.io/npm/l/get-intrinsic.svg
|
||||
[license-url]: LICENSE
|
||||
[downloads-image]: https://img.shields.io/npm/dm/get-intrinsic.svg
|
||||
[downloads-url]: https://npm-stat.com/charts.html?package=get-intrinsic
|
||||
[codecov-image]: https://codecov.io/gh/ljharb/get-intrinsic/branch/main/graphs/badge.svg
|
||||
[codecov-url]: https://app.codecov.io/gh/ljharb/get-intrinsic/
|
||||
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/get-intrinsic
|
||||
[actions-url]: https://github.com/ljharb/get-intrinsic/actions
|
||||
Reference in New Issue
Block a user