Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@qeepsake/rails-guid

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@qeepsake/rails-guid - npm Package Compare versions

Comparing version 1.3.0 to 1.4.0

lib/is-rails-id.d.ts

1

lib/index.d.ts
export { extractRailsId } from './extract-rails-id';
export { createRailsId } from './create-rails-id';
export { isExtractedRailsId } from './is-extracted-rails-id';
export { isRailsId } from './is-rails-id';

@@ -38,5 +38,11 @@ function isExtractedRailsId(id) {

function isRailsId(str) {
var pattern = /^gid:\/\/[^\/]+\/[a-zA-Z]+\/\d+$/;
return pattern.test(str);
}
exports.createRailsId = createRailsId;
exports.extractRailsId = extractRailsId;
exports.isExtractedRailsId = isExtractedRailsId;
exports.isRailsId = isRailsId;
//# sourceMappingURL=index.js.map

@@ -38,3 +38,8 @@ function isExtractedRailsId(id) {

export { createRailsId, extractRailsId, isExtractedRailsId };
function isRailsId(str) {
var pattern = /^gid:\/\/[^\/]+\/[a-zA-Z]+\/\d+$/;
return pattern.test(str);
}
export { createRailsId, extractRailsId, isExtractedRailsId, isRailsId };
//# sourceMappingURL=index.modern.js.map

2

package.json
{
"name": "@qeepsake/rails-guid",
"version": "1.3.0",
"version": "1.4.0",
"description": "Tiny (zero dependancy) utility to create and extract rails guid strings in JavaScript 🛤",

@@ -5,0 +5,0 @@ "author": "lukebrandonfarrell",

@@ -49,2 +49,16 @@ # Rails Guid for JavaScript

### Testing for Rails Global ID
You can use `isRailsId`` to test if a string is a valid Rails Global ID:
```js
import { isRailsId } from '@qeepsake/rails-guid';
isRailsId("gid://qeepsake-rails/User/1") // => true
isRailsId("gid://someotherapp/User/1") // => true
isRailsId("User/1") // => false
```
This function tests if the string conforms to the general Rails gid structure: `gid://<ANY_APP_NAME>/<MODEL_NAME>/<ID>`.
## License

@@ -51,0 +65,0 @@

export { extractRailsId } from './extract-rails-id'
export { createRailsId } from './create-rails-id'
export { isExtractedRailsId } from './is-extracted-rails-id'
export { isRailsId } from './is-rails-id'

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc