Ignore:
Timestamp:
01/21/25 03:08:24 (2 weeks ago)
Author:
stefan toskovski <stefantoska84@…>
Branches:
main
Parents:
0c6b92a
Message:

F4 Finalna Verzija

File:
1 edited

Legend:

Unmodified
Added
Removed
  • imaps-frontend/node_modules/is-string/index.js

    r0c6b92a r79a0317  
    11'use strict';
    22
    3 var strValue = String.prototype.valueOf;
     3var callBound = require('call-bound');
     4
     5/** @type {(receiver: ThisParameterType<typeof String.prototype.valueOf>, ...args: Parameters<typeof String.prototype.valueOf>) => ReturnType<typeof String.prototype.valueOf>} */
     6var $strValueOf = callBound('String.prototype.valueOf');
     7
     8/** @type {import('.')} */
    49var tryStringObject = function tryStringObject(value) {
    510        try {
    6                 strValue.call(value);
     11                $strValueOf(value);
    712                return true;
    813        } catch (e) {
     
    1015        }
    1116};
    12 var toStr = Object.prototype.toString;
     17/** @type {(receiver: ThisParameterType<typeof Object.prototype.toString>, ...args: Parameters<typeof Object.prototype.toString>) => ReturnType<typeof Object.prototype.toString>} */
     18var $toString = callBound('Object.prototype.toString');
    1319var strClass = '[object String]';
    1420var hasToStringTag = require('has-tostringtag/shams')();
    1521
     22/** @type {import('.')} */
    1623module.exports = function isString(value) {
    1724        if (typeof value === 'string') {
    1825                return true;
    1926        }
    20         if (typeof value !== 'object') {
     27        if (!value || typeof value !== 'object') {
    2128                return false;
    2229        }
    23         return hasToStringTag ? tryStringObject(value) : toStr.call(value) === strClass;
     30        return hasToStringTag ? tryStringObject(value) : $toString(value) === strClass;
    2431};
Note: See TracChangeset for help on using the changeset viewer.