siren-parser
Advanced tools
Comparing version 6.5.0 to 6.6.0
@@ -1,2 +0,2 @@ | ||
(function(f){var g;if(typeof window!=='undefined'){g=window}else if(typeof self!=='undefined'){g=self}g=g.D2L||(g.D2L={});g=g.Hypermedia||(g.Hypermedia={});g=g.Siren||(g.Siren={});g.Parse=f()})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
(function(f){var g;if(typeof window!=='undefined'){g=window}else if(typeof self!=='undefined'){g=self}g=g.D2L||(g.D2L={});g=g.Hypermedia||(g.Hypermedia={});g=g.Siren||(g.Siren={});g.Parse=f()})(function(){var define,module,exports;return (function(){function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}return e})()({1:[function(require,module,exports){ | ||
"use strict";function Action(t){var e=this;return t instanceof Action?t:this instanceof Action?(assert("object"===(void 0===t?"undefined":_typeof(t)),"action must be an object, got "+JSON.stringify(t)),assert("string"==typeof t.name,"action.name must be a string, got "+JSON.stringify(t.name)),assert("string"==typeof t.href,"action.href must be a string, got "+JSON.stringify(t.href)),assert(void 0===t.class||Array.isArray(t.class),"action.class must be an array or undefined, got "+JSON.stringify(t.class)),assert(void 0===t.method||"string"==typeof t.method,"action.method must be a string or undefined, got "+JSON.stringify(t.method)),assert(void 0===t.title||"string"==typeof t.title,"action.title must be a string or undefined, got "+JSON.stringify(t.title)),assert(void 0===t.type||"string"==typeof t.type,"action.type must be a string or undefined, got "+JSON.stringify(t.type)),assert(void 0===t.fields||Array.isArray(t.fields),"action.fields must be an array or undefined, got "+JSON.stringify(t.fields)),this.name=t.name,this.href=t.href,t.class&&(this.class=t.class),this.method=t.method||"GET",t.title&&(this.title=t.title),this.type=t.type||"application/x-www-form-urlencoded",this._fieldsByName={},this._fieldsByClass={},this._fieldsByType={},void(t.fields&&(this.fields=[],t.fields.forEach(function(t){var i=new Field(t);e.fields.push(i),e._fieldsByName[t.name]=i,i.type&&(e._fieldsByType[i.type]=e._fieldsByType[i.type]||[],e._fieldsByType[i.type].push(i)),i.class&&i.class.forEach(function(t){e._fieldsByClass[t]=e._fieldsByClass[t]||[],e._fieldsByClass[t].push(i)})}),this.fields=t.fields))):new Action(t)}var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},assert=require("./assert"),Field=require("./Field"),util=require("./util");Action.prototype.hasClass=function(t){return this.class instanceof Array&&util.contains(this.class,t)},Action.prototype.hasField=function(t){return this.hasFieldByName(t)},Action.prototype.hasFieldByName=function(t){return util.hasProperty(this._fieldsByName,t)},Action.prototype.hasFieldByClass=function(t){return util.hasProperty(this._fieldsByClass,t)},Action.prototype.hasFieldByType=function(t){return util.hasProperty(this._fieldsByType,t)},Action.prototype.getField=function(t){return this.getFieldByName(t)},Action.prototype.getFieldByName=function(t){return util.getMatchingValue(this._fieldsByName,t)},Action.prototype.getFieldByClass=function(t){var e=util.getMatchingValue(this._fieldsByClass,t);return e?e[0]:void 0},Action.prototype.getFieldsByClass=function(t){var e=util.getMatchingValue(this._fieldsByClass,t);return e?e.slice():[]},Action.prototype.getFieldByClasses=function(t){var e=util.getMatchingValuesByAll(this.fields,t,"class");return e&&e.length>0?e[0]:void 0},Action.prototype.getFieldsByClasses=function(t){var e=util.getMatchingValuesByAll(this.fields,t,"class");return e&&e.length>0?e.slice():[]},Action.prototype.getFieldByType=function(t){var e=util.getMatchingValue(this._fieldsByType,t);return e?e[0]:void 0},Action.prototype.getFieldsByType=function(t){var e=util.getMatchingValue(this._fieldsByType,t);return e?e.slice():[]},module.exports=Action; | ||
@@ -3,0 +3,0 @@ |
@@ -1,2 +0,2 @@ | ||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g=(g.D2L||(g.D2L = {}));g=(g.Hypermedia||(g.Hypermedia = {}));g=(g.Siren||(g.Siren = {}));g.Parse = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
(function(f){var g;if(typeof window!=='undefined'){g=window}else if(typeof self!=='undefined'){g=self}g=g.D2L||(g.D2L={});g=g.Hypermedia||(g.Hypermedia={});g=g.Siren||(g.Siren={});g.Parse=f()})(function(){var define,module,exports;return (function(){function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}return e})()({1:[function(require,module,exports){ | ||
"use strict";function Action(t){var e=this;return t instanceof Action?t:this instanceof Action?(assert("object"===(void 0===t?"undefined":_typeof(t)),"action must be an object, got "+JSON.stringify(t)),assert("string"==typeof t.name,"action.name must be a string, got "+JSON.stringify(t.name)),assert("string"==typeof t.href,"action.href must be a string, got "+JSON.stringify(t.href)),assert(void 0===t.class||Array.isArray(t.class),"action.class must be an array or undefined, got "+JSON.stringify(t.class)),assert(void 0===t.method||"string"==typeof t.method,"action.method must be a string or undefined, got "+JSON.stringify(t.method)),assert(void 0===t.title||"string"==typeof t.title,"action.title must be a string or undefined, got "+JSON.stringify(t.title)),assert(void 0===t.type||"string"==typeof t.type,"action.type must be a string or undefined, got "+JSON.stringify(t.type)),assert(void 0===t.fields||Array.isArray(t.fields),"action.fields must be an array or undefined, got "+JSON.stringify(t.fields)),this.name=t.name,this.href=t.href,t.class&&(this.class=t.class),this.method=t.method||"GET",t.title&&(this.title=t.title),this.type=t.type||"application/x-www-form-urlencoded",this._fieldsByName={},this._fieldsByClass={},this._fieldsByType={},void(t.fields&&(this.fields=[],t.fields.forEach(function(t){var i=new Field(t);e.fields.push(i),e._fieldsByName[t.name]=i,i.type&&(e._fieldsByType[i.type]=e._fieldsByType[i.type]||[],e._fieldsByType[i.type].push(i)),i.class&&i.class.forEach(function(t){e._fieldsByClass[t]=e._fieldsByClass[t]||[],e._fieldsByClass[t].push(i)})}),this.fields=t.fields))):new Action(t)}var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},assert=require("./assert"),Field=require("./Field"),util=require("./util");Action.prototype.hasClass=function(t){return this.class instanceof Array&&util.contains(this.class,t)},Action.prototype.hasField=function(t){return this.hasFieldByName(t)},Action.prototype.hasFieldByName=function(t){return util.hasProperty(this._fieldsByName,t)},Action.prototype.hasFieldByClass=function(t){return util.hasProperty(this._fieldsByClass,t)},Action.prototype.hasFieldByType=function(t){return util.hasProperty(this._fieldsByType,t)},Action.prototype.getField=function(t){return this.getFieldByName(t)},Action.prototype.getFieldByName=function(t){return util.getMatchingValue(this._fieldsByName,t)},Action.prototype.getFieldByClass=function(t){var e=util.getMatchingValue(this._fieldsByClass,t);return e?e[0]:void 0},Action.prototype.getFieldsByClass=function(t){var e=util.getMatchingValue(this._fieldsByClass,t);return e?e.slice():[]},Action.prototype.getFieldByClasses=function(t){var e=util.getMatchingValuesByAll(this.fields,t,"class");return e&&e.length>0?e[0]:void 0},Action.prototype.getFieldsByClasses=function(t){var e=util.getMatchingValuesByAll(this.fields,t,"class");return e&&e.length>0?e.slice():[]},Action.prototype.getFieldByType=function(t){var e=util.getMatchingValue(this._fieldsByType,t);return e?e[0]:void 0},Action.prototype.getFieldsByType=function(t){var e=util.getMatchingValue(this._fieldsByType,t);return e?e.slice():[]},module.exports=Action; | ||
@@ -3,0 +3,0 @@ |
{ | ||
"name": "siren-parser", | ||
"version": "6.5.0", | ||
"version": "6.6.0", | ||
"description": "Pretty much the opposite of dominicbarnes/node-siren-writer", | ||
@@ -9,3 +9,3 @@ "main": "src/Entity.js", | ||
"browserify": "npm run browserify:umd && npm run browserify:global", | ||
"browserify:umd": "browserify -g uglifyify -s 'D2L.Hypermedia.Siren.Parse' src/Entity.js > ./dist/siren-parser.js", | ||
"browserify:umd": "browserify -g uglifyify -p deumdify -s 'D2L.Hypermedia.Siren.Parse' src/Entity.js > ./dist/siren-parser.js", | ||
"browserify:global": "browserify -g uglifyify -p deumdify -s 'D2L.Hypermedia.Siren.Parse' src/Entity.js > ./dist/siren-parser-global.js", | ||
@@ -12,0 +12,0 @@ "lint": "eslint --ignore-path .gitignore .", |
@@ -9,3 +9,3 @@ # node-siren-parser | ||
There are two ways to use `node-siren-parser`'s functionality. | ||
There are three ways to use `node-siren-parser`'s functionality. | ||
@@ -18,3 +18,5 @@ 1. You can install it from npm using | ||
2. The parser is browserified and stored on the Brightspace CDN for client-side usage | ||
2. An HTML import version of the parser is available via [`siren-parser-import`](https://github.com/Brightspace/siren-parser-import) (recommended approach for client-side usage). | ||
3. Alternatively, the parser is browserified and stored on the Brightspace CDN for client-side usage | ||
```html | ||
@@ -27,8 +29,6 @@ <script src="https://s.brightspace.com/lib/siren-parser/{version}/siren-parser.js"></script> | ||
``` | ||
An alternate bundle of the siren parser is available that is exposed as a property of the global object. | ||
```html | ||
<script src="https://s.brightspace.com/lib/siren-parser/{version}/siren-parser-global.js"></script> | ||
``` | ||
The client-side code will still use the `window.D2L.Hypermedia.Siren` object, but this addresses the risk of collisions with other modules on the page that are exposed by browserify's standalone UMD bundle. | ||
Note that this is a `deumdify`'d browser bundle, which should prevent collisions with other modules on the page that are exposed by browserify's standalone UMD bundle. | ||
(There is also a `siren-parser-global.js`, but as of v6.6.0 it is equivalent to `siren-parser.js`, as both are being `deumdify`'d. This version will be removed in the next major version bump.) | ||
## API | ||
@@ -35,0 +35,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
92621
915