Code Monkey home page Code Monkey logo

guid-typescript's People

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

Watchers

 avatar  avatar

guid-typescript's Issues

ERROR in ./node_modules/guid-typescript/src/guid.ts

I'm getting this error when I'm executing npm run build in angular cli project

ERROR in ./node_modules/guid-typescript/src/guid.ts
Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
Error: /.../dev/management/mgmt-console/node_modules/guid-typescript/src/guid.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
The missing file seems to be part of a third party library. TS files in published libraries are often a sign of a badly packaged library. Please open an issue in the library repository to alert its author and ask them to package the library using the Angular Package Format (https://goo.gl/jB3GVv).
at AngularCompilerPlugin.getCompiledFile (/.../dev/management/mgmt-console/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:834:23)
at /.../dev/management/mgmt-console/node_modules/@ngtools/webpack/src/loader.js:41:31
at processTicksAndRejections (internal/process/task_queues.js:89:5)

Heed of warning - avoid use

Although I appreciate the existence of this package, there are multiple problems with it:

  • Barely maintained, and PR's changes are very breaking. This is a near-PRIMITIVE type, but the implementation is not consistent. This means people will have to change their whole project :S (as I have to do now)
  • Outputs any on toJSON() with a property:value structure. This is not how I would serialize, and it is quite a dealbreaker. I would serialize in a flat manner value directly, which is consistent with f.e. C#. Now I have to intercept the Guid and fix it.
  • People should implement the Guid Primitive themselves by looking at a gist, instead of relying on something which doesnt fit all. Having total control over the guid's serialization setting is a must.

Again, I really appreciate the package and the effort, but the fact that there are so many downloads made me very worried. This is one of the most used primitives on an API side (especially .NET Core).

I can PR something, but looking at the current amount of open PR's those should be processed first. I understand the backwards-compatible hold-up, but this is a limbo state.

No License file or version tags

I love this library but am having issues getting it approved for use in a production environment.

At https://www.npmjs.com/package/guid-typescript you indicate that the license is ISC but there is no License file within the repository. Would it be possible to add one?

Also, would it be possible to tag the commits that form each new version? There are 10 versions in npm but it is awkward to find historically what the last commit was for each version. Basically the managers want snapshots of the repository with the License file at a particular point in time so they can approve those.

Many thanks

Import statement not working

import { Guid } from "guid-typescript"; causes error TS2307: Cannot find module 'guid-typescript'.

import { Guid } from "guid-typescript/dist/guid"; fixes it

Guid comparisons are case sensitive.

The Equals is case sensitive. Can we make this case invariant?

it('test guid library', () => {
    const lowerCaseGuid: Guid = Guid.parse('00000001-0001-5365-7276-70726f496e63');
    const upperCaseGuid: Guid = Guid.parse('00000001-0001-5365-7276-70726F496E63');
 
    const areEqual = lowerCaseGuid.equals(upperCaseGuid);
 
    expect(areEqual).toBe(true);
});

The unit test above is failing.

toString returns [Object object]

Hi, I'm using this in Ionic 4 and wasn't able to get the value of the GUID using .toString(), as it returns "[Object object]" as though it's using the normal toString instead of your class one, although hovering on it does indicate it uses the right one. using .toJSON also didn't work, as it said "is not a function".

I was only able to get the value using
var stringId = JSON.stringify(id);
var json =JSON.parse(stringId);

isGuid() should return FALSE for null, undefined, and ""

Right now "isGuid()" throws an exception if you pass it null or undefined... and this function (which is defined as returning a boolean) returns a blank string if you pass it a blank string (which makes no sense).

"isGuid()" should return FALSE for null, undefined, or blank string.

Protected constructor for extension

Hi,

Could you consider to switch the constructor from private to protected in order to extend the Guid class to override some methods (in my case the toJSON method).

Thanks

Support for non-dashed Guids

Guids can be, and are in some cases, represented without dashes. Under the covers they are a 128 bit integer and the dashes are primarily there for readability and segmentation of their source components. Would you be willing to update the regex to consider the dashes optional, or to include a statement with and without the dashes so they are either all there or all not there?

For some reference, RFC 4122 does specify that the format should include dashes, but in real world implementation many libraries I've used support native handling of non-dashed values. For instance, .NET allows for:
Guid.NewGuid().ToString("N") // outputs: 603626753d4a4d53bdb3c4374b49aa3e
And this value can be successfully parsed using
Guid.Parse("603626753d4a4d53bdb3c4374b49aa3e");

For usage cases, I've often used Guids without the dashes to represent a random token without the added complexity of dashes when they aren't adding value.

Thanks for creating this package!

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.