demo___customer_pitch-c4152739-a50b-4b5b-9d4d-0561461666d9.zip-extract/_dependencies/npm/get-proto-1.0.1/test/index.js

Path
demo___customer_pitch-c4152739-a50b-4b5b-9d4d-0561461666d9.zip-extract/_dependencies/npm/get-proto-1.0.1/test/index.js
Status
scanned
Type
file
Name
index.js
Extension
.js
Programming language
JavaScript
Mime type
text/plain
File type
UTF-8 Unicode text
Tag

      
    
Rootfs path

      
    
Size
2359 (2.3 KB)
MD5
abe1245475a8d54cd19a9ead3357e731
SHA1
c337fcaffa064600fb084305a27d2237d9e2b339
SHA256
1f4edb40034d0c23400ab56be0d20fd8bc2cee1aeb4298905b2eb5e78e946a56
SHA512

      
    
SHA1_git
5a2ece252d1aaa7f2bc64e7eb958278a42c944dc
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
index.js | 2.3 KB |

'use strict'; var test = require('tape'); var getProto = require('../'); test('getProto', function (t) { t.equal(typeof getProto, 'function', 'is a function'); t.test('can get', { skip: !getProto }, function (st) { if (getProto) { // TS doesn't understand tape's skip var proto = { b: 2 }; st.equal(getProto(proto), Object.prototype, 'proto: returns the [[Prototype]]'); st.test('nullish value', function (s2t) { // @ts-expect-error s2t['throws'](function () { return getProto(undefined); }, TypeError, 'undefined is not an object'); // @ts-expect-error s2t['throws'](function () { return getProto(null); }, TypeError, 'null is not an object'); s2t.end(); }); // @ts-expect-error st['throws'](function () { getProto(true); }, 'throws for true'); // @ts-expect-error st['throws'](function () { getProto(false); }, 'throws for false'); // @ts-expect-error st['throws'](function () { getProto(42); }, 'throws for 42'); // @ts-expect-error st['throws'](function () { getProto(NaN); }, 'throws for NaN'); // @ts-expect-error st['throws'](function () { getProto(0); }, 'throws for +0'); // @ts-expect-error st['throws'](function () { getProto(-0); }, 'throws for -0'); // @ts-expect-error st['throws'](function () { getProto(Infinity); }, 'throws for ∞'); // @ts-expect-error st['throws'](function () { getProto(-Infinity); }, 'throws for -∞'); // @ts-expect-error st['throws'](function () { getProto(''); }, 'throws for empty string'); // @ts-expect-error st['throws'](function () { getProto('foo'); }, 'throws for non-empty string'); st.equal(getProto(/a/g), RegExp.prototype); st.equal(getProto(new Date()), Date.prototype); st.equal(getProto(function () {}), Function.prototype); st.equal(getProto([]), Array.prototype); st.equal(getProto({}), Object.prototype); var nullObject = { __proto__: null }; if ('toString' in nullObject) { st.comment('no null objects in this engine'); st.equal(getProto(nullObject), Object.prototype, '"null" object has Object.prototype as [[Prototype]]'); } else { st.equal(getProto(nullObject), null, 'null object has null [[Prototype]]'); } } st.end(); }); t.test('can not get', { skip: !!getProto }, function (st) { st.equal(getProto, null); st.end(); }); t.end(); });
Package URL License Primary language
pkg:npm/acme-demo-app@1.0.0 JavaScript
pkg:npm/get-proto@1.0.1 mit JavaScript