{"_id":"es-to-primitive","_rev":"3744969","name":"es-to-primitive","description":"ECMAScript “ToPrimitive” algorithm. Provides ES5 and ES2015 versions.","dist-tags":{"latest":"1.3.0"},"maintainers":[{"name":"ljharb","email":""}],"time":{"modified":"2025-02-13T06:28:06.000Z","created":"2015-03-19T09:39:36.352Z","1.3.0":"2024-11-26T18:36:27.571Z","1.2.1":"2019-11-09T06:27:50.488Z","1.2.0":"2018-09-27T17:53:26.933Z","1.1.1":"2016-01-04T02:05:46.641Z","1.0.1":"2016-01-04T01:34:53.797Z","1.1.0":"2015-12-27T18:22:15.885Z","1.0.0":"2015-03-19T09:39:36.352Z"},"users":{},"author":{"name":"Jordan Harband","email":"ljharb@gmail.com"},"repository":{"type":"git","url":"git://github.com/ljharb/es-to-primitive.git"},"versions":{"1.3.0":{"name":"es-to-primitive","version":"1.3.0","author":{"name":"Jordan Harband","email":"ljharb@gmail.com"},"funding":{"url":"https://github.com/sponsors/ljharb"},"description":"ECMAScript “ToPrimitive” algorithm. Provides ES5 and ES2015 versions.","license":"MIT","main":"index.js","scripts":{"prepack":"npmignore --auto --commentLines=autogenerated","prepublish":"not-in-publish || npm run prepublishOnly","prepublishOnly":"safe-publish-latest","pretest":"npm run lint","test":"npm run tests-only","posttest":"npx npm@'>=10.2' audit --production","tests-only":"nyc tape 'test/**/*.js'","lint":"eslint --ext=js,mjs .","postlint":"tsc && attw -P","version":"auto-changelog && git add CHANGELOG.md","postversion":"auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""},"repository":{"type":"git","url":"git://github.com/ljharb/es-to-primitive.git"},"keywords":["primitive","abstract","ecmascript","es5","es6","es2015","toPrimitive","coerce","type","object","string","number","boolean","symbol","null","undefined"],"dependencies":{"is-callable":"^1.2.7","is-date-object":"^1.0.5","is-symbol":"^1.0.4"},"devDependencies":{"@arethetypeswrong/cli":"^0.17.0","@ljharb/eslint-config":"^21.1.1","@ljharb/tsconfig":"^0.2.0","@types/for-each":"^0.3.3","@types/function.prototype.name":"^1.1.3","@types/is-callable":"^1.1.2","@types/is-date-object":"^1.0.4","@types/is-symbol":"^1.0.2","@types/object-inspect":"^1.13.0","@types/object-is":"^1.1.0","@types/tape":"^5.6.4","auto-changelog":"^2.5.0","encoding":"^0.1.13","es-value-fixtures":"^1.5.0","eslint":"=8.8.0","for-each":"^0.3.3","function.prototype.name":"^1.1.6","npmignore":"^0.3.1","nyc":"^10.3.2","object-inspect":"^1.13.3","object-is":"^1.1.6","safe-publish-latest":"^2.0.0","tape":"^5.9.0","typescript":"next"},"testling":{"files":"test/index.js"},"engines":{"node":">= 0.4"},"auto-changelog":{"output":"CHANGELOG.md","template":"keepachangelog","unreleased":false,"commitLimit":false,"backfillLimit":false,"hideCredit":true,"startingVersion":"1.2.2"},"publishConfig":{"ignore":[".github/workflows"]},"_id":"es-to-primitive@1.3.0","gitHead":"717f14a340bf0ab635eadc472cf1fe29a6c9240b","types":"./index.d.ts","bugs":{"url":"https://github.com/ljharb/es-to-primitive/issues"},"homepage":"https://github.com/ljharb/es-to-primitive#readme","_nodeVersion":"23.2.0","_npmVersion":"10.9.0","dist":{"shasum":"96c89c82cc49fd8794a24835ba3e1ff87f214e18","size":10059,"noattachment":false,"key":"/es-to-primitive/-/es-to-primitive-1.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/es-to-primitive/download/es-to-primitive-1.3.0.tgz"},"_npmUser":{"name":"ljharb","email":"ljharb@gmail.com"},"directories":{},"maintainers":[{"name":"ljharb","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/es-to-primitive_1.3.0_1732646187387_0.5953143774878684"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-11-26T18:36:27.571Z","publish_time":1732646187571,"_source_registry_name":"default","_cnpm_publish_time":1732646187571},"1.2.1":{"name":"es-to-primitive","version":"1.2.1","author":{"name":"Jordan Harband","email":"ljharb@gmail.com"},"funding":{"url":"https://github.com/sponsors/ljharb"},"description":"ECMAScript “ToPrimitive” algorithm. Provides ES5 and ES2015 versions.","license":"MIT","main":"index.js","scripts":{"pretest":"npm run --silent lint","test":"npm run --silent tests-only","posttest":"npx aud","tests-only":"node --es-staging test","coverage":"covert test/*.js","coverage-quiet":"covert test/*.js --quiet","lint":"eslint ."},"repository":{"type":"git","url":"git://github.com/ljharb/es-to-primitive.git"},"keywords":["primitive","abstract","ecmascript","es5","es6","es2015","toPrimitive","coerce","type","object","string","number","boolean","symbol","null","undefined"],"dependencies":{"is-callable":"^1.1.4","is-date-object":"^1.0.1","is-symbol":"^1.0.2"},"devDependencies":{"@ljharb/eslint-config":"^15.0.0","covert":"^1.1.1","eslint":"^6.6.0","foreach":"^2.0.5","function.prototype.name":"^1.1.1","has-symbols":"^1.0.0","object-inspect":"^1.6.0","object-is":"^1.0.1","replace":"^1.1.1","semver":"^6.3.0","tape":"^4.11.0"},"testling":{"files":"test","browsers":["iexplore/6.0..latest","firefox/3.0..6.0","firefox/15.0..latest","firefox/nightly","chrome/4.0..10.0","chrome/20.0..latest","chrome/canary","opera/10.0..latest","opera/next","safari/4.0..latest","ipad/6.0..latest","iphone/6.0..latest","android-browser/4.2"]},"engines":{"node":">= 0.4"},"gitHead":"fc864b766689e70707a0b86a136b0ec0021e4d17","bugs":{"url":"https://github.com/ljharb/es-to-primitive/issues"},"homepage":"https://github.com/ljharb/es-to-primitive#readme","_id":"es-to-primitive@1.2.1","_nodeVersion":"13.1.0","_npmVersion":"6.12.1","dist":{"shasum":"e55cd4c9cdc188bcefb03b366c736323fc5c898a","size":8725,"noattachment":false,"key":"/es-to-primitive/-/es-to-primitive-1.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/es-to-primitive/download/es-to-primitive-1.2.1.tgz"},"maintainers":[{"name":"ljharb","email":""}],"_npmUser":{"name":"ljharb","email":"ljharb@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/es-to-primitive_1.2.1_1573280870337_0.8527363876404559"},"_hasShrinkwrap":false,"publish_time":1573280870488,"_cnpm_publish_time":1573280870488},"1.2.0":{"name":"es-to-primitive","version":"1.2.0","author":{"name":"Jordan Harband"},"description":"ECMAScript “ToPrimitive” algorithm. Provides ES5 and ES2015 versions.","license":"MIT","main":"index.js","scripts":{"pretest":"npm run --silent lint","test":"npm run --silent tests-only","posttest":"npm run --silent security","tests-only":"node --es-staging test","coverage":"covert test/*.js","coverage-quiet":"covert test/*.js --quiet","lint":"npm run --silent jscs && npm run --silent eslint","jscs":"jscs test/*.js *.js","eslint":"eslint test/*.js *.js","security":"nsp check"},"repository":{"type":"git","url":"git://github.com/ljharb/es-to-primitive.git"},"keywords":["primitive","abstract","ecmascript","es5","es6","es2015","toPrimitive","coerce","type","object","string","number","boolean","symbol","null","undefined"],"dependencies":{"is-callable":"^1.1.4","is-date-object":"^1.0.1","is-symbol":"^1.0.2"},"devDependencies":{"@ljharb/eslint-config":"^13.0.0","covert":"^1.1.0","eslint":"^5.6.0","foreach":"^2.0.5","function.prototype.name":"^1.1.0","jscs":"^3.0.7","nsp":"^3.2.1","object-inspect":"^1.6.0","object-is":"^1.0.1","replace":"^1.0.0","semver":"^5.5.1","tape":"^4.9.1"},"testling":{"files":"test","browsers":["iexplore/6.0..latest","firefox/3.0..6.0","firefox/15.0..latest","firefox/nightly","chrome/4.0..10.0","chrome/20.0..latest","chrome/canary","opera/10.0..latest","opera/next","safari/4.0..latest","ipad/6.0..latest","iphone/6.0..latest","android-browser/4.2"]},"engines":{"node":">= 0.4"},"gitHead":"2a4bca5456480149ca8cdc8e4529b0fa18390aa7","bugs":{"url":"https://github.com/ljharb/es-to-primitive/issues"},"homepage":"https://github.com/ljharb/es-to-primitive#readme","_id":"es-to-primitive@1.2.0","_npmVersion":"6.4.1","_nodeVersion":"10.11.0","_npmUser":{"name":"ljharb","email":"ljharb@gmail.com"},"dist":{"shasum":"edf72478033456e8dda8ef09e00ad9650707f377","size":10368,"noattachment":false,"key":"/es-to-primitive/-/es-to-primitive-1.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/es-to-primitive/download/es-to-primitive-1.2.0.tgz"},"maintainers":[{"name":"ljharb","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/es-to-primitive_1.2.0_1538070806741_0.6483493775372577"},"_hasShrinkwrap":false,"publish_time":1538070806933,"_cnpm_publish_time":1538070806933},"1.1.1":{"name":"es-to-primitive","version":"1.1.1","author":{"name":"Jordan Harband"},"description":"ECMAScript “ToPrimitive” algorithm. Provides ES5 and ES6 versions.","license":"MIT","main":"index.js","scripts":{"test":"npm run lint && npm run tests-only && npm run security","tests-only":"node --es-staging test","coverage":"covert test/*.js","coverage-quiet":"covert test/*.js --quiet","lint":"npm run jscs && npm run eslint","jscs":"jscs test/*.js *.js","eslint":"eslint test/*.js *.js","security":"nsp check"},"repository":{"type":"git","url":"git://github.com/ljharb/es-to-primitive.git"},"keywords":["primitive","abstract","ecmascript","es5","es6","toPrimitive","coerce","type","object"],"dependencies":{"is-callable":"^1.1.1","is-date-object":"^1.0.1","is-symbol":"^1.0.1"},"devDependencies":{"tape":"^4.4.0","covert":"^1.1.0","object-is":"^1.0.1","foreach":"^2.0.5","jscs":"^2.7.0","nsp":"^2.2.0","eslint":"^1.10.3","@ljharb/eslint-config":"^1.6.1","replace":"^0.3.0","semver":"^5.1.0"},"testling":{"files":"test","browsers":["iexplore/6.0..latest","firefox/3.0..6.0","firefox/15.0..latest","firefox/nightly","chrome/4.0..10.0","chrome/20.0..latest","chrome/canary","opera/10.0..latest","opera/next","safari/4.0..latest","ipad/6.0..latest","iphone/6.0..latest","android-browser/4.2"]},"engines":{"node":">= 0.4"},"gitHead":"56cd0400062c37e3427c59ddf7852972cf14e6fe","bugs":{"url":"https://github.com/ljharb/es-to-primitive/issues"},"homepage":"https://github.com/ljharb/es-to-primitive#readme","_id":"es-to-primitive@1.1.1","_shasum":"45355248a88979034b6792e19bb81f2b7975dd0d","_from":".","_npmVersion":"3.3.12","_nodeVersion":"5.3.0","_npmUser":{"name":"ljharb","email":"ljharb@gmail.com"},"dist":{"shasum":"45355248a88979034b6792e19bb81f2b7975dd0d","size":9226,"noattachment":false,"key":"/es-to-primitive/-/es-to-primitive-1.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/es-to-primitive/download/es-to-primitive-1.1.1.tgz"},"maintainers":[{"name":"ljharb","email":""}],"directories":{},"publish_time":1451873146641,"_cnpm_publish_time":1451873146641,"_hasShrinkwrap":false},"1.0.1":{"name":"es-to-primitive","version":"1.0.1","author":{"name":"Jordan Harband"},"description":"ECMAScript “ToPrimitive” algorithm. Provides ES5 and ES6 versions.","license":"MIT","main":"index.js","scripts":{"test":"npm run lint && npm run tests-only && npm run security","tests-only":"node --es-staging test","coverage":"covert test/*.js","coverage-quiet":"covert test/*.js --quiet","lint":"npm run jscs && npm run eslint","jscs":"jscs test/*.js *.js","eslint":"eslint test/*.js *.js","security":"nsp check"},"repository":{"type":"git","url":"git://github.com/ljharb/es-to-primitive.git"},"keywords":["primitive","abstract","ecmascript","es5","es6","toPrimitive","coerce","type","object"],"dependencies":{"is-callable":"^1.1.1","is-date-object":"^1.0.1","is-symbol":"^1.0.1"},"devDependencies":{"tape":"^4.4.0","covert":"^1.1.0","object-is":"^1.0.1","foreach":"^2.0.5","jscs":"^2.7.0","nsp":"^2.2.0","eslint":"^1.10.3","@ljharb/eslint-config":"^1.6.0","replace":"^0.3.0","semver":"^5.1.0"},"testling":{"files":"test","browsers":["iexplore/6.0..latest","firefox/3.0..6.0","firefox/15.0..latest","firefox/nightly","chrome/4.0..10.0","chrome/20.0..latest","chrome/canary","opera/10.0..latest","opera/next","safari/4.0..latest","ipad/6.0..latest","iphone/6.0..latest","android-browser/4.2"]},"engines":{"node":">= 0.4"},"gitHead":"33543b6d593197d9f5d9db3bbe0953f330a639ad","bugs":{"url":"https://github.com/ljharb/es-to-primitive/issues"},"homepage":"https://github.com/ljharb/es-to-primitive#readme","_id":"es-to-primitive@1.0.1","_shasum":"a3232761b89e025ed982f5b097dfb7371d70023f","_from":".","_npmVersion":"3.3.12","_nodeVersion":"5.3.0","_npmUser":{"name":"ljharb","email":"ljharb@gmail.com"},"dist":{"shasum":"a3232761b89e025ed982f5b097dfb7371d70023f","size":8715,"noattachment":false,"key":"/es-to-primitive/-/es-to-primitive-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/es-to-primitive/download/es-to-primitive-1.0.1.tgz"},"maintainers":[{"name":"ljharb","email":""}],"directories":{},"publish_time":1451871293797,"_cnpm_publish_time":1451871293797,"_hasShrinkwrap":false},"1.1.0":{"name":"es-to-primitive","version":"1.1.0","author":{"name":"Jordan Harband"},"description":"ECMAScript “ToPrimitive” algorithm. Provides ES5 and ES6 versions.","license":"MIT","main":"index.js","scripts":{"test":"npm run lint && npm run tests-only && npm run security","tests-only":"node --es-staging test","coverage":"covert test/*.js","coverage-quiet":"covert test/*.js --quiet","lint":"npm run jscs && npm run eslint","jscs":"jscs test/*.js *.js","eslint":"eslint test/*.js *.js","security":"nsp check"},"repository":{"type":"git","url":"git://github.com/ljharb/es-to-primitive.git"},"keywords":["primitive","abstract","ecmascript","es5","es6","toPrimitive","coerce","type","object"],"dependencies":{"is-callable":"^1.1.1","is-date-object":"^1.0.1","is-symbol":"^1.0.1"},"devDependencies":{"tape":"^4.4.0","covert":"^1.1.0","object-is":"^1.0.1","foreach":"^2.0.5","jscs":"^2.7.0","nsp":"^2.2.0","eslint":"^1.10.3","@ljharb/eslint-config":"^1.6.0","replace":"^0.3.0","semver":"^5.1.0"},"testling":{"files":"test","browsers":["iexplore/6.0..latest","firefox/3.0..6.0","firefox/15.0..latest","firefox/nightly","chrome/4.0..10.0","chrome/20.0..latest","chrome/canary","opera/10.0..latest","opera/next","safari/4.0..latest","ipad/6.0..latest","iphone/6.0..latest","android-browser/4.2"]},"engines":{"node":">= 0.4"},"gitHead":"4a15be41802efab7f63836a567b4012d5b48a4d0","bugs":{"url":"https://github.com/ljharb/es-to-primitive/issues"},"homepage":"https://github.com/ljharb/es-to-primitive#readme","_id":"es-to-primitive@1.1.0","_shasum":"0f8de4e23e86abb53a1a079de63bd98ab25ee983","_from":".","_npmVersion":"3.3.12","_nodeVersion":"5.3.0","_npmUser":{"name":"ljharb","email":"ljharb@gmail.com"},"dist":{"shasum":"0f8de4e23e86abb53a1a079de63bd98ab25ee983","size":9203,"noattachment":false,"key":"/es-to-primitive/-/es-to-primitive-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/es-to-primitive/download/es-to-primitive-1.1.0.tgz"},"maintainers":[{"name":"ljharb","email":""}],"directories":{},"publish_time":1451240535885,"_cnpm_publish_time":1451240535885,"_hasShrinkwrap":false},"1.0.0":{"name":"es-to-primitive","version":"1.0.0","author":{"name":"Jordan Harband"},"description":"ECMAScript “ToPrimitive” algorithm. Provides ES5 and ES6 versions.","license":"MIT","main":"index.js","scripts":{"test":"npm run lint && node --harmony --es-staging test && npm run security","coverage":"covert test/*.js","coverage-quiet":"covert test/*.js --quiet","lint":"npm run jscs && npm run eslint","jscs":"jscs test/*.js *.js","eslint":"eslint test/*.js *.js","eccheck":"editorconfig-tools check *.js **/*.js > /dev/null","security":"nsp package"},"repository":{"type":"git","url":"git://github.com/ljharb/es-to-primitive.git"},"keywords":["primitive","abstract","ecmascript","es5","es6","toPrimitive","coerce","type","object"],"dependencies":{"is-callable":"^1.0.4","is-date-object":"^1.0.0","is-symbol":"^1.0.1"},"devDependencies":{"tape":"^3.5.0","covert":"^1.0.1","object-is":"^1.0.1","foreach":"^2.0.5","jscs":"^1.11.3","editorconfig-tools":"^0.1.1","nsp":"^1.0.1","eslint":"^0.17.0","make-arrow-function":"^1.0.0","make-generator-function":"^1.1.0","replace":"^0.3.0","semver":"^4.3.1"},"testling":{"files":"test.js","browsers":["iexplore/6.0..latest","firefox/3.0..6.0","firefox/15.0..latest","firefox/nightly","chrome/4.0..10.0","chrome/20.0..latest","chrome/canary","opera/10.0..latest","opera/next","safari/4.0..latest","ipad/6.0..latest","iphone/6.0..latest","android-browser/4.2"]},"engines":{"node":">= 0.4"},"gitHead":"cf3f44b793aaa5c340e1da4b49d37fb5f2dd413d","bugs":{"url":"https://github.com/ljharb/es-to-primitive/issues"},"homepage":"https://github.com/ljharb/es-to-primitive","_id":"es-to-primitive@1.0.0","_shasum":"469bea3a1b3b41f2e2af0a8c9c8c75a1ac8d517f","_from":".","_npmVersion":"2.7.2","_nodeVersion":"1.5.1","_npmUser":{"name":"ljharb","email":"ljharb@gmail.com"},"maintainers":[{"name":"ljharb","email":""}],"dist":{"shasum":"469bea3a1b3b41f2e2af0a8c9c8c75a1ac8d517f","size":9163,"noattachment":false,"key":"/es-to-primitive/-/es-to-primitive-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/es-to-primitive/download/es-to-primitive-1.0.0.tgz"},"directories":{},"publish_time":1426757976352,"_cnpm_publish_time":1426757976352,"_hasShrinkwrap":false}},"readme":"# es-to-primitive <sup>[![Version Badge][npm-version-svg]][package-url]</sup>\n\n[![github actions][actions-image]][actions-url]\n[![coverage][codecov-image]][codecov-url]\n[![dependency status][deps-svg]][deps-url]\n[![dev dependency status][dev-deps-svg]][dev-deps-url]\n[![License][license-image]][license-url]\n[![Downloads][downloads-image]][downloads-url]\n\n[![npm badge][npm-badge-png]][package-url]\n\nECMAScript “ToPrimitive” algorithm. Provides ES5 and ES2015 versions.\nWhen different versions of the spec conflict, the default export will be the latest version of the abstract operation.\nAlternative versions will also be available under an `es5`/`es2015` exported property if you require a specific version.\n\n## Example\n\n```js\nvar toPrimitive = require('es-to-primitive');\nvar assert = require('assert');\n\nassert(toPrimitive(function () {}) === String(function () {}));\n\nvar date = new Date();\nassert(toPrimitive(date) === String(date));\n\nassert(toPrimitive({ valueOf: function () { return 3; } }) === 3);\n\nassert(toPrimitive(['a', 'b', 3]) === String(['a', 'b', 3]));\n\nvar sym = Symbol();\nassert(toPrimitive(Object(sym)) === sym);\n```\n\n## Tests\nSimply clone the repo, `npm install`, and run `npm test`\n\n[package-url]: https://npmjs.org/package/es-to-primitive\n[npm-version-svg]: https://versionbadg.es/ljharb/es-to-primitive.svg\n[deps-svg]: https://david-dm.org/ljharb/es-to-primitive.svg\n[deps-url]: https://david-dm.org/ljharb/es-to-primitive\n[dev-deps-svg]: https://david-dm.org/ljharb/es-to-primitive/dev-status.svg\n[dev-deps-url]: https://david-dm.org/ljharb/es-to-primitive#info=devDependencies\n[npm-badge-png]: https://nodei.co/npm/es-to-primitive.png?downloads=true&stars=true\n[license-image]: https://img.shields.io/npm/l/es-to-primitive.svg\n[license-url]: LICENSE\n[downloads-image]: https://img.shields.io/npm/dm/es-to-primitive.svg\n[downloads-url]: https://npm-stat.com/charts.html?package=es-to-primitive\n[codecov-image]: https://codecov.io/gh/ljharb/es-to-primitive/branch/main/graphs/badge.svg\n[codecov-url]: https://app.codecov.io/gh/ljharb/es-to-primitive/\n[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/es-to-primitive\n[actions-url]: https://github.com/ljharb/es-to-primitive/actions\n","_attachments":{},"homepage":"https://github.com/ljharb/es-to-primitive#readme","bugs":{"url":"https://github.com/ljharb/es-to-primitive/issues"},"license":"MIT"}