Coder Social home page Coder Social logo

is-promise's People

Contributors

chocolateboy avatar edef1c avatar floatdrop avatar forbeslindesay avatar itsjw avatar masterzsh avatar nhunzaker avatar nikksan avatar rkatic avatar ryanzim avatar wincent avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

is-promise's Issues

Checking obj.catch

Just got caught up using is-promise with a jQuery.Deferred as then is defined but catch is not. Since this is is-promise and not is-thenable I figured it might be a good idea to check catch as well.

return !!obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function' && typeof obj.catch === 'function';

v2.2.0 issue with `npx create-react-app`

npx create-react-app test

npx: installed 99 in 6.053s
Must use import to load ES Module: /Users/<REDACTED>/.npm/_npx/93178/lib/node_modules/create-react-app/node_modules/is-promise/index.js
require() of ES modules is not supported.
require() of /Users/<REDACTED>/.npm/_npx/93178/lib/node_modules/create-react-app/node_modules/is-promise/index.js from /Users/<REDACTED>/.npm/_npx/93178/lib/node_modules/create-react-app/node_modules/run-async/index.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename /Users/<REDACTED>/.npm/_npx/93178/lib/node_modules/create-react-app/node_modules/is-promise/index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /Users/<REDACTED>/.npm/_npx/93178/lib/node_modules/create-react-app/node_modules/is-promise/package.json.```

Invalid configuration error

When I run a React Native app, the following warning appear in the console.

Someone know what is this?

Package is-promise has been ignored because it contains invalid configuration.
Reason: Package subpath './package.json' is not defined by "exports" in node_modules/is-promise/package.json

Why would I use this?

I don't think this is a very useful snippet, sorry.

console.log(isPromise({then: () => {}}));

Problem in creating "create-react-app"

I used:

npx create-react-app userbase

to create my react app but I got some weird error

internal/modules/cjs/loader.js:1173
      throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath);
      ^

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: C:\Users\yoges\AppData\Roaming\npm\node_modules\create-react-app\node_modules\is-promise\index.js
require() of ES modules is not supported.
require() of C:\Users\yoges\AppData\Roaming\npm\node_modules\create-react-app\node_modules\is-promise\index.js from C:\Users\yoges\AppData\Roaming\npm\node_modules\create-react-app\node_modules\run-async\index.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename C:\Users\yoges\AppData\Roaming\npm\node_modules\create-react-app\node_modules\is-promise\index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from C:\Users\yoges\AppData\Roaming\npm\node_modules\create-react-app\node_modules\is-promise\package.json.

    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1173:13)
    at Module.load (internal/modules/cjs/loader.js:1001:32)
    at Function.Module._load (internal/modules/cjs/loader.js:900:14)
    at Module.require (internal/modules/cjs/loader.js:1043:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object.<anonymous> (C:\Users\yoges\AppData\Roaming\npm\node_modules\create-react-app\node_modules\run-async\index.js:3:17)
    at Module._compile (internal/modules/cjs/loader.js:1157:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1177:10)
    at Module.load (internal/modules/cjs/loader.js:1001:32)
    at Function.Module._load (internal/modules/cjs/loader.js:900:14) {
  code: 'ERR_REQUIRE_ESM'
}

How can I solve this?!

No lock file found in the ispromise project on Tag: 4.0.0

Issue: There is no package-lock.json or npm-shrinkwrap.json file uploaded to the GitHub repository https://github.com/then/is-promise

Questions: We are conducting a research study on the lock files used in JS projects. We were curious:

  1. Will you upload any lock files to GitHub as recommended above? (Yes/No), and why?:
  2. Do you have any additional comments? (If so, please write it down):

For any publication or research report based on this study, we will share all responses from developers in an anonymous way. Both your projects and personal information will be kept confidential.

Rationale: NPM introduced package-lock.json and npm-shrimpwrap.json files to capture the exact dependency tree installed at any point in time. When package.json defines the required dependencies and their respective versions using semantic versioning (e.g., “express”: “^4.16.4”), npm always downloads the latest version of packages to satisfy the specified version ranges (e.g., 4.17.1)[1]. If the latest version of any package keeps changing and has backward incompatibility issues with previous versions, the project may have an inconsistent running environment and get intermittent failures. In such scenarios, it can be very difficult for developers to debug programs and settle down the software environment [2].

List of Risks:

  • Nondeterministic package downloads and installations across different environments [3]
  • Produce irreproducible builds [4]
  • Inconsistent results of program execution [5]

Suggested Solution: Please fixate the dependencies by either specifying the exact library version in the package.json file or by uploading the package-lock.json or npm-shrinkwrap.json file to GitHub.

References:
https://docs.npmjs.com/cli/v7/configuring-npm/package-lock-json
https://blog.logrocket.com/why-you-should-use-package-lock-json/
2019. 10 npm Security Best Practices. https://snyk.io/blog/ten-npm-security-best-practices/.
Pronnoy Goswami, Saksham Gupta, Zhiyuan Li, Na Meng, and Daphne Yao. 2020. Investigating The Reproducibility of NPM Packages. In2020 IEEE International
2021. Npm Security Best Practices. https://bytesafe.dev/posts/npm-security-best-practices/#no9-deterministic-results.

Wrong type guard!

The guard should use PromiseLike<T>, not Promise<T>.

If a thenable can be considered a Promise/A+ promise ("if it looks like a duck, it is a duck"), it certainly does not means it's also a ES Promise (which also has catch and finally).
Therefore the PromiseLike in TypeScript.

ERR_INVALID_PACKAGE_TARGET

The module fails to import with node v13.12.0. The version 2.1.0 still works fine.

sorunome@sorunome-desktop repos/mx-puppet-skype $ node ./build/index.js                                 1
internal/modules/cjs/loader.js:616
            if (e.code !== 'ERR_PACKAGE_PATH_NOT_EXPORTED') throw e;
                                                            ^

Error [ERR_INVALID_PACKAGE_TARGET]: Invalid "exports" main target "index.js" defined in the package config /home/sorunome/repos/mx-puppet-skype/node_modules/is-promise/package.json
    at resolveExportsTarget (internal/modules/cjs/loader.js:574:13)
    at resolveExportsTarget (internal/modules/cjs/loader.js:613:20)
    at applyExports (internal/modules/cjs/loader.js:503:14)
    at resolveExports (internal/modules/cjs/loader.js:541:12)
    at Function.Module._findPath (internal/modules/cjs/loader.js:661:22)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:963:27)
    at Function.Module._load (internal/modules/cjs/loader.js:859:27)
    at Module.require (internal/modules/cjs/loader.js:1036:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/home/sorunome/repos/mx-puppet-skype/node_modules/lowdb/lib/main.js:4:17) {
  code: 'ERR_INVALID_PACKAGE_TARGET'
}

Why the overly specific test?

Hey,

I see a commit message for the stricter test, but it's not clear why's that extra processing good. Perhaps you can share some light. Thanks!

Breaking change in minor version

Adding "exports" is a breaking change, and should not have happened in v2.2.0. Please release a new v2 that does not have "exports" and does not use type:module or ESM, and then rerelease as v3.

Creating Nuxt.js website fails because of is-promise

Hi everyone

Bear with me, this is the first time I open up an issue as a junior developer. I'm trying to create a Nuxt.js website but when I try to create it, it fails and your module has something to do with it.

Are you guys aware of the issue or not? Not entirely sure if this is the way to address this issue since it's Nuxt.js related but I think this module is causing the failure.

Sorry if this has been submitted in the wrong place. Then just delete it but maybe this will get me more answers 😅

"exports" config

Please comment on this issue if you are still experiencing issues wen upgrading to 2.2.1

Angular build is failing because of is-promise

  • Angular build is failing in Github actions, the error seems to be related to is-promise
Unknown error: Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /home/runner/work/codeJunction-site/codeJunction-site/node_modules/is-promise/index.js
require() of ES modules is not supported.
require() of /home/runner/work/codeJunction-site/codeJunction-site/node_modules/is-promise/index.js from /home/runner/work/codeJunction-site/codeJunction-

License

Would it be possible to include a LICENSE file with the text of the license agreement?
Our lawyers are saying that just having "License: MIT" is not sufficient.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.