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

rdf-object

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rdf-object - npm Package Compare versions

Comparing version 1.4.2 to 1.5.0

6

CHANGELOG.md
# Changelog
All notable changes to this project will be documented in this file.
<a name="v1.5.0"></a>
## [v1.5.0](https://github.com/rubensworks/rdf-object.js/compare/v1.4.2...v1.5.0) - 2020-11-17
### Added
* [Allow compacted string parameters in Resource#isA](https://github.com/rubensworks/rdf-object.js/commit/d63d9b63dcd9acaf0191d94ae3af77463c5abdf4)
<a name="v1.4.2"></a>

@@ -5,0 +11,0 @@ ## [v1.4.2](https://github.com/rubensworks/rdf-object.js/compare/v1.4.1...v1.4.2) - 2020-11-10

5

lib/Resource.d.ts

@@ -7,2 +7,3 @@ import { JsonLdContextNormalized } from 'jsonld-context-parser';

export declare class Resource {
private readonly context;
readonly term: RDF.Term;

@@ -33,6 +34,6 @@ readonly predicates: Resource[];

*
* @param {Term} type An RDF term.
* @param {RDF.Term | string} type An RDF term or a compacted term string.
* @return {boolean} If this resource is of the given type.
*/
isA(type: RDF.Term): boolean;
isA(type: RDF.Term | string): boolean;
/**

@@ -39,0 +40,0 @@ * Add a property to the given resource.

13

lib/Resource.js

@@ -13,6 +13,7 @@ "use strict";

constructor(args) {
this.context = args.context || new jsonld_context_parser_1.JsonLdContextNormalized({});
this.term = args.term;
this.predicates = [];
this.propertiesUri = {};
this.properties = new Proxy(this.propertiesUri, new ShortcutPropertyHandler_1.ShortcutPropertyHandler(args.context || new jsonld_context_parser_1.JsonLdContextNormalized({})));
this.properties = new Proxy(this.propertiesUri, new ShortcutPropertyHandler_1.ShortcutPropertyHandler(this.context));
this.property = new Proxy(this.properties, new SingularPropertyHandler_1.SingularPropertyHandler());

@@ -42,6 +43,14 @@ }

*
* @param {Term} type An RDF term.
* @param {RDF.Term | string} type An RDF term or a compacted term string.
* @return {boolean} If this resource is of the given type.
*/
isA(type) {
// Consider strings compacted terms
if (typeof type === 'string') {
const typeExpanded = this.context.expandTerm(type, true);
if (!typeExpanded) {
return false;
}
type = rdf_string_1.stringToTerm(typeExpanded);
}
if (type.equals(this.term)) {

@@ -48,0 +57,0 @@ return true;

{
"name": "rdf-object",
"version": "1.4.2",
"version": "1.5.0",
"description": "Loads RDF as JSON objects",

@@ -5,0 +5,0 @@ "keywords": [

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