Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[jest-get-type] Add isPrimitive function #7708

Merged
merged 11 commits into from
Feb 28, 2019

Conversation

mattphillips
Copy link
Contributor

Summary

Add isPrimitive function to jest-get-type.

See @rubennorte's comment here #7694 (comment)

Test plan

See unit tests.

packages/jest-get-type/src/isPrimitive.js Outdated Show resolved Hide resolved
packages/jest-get-type/src/index.js Outdated Show resolved Hide resolved
@SimenB SimenB force-pushed the get-type-is-primitive branch from c943532 to 2c9e816 Compare February 28, 2019 13:23
@SimenB
Copy link
Member

SimenB commented Feb 28, 2019

Alright, this should be good to go (and not breaking). Generated type defs are:

/**
 * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
declare type ValueType = 'array' | 'boolean' | 'function' | 'null' | 'number' | 'object' | 'regexp' | 'map' | 'set' | 'date' | 'string' | 'symbol' | 'undefined';
declare function getType(value: unknown): ValueType;
declare namespace getType {
    var isPrimitive: (value: unknown) => boolean;
}
export = getType;
//# sourceMappingURL=index.d.ts.map

@SimenB SimenB merged commit 5d2d46f into jestjs:master Feb 28, 2019
@codecov-io
Copy link

Codecov Report

Merging #7708 into master will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7708      +/-   ##
==========================================
- Coverage   64.18%   64.17%   -0.01%     
==========================================
  Files         259      259              
  Lines       10135    10134       -1     
  Branches     1752     1752              
==========================================
- Hits         6505     6504       -1     
  Misses       3246     3246              
  Partials      384      384
Impacted Files Coverage Δ
packages/jest-get-type/src/index.ts 90% <100%> (+0.34%) ⬆️
packages/jest-each/src/bind.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update df3eb5e...e5384cf. Read the comment docs.

'boolean',
'null',
'undefined',
'symbol',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've already merged this, but I'm not sure if I agree Symbol is a primitive type?

/cc @mattphillips

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://leanpub.com/understandinges6/read#leanpub-auto-symbols-and-symbol-properties

Symbols are a primitive type introduced in ECMAScript 6, joining the existing primitive types: strings, numbers, booleans, null, and undefined.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the link 🙏

@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants