All Projects → ljharb → es-to-primitive

ljharb / es-to-primitive

Licence: MIT License
ECMAScript "ToPrimitive" algorithm. Provides ES5 and ES6/ES2015 versions.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to es-to-primitive

Jasmine Spec Reporter
Real time console spec reporter for jasmine testing framework
Stars: ✭ 241 (+1047.62%)
Mutual labels:  spec
oci-spec-rs
OCI Runtime, Image and Distribution Spec in Rust
Stars: ✭ 117 (+457.14%)
Mutual labels:  spec
dataset
qri dataset definition
Stars: ✭ 16 (-23.81%)
Mutual labels:  spec
api-spec
API Specififications
Stars: ✭ 30 (+42.86%)
Mutual labels:  spec
speck
A concise and composable syntax for your function specs
Stars: ✭ 53 (+152.38%)
Mutual labels:  spec
framework
Lightweight, open source and magic-free framework for testing solidity smart contracts.
Stars: ✭ 36 (+71.43%)
Mutual labels:  spec
Inspec
InSpec: Auditing and Testing Framework
Stars: ✭ 2,450 (+11566.67%)
Mutual labels:  spec
wdio-spec-reporter
A WebdriverIO v4 plugin. Reporter that creates 'spec'-style reports
Stars: ✭ 20 (-4.76%)
Mutual labels:  spec
geojson.specs
a Geojson utility for validating data using Clojure(script)'s spec (RFC 7946)
Stars: ✭ 18 (-14.29%)
Mutual labels:  spec
values
Library to wrap PHP's primitive values into cleaner and more user-friendly objects.
Stars: ✭ 29 (+38.1%)
Mutual labels:  primitive
accumulator
Cryptographic accumulators in Rust.
Stars: ✭ 115 (+447.62%)
Mutual labels:  primitive
dropbox-api-spec
The Official API Spec for Dropbox API V2 SDKs.
Stars: ✭ 36 (+71.43%)
Mutual labels:  spec
rocPRIM
ROCm Parallel Primitives
Stars: ✭ 95 (+352.38%)
Mutual labels:  primitive
Specs
The Filecoin protocol specification
Stars: ✭ 249 (+1085.71%)
Mutual labels:  spec
es-abstract
ECMAScript spec abstract operations.
Stars: ✭ 86 (+309.52%)
Mutual labels:  spec
Js.spec
clojure.spec for Javascript
Stars: ✭ 223 (+961.9%)
Mutual labels:  spec
spec-kemal
Easy testing for Kemal
Stars: ✭ 51 (+142.86%)
Mutual labels:  spec
meta-schema
Little DSL to make data processing sane with clojure.spec and spec-tools
Stars: ✭ 25 (+19.05%)
Mutual labels:  spec
falcon-apispec
apispec plugin that generates OpenAPI specification (aka Swagger Docs) for Falcon web applications.
Stars: ✭ 44 (+109.52%)
Mutual labels:  spec
is-primitive
Is the typeof value a javascript primitive?
Stars: ✭ 35 (+66.67%)
Mutual labels:  primitive

es-to-primitive Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

ECMAScript “ToPrimitive” algorithm. Provides ES5 and ES2015 versions. When different versions of the spec conflict, the default export will be the latest version of the abstract operation. Alternative versions will also be available under an es5/es2015 exported property if you require a specific version.

Example

var toPrimitive = require('es-to-primitive');
var assert = require('assert');

assert(toPrimitive(function () {}) === String(function () {}));

var date = new Date();
assert(toPrimitive(date) === String(date));

assert(toPrimitive({ valueOf: function () { return 3; } }) === 3);

assert(toPrimitive(['a', 'b', 3]) === String(['a', 'b', 3]));

var sym = Symbol();
assert(toPrimitive(Object(sym)) === sym);

Tests

Simply clone the repo, npm install, and run npm test

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].