siren-parser 9.0.0 → 9.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # node-siren-parser
2
2
 
3
- [![Build Status](https://travis-ci.org/Brightspace/node-siren-parser.svg?branch=master)](https://travis-ci.org/Brightspace/node-siren-parser) [![Coverage Status](https://coveralls.io/repos/Brightspace/node-siren-parser/badge.svg?branch=master&service=github&t=smOGqn)](https://coveralls.io/github/Brightspace/node-siren-parser?branch=master)
4
-
5
- Parses a Siren object (or Siren JSON string) into an Entity object that is intended to be easier to work with and test, and prevent having to parse replies from Siren APIs manually. Fully implements the [Siren spec](siren), including all restrictions and requirements on entities, links, fields, etc. Kinda complements [node-siren-writer](node-siren-writer), in that they're intended to sort of be opposites. Also includes a plugin for use with [chai](chai).
3
+ Parses a Siren object (or Siren JSON string) into an Entity object that is intended to be easier to work with and test, and prevent having to parse replies from Siren APIs manually. Fully implements the [Siren spec][siren], including all restrictions and requirements on entities, links, fields, etc. Kinda complements [node-siren-writer][node-siren-writer], in that they're intended to sort of be opposites. Also includes a plugin for use with [chai][chai].
6
4
 
7
5
  ## Installation
8
6
 
@@ -353,21 +351,11 @@ There are two helper `superagent` methods included with this module, under `./su
353
351
  npm test
354
352
  ```
355
353
 
356
- ## Releasing
357
-
358
- This repository uses the [semantic-release GitHub Action](https://github.com/BrightspaceUI/actions/tree/master/semantic-release) to create new versions. See [Triggering a Release](https://github.com/BrightspaceUI/actions/tree/master/semantic-release#triggering-a-release) for more information about automatically creating releases on merge.
359
-
360
- ## Contributing
361
-
362
- 1. **Fork** the repository. Committing directly against this repository is highly discouraged.
363
-
364
- 2. Make your modifications in a branch, updating and writing new tests as necessary in the `test` directory.
365
-
366
- 3. Ensure that all tests pass with `npm test`
354
+ ## Versioning and Releasing
367
355
 
368
- 4. `rebase` your changes against master. *Do not merge*.
356
+ This repo is configured to use `semantic-release`. Commits prefixed with `fix:` and `feat:` will trigger patch and minor releases when merged to `main`.
369
357
 
370
- 5. Submit a pull request to this repository. Wait for tests to run and someone to chime in.
358
+ To learn how to create major releases and release from maintenance branches, refer to the [semantic-release GitHub Action](https://github.com/BrightspaceUI/actions/tree/main/semantic-release) documentation.
371
359
 
372
360
  ## Code Style
373
361
 
package/dist/Action.js CHANGED
@@ -4,28 +4,19 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = Action;
7
-
8
7
  var _assert = _interopRequireDefault(require("./assert"));
9
-
10
8
  var _util = require("./util.js");
11
-
12
9
  var _Field = _interopRequireDefault(require("./Field"));
13
-
14
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
15
-
16
11
  function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
17
-
18
12
  function Action(action) {
19
13
  var _this = this;
20
-
21
14
  if (action instanceof Action) {
22
15
  return action;
23
16
  }
24
-
25
17
  if (!(this instanceof Action)) {
26
18
  return new Action(action);
27
19
  }
28
-
29
20
  (0, _assert["default"])('object' === _typeof(action), 'action must be an object, got ' + JSON.stringify(action));
30
21
  (0, _assert["default"])('string' === typeof action.name, 'action.name must be a string, got ' + JSON.stringify(action.name));
31
22
  (0, _assert["default"])('string' === typeof action.href, 'action.href must be a string, got ' + JSON.stringify(action.href));
@@ -36,48 +27,36 @@ function Action(action) {
36
27
  (0, _assert["default"])('undefined' === typeof action.fields || Array.isArray(action.fields), 'action.fields must be an array or undefined, got ' + JSON.stringify(action.fields));
37
28
  this.name = action.name;
38
29
  this.href = action.href;
39
-
40
30
  if (action["class"]) {
41
31
  this["class"] = action["class"];
42
32
  }
43
-
44
33
  this.method = action.method || 'GET';
45
-
46
34
  if (action.title) {
47
35
  this.title = action.title;
48
36
  }
49
-
50
37
  this.type = action.type || 'application/x-www-form-urlencoded';
51
38
  this._fieldsByName = {};
52
39
  this._fieldsByClass = {};
53
40
  this._fieldsByType = {};
54
-
55
41
  if (action.fields) {
56
42
  this.fields = [];
57
43
  action.fields.forEach(function (field) {
58
44
  var fieldInstance = new _Field["default"](field);
59
-
60
45
  _this.fields.push(fieldInstance);
61
-
62
46
  _this._fieldsByName[field.name] = fieldInstance;
63
-
64
47
  if (fieldInstance.type) {
65
48
  _this._fieldsByType[fieldInstance.type] = _this._fieldsByType[fieldInstance.type] || [];
66
-
67
49
  _this._fieldsByType[fieldInstance.type].push(fieldInstance);
68
50
  }
69
-
70
51
  if (fieldInstance["class"]) {
71
52
  fieldInstance["class"].forEach(function (cls) {
72
53
  _this._fieldsByClass[cls] = _this._fieldsByClass[cls] || [];
73
-
74
54
  _this._fieldsByClass[cls].push(fieldInstance);
75
55
  });
76
56
  }
77
57
  });
78
58
  }
79
59
  }
80
-
81
60
  Action.prototype.toJSON = function () {
82
61
  return {
83
62
  name: this.name,
@@ -89,60 +68,47 @@ Action.prototype.toJSON = function () {
89
68
  fields: this.fields
90
69
  };
91
70
  };
92
-
93
71
  Action.prototype.hasClass = function (cls) {
94
72
  return this["class"] instanceof Array && (0, _util.contains)(this["class"], cls);
95
73
  };
96
-
97
74
  Action.prototype.hasField = function (fieldName) {
98
75
  return this.hasFieldByName(fieldName);
99
76
  };
100
-
101
77
  Action.prototype.hasFieldByName = function (fieldName) {
102
78
  return (0, _util.hasProperty)(this._fieldsByName, fieldName);
103
79
  };
104
-
105
80
  Action.prototype.hasFieldByClass = function (fieldClass) {
106
81
  return (0, _util.hasProperty)(this._fieldsByClass, fieldClass);
107
82
  };
108
-
109
83
  Action.prototype.hasFieldByType = function (fieldType) {
110
84
  return (0, _util.hasProperty)(this._fieldsByType, fieldType);
111
85
  };
112
-
113
86
  Action.prototype.getField = function (fieldName) {
114
87
  return this.getFieldByName(fieldName);
115
88
  };
116
-
117
89
  Action.prototype.getFieldByName = function (fieldName) {
118
90
  return (0, _util.getMatchingValue)(this._fieldsByName, fieldName);
119
91
  };
120
-
121
92
  Action.prototype.getFieldByClass = function (fieldClass) {
122
93
  var vals = (0, _util.getMatchingValue)(this._fieldsByClass, fieldClass);
123
94
  return vals ? vals[0] : undefined;
124
95
  };
125
-
126
96
  Action.prototype.getFieldsByClass = function (fieldClass) {
127
97
  var vals = (0, _util.getMatchingValue)(this._fieldsByClass, fieldClass);
128
98
  return vals ? vals.slice() : [];
129
99
  };
130
-
131
100
  Action.prototype.getFieldByClasses = function (fieldClasses) {
132
101
  var vals = (0, _util.getMatchingValuesByAll)(this.fields, fieldClasses, 'class');
133
102
  return vals && vals.length > 0 ? vals[0] : undefined;
134
103
  };
135
-
136
104
  Action.prototype.getFieldsByClasses = function (fieldClasses) {
137
105
  var vals = (0, _util.getMatchingValuesByAll)(this.fields, fieldClasses, 'class');
138
106
  return vals && vals.length > 0 ? vals.slice() : [];
139
107
  };
140
-
141
108
  Action.prototype.getFieldByType = function (fieldType) {
142
109
  var vals = (0, _util.getMatchingValue)(this._fieldsByType, fieldType);
143
110
  return vals ? vals[0] : undefined;
144
111
  };
145
-
146
112
  Action.prototype.getFieldsByType = function (fieldType) {
147
113
  var vals = (0, _util.getMatchingValue)(this._fieldsByType, fieldType);
148
114
  return vals ? vals.slice() : [];
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/Action.js"],"names":["Action","action","JSON","stringify","name","href","Array","isArray","method","title","type","fields","_fieldsByName","_fieldsByClass","_fieldsByType","forEach","field","fieldInstance","Field","push","cls","prototype","toJSON","hasClass","hasField","fieldName","hasFieldByName","hasFieldByClass","fieldClass","hasFieldByType","fieldType","getField","getFieldByName","getFieldByClass","vals","undefined","getFieldsByClass","slice","getFieldByClasses","fieldClasses","length","getFieldsByClasses","getFieldByType","getFieldsByType"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;;;AAEe,SA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G,KAAL,EAA1B,GAAyC,EAAhD;AACA,CAHD;;AAKArC,MAAM,CAACqB,SAAP,CAAiBqB,cAAjB,GAAkC,UAASZ,SAAT,EAAoB;AACrD,MAAMI,IAAI,GAAG,4BAAiB,KAAKpB,aAAtB,EAAqCgB,SAArC,CAAb;AACA,SAAOI,IAAI,GAAGA,IAAI,CAAC,CAAD,CAAP,GAAaC,SAAxB;AACA,CAHD;;AAKAnC,MAAM,CAACqB,SAAP,CAAiBsB,eAAjB,GAAmC,UAASb,SAAT,EAAoB;AACtD,MAAMI,IAAI,GAAG,4BAAiB,KAAKpB,aAAtB,EAAqCgB,SAArC,CAAb;AACA,SAAOI,IAAI,GAAGA,IAAI,CAACG,KAAL,EAAH,GAAkB,EAA7B;AACA,CAHD","sourcesContent":["import assert from './assert';\nimport { contains, getMatchingValue, getMatchingValuesByAll, hasProperty } from './util.js';\nimport Field from './Field';\n\nexport default function Action(action) {\n\tif (action instanceof Action) {\n\t\treturn action;\n\t}\n\tif (!(this instanceof Action)) {\n\t\treturn new Action(action);\n\t}\n\n\tassert('object' === typeof action, 'action must be an object, got ' + JSON.stringify(action));\n\tassert('string' === typeof action.name, 'action.name must be a string, got ' + JSON.stringify(action.name));\n\tassert('string' === typeof action.href, 'action.href must be a string, got ' + JSON.stringify(action.href));\n\tassert('undefined' === typeof action.class || Array.isArray(action.class),\n\t\t'action.class must be an array or undefined, got ' + JSON.stringify(action.class));\n\tassert('undefined' === typeof action.method || 'string' === typeof action.method,\n\t\t'action.method must be a string or undefined, got ' + JSON.stringify(action.method));\n\tassert('undefined' === typeof action.title || 'string' === typeof action.title,\n\t\t'action.title must be a string or undefined, got ' + JSON.stringify(action.title));\n\tassert('undefined' === typeof action.type || 'string' === typeof action.type,\n\t\t'action.type must be a string or undefined, got ' + JSON.stringify(action.type));\n\tassert('undefined' === typeof action.fields || Array.isArray(action.fields),\n\t\t'action.fields must be an array or undefined, got ' + JSON.stringify(action.fields));\n\n\tthis.name = action.name;\n\tthis.href = action.href;\n\n\tif (action.class) {\n\t\tthis.class = action.class;\n\t}\n\n\tthis.method = action.method || 'GET';\n\n\tif (action.title) {\n\t\tthis.title = action.title;\n\t}\n\n\tthis.type = action.type || 'application/x-www-form-urlencoded';\n\n\tthis._fieldsByName = {};\n\tthis._fieldsByClass = {};\n\tthis._fieldsByType = {};\n\tif (action.fields) {\n\t\tthis.fields = [];\n\n\t\taction.fields.forEach(field => {\n\t\t\tconst fieldInstance = new Field(field);\n\t\t\tthis.fields.push(fieldInstance);\n\n\t\t\tthis._fieldsByName[field.name] = fieldInstance;\n\n\t\t\tif (fieldInstance.type) {\n\t\t\t\tthis._fieldsByType[fieldInstance.type] = this._fieldsByType[fieldInstance.type] || [];\n\t\t\t\tthis._fieldsByType[fieldInstance.type].push(fieldInstance);\n\t\t\t}\n\n\t\t\tif (fieldInstance.class) {\n\t\t\t\tfieldInstance.class.forEach(cls => {\n\t\t\t\t\tthis._fieldsByClass[cls] = this._fieldsByClass[cls] || [];\n\t\t\t\t\tthis._fieldsByClass[cls].push(fieldInstance);\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}\n}\n\nAction.prototype.toJSON = function() {\n\treturn {\n\t\tname: this.name,\n\t\thref: this.href,\n\t\tclass: this.class,\n\t\tmethod: this.method,\n\t\ttitle: this.title,\n\t\ttype: this.type,\n\t\tfields: this.fields\n\t};\n};\n\nAction.prototype.hasClass = function(cls) {\n\treturn this.class instanceof Array && contains(this.class, cls);\n};\n\nAction.prototype.hasField = function(fieldName) {\n\treturn this.hasFieldByName(fieldName);\n};\n\nAction.prototype.hasFieldByName = function(fieldName) {\n\treturn hasProperty(this._fieldsByName, fieldName);\n};\n\nAction.prototype.hasFieldByClass = function(fieldClass) {\n\treturn hasProperty(this._fieldsByClass, fieldClass);\n};\n\nAction.prototype.hasFieldByType = function(fieldType) {\n\treturn hasProperty(this._fieldsByType, fieldType);\n};\n\nAction.prototype.getField = function(fieldName) {\n\treturn this.getFieldByName(fieldName);\n};\n\nAction.prototype.getFieldByName = function(fieldName) {\n\treturn getMatchingValue(this._fieldsByName, fieldName);\n};\n\nAction.prototype.getFieldByClass = function(fieldClass) {\n\tconst vals = getMatchingValue(this._fieldsByClass, fieldClass);\n\treturn vals ? vals[0] : undefined;\n};\n\nAction.prototype.getFieldsByClass = function(fieldClass) {\n\tconst vals = getMatchingValue(this._fieldsByClass, fieldClass);\n\treturn vals ? vals.slice() : [];\n};\n\nAction.prototype.getFieldByClasses = function(fieldClasses) {\n\tconst vals = getMatchingValuesByAll(this.fields, fieldClasses, 'class');\n\treturn vals && vals.length > 0 ? vals[0] : undefined;\n};\n\nAction.prototype.getFieldsByClasses = function(fieldClasses) {\n\tconst vals = getMatchingValuesByAll(this.fields, fieldClasses, 'class');\n\treturn vals && vals.length > 0 ? vals.slice() : [];\n};\n\nAction.prototype.getFieldByType = function(fieldType) {\n\tconst vals = getMatchingValue(this._fieldsByType, fieldType);\n\treturn vals ? vals[0] : undefined;\n};\n\nAction.prototype.getFieldsByType = function(fieldType) {\n\tconst vals = getMatchingValue(this._fieldsByType, fieldType);\n\treturn vals ? vals.slice() : [];\n};\n"],"file":"Action.js"}
1
+ {"version":3,"file":"Action.js","names":["_assert","_interopRequireDefault","require","_util","_Field","obj","__esModule","_typeof","Symbol","iterator","constructor","prototype","Action","action","_this","assert","JSON","stringify","name","href","Array","isArray","method","title","type","fields","_fieldsByName","_fieldsByClass","_fieldsByType","forEach","field","fieldInstance","Field","push","cls","toJSON","hasClass","contains","hasField","fieldName","hasFieldByName","hasProperty","hasFieldByClass","fieldClass","hasFieldByType","fieldType","getField","getFieldByName","getMatchingValue","getFieldByClass","vals","undefined","getFieldsByClass","slice","getFieldByClasses","fieldClasses","getMatchingValuesByAll","length","getFieldsByClasses","getFieldByType","getFieldsByType"],"sources":["../src/Action.js"],"sourcesContent":["import assert from './assert';\nimport { contains, getMatchingValue, getMatchingValuesByAll, hasProperty } from './util.js';\nimport Field from './Field';\n\nexport default function Action(action) {\n\tif (action instanceof Action) {\n\t\treturn action;\n\t}\n\tif (!(this instanceof Action)) {\n\t\treturn new Action(action);\n\t}\n\n\tassert('object' === typeof action, 'action must be an object, got ' + JSON.stringify(action));\n\tassert('string' === typeof action.name, 'action.name must be a string, got ' + JSON.stringify(action.name));\n\tassert('string' === typeof action.href, 'action.href must be a string, got ' + JSON.stringify(action.href));\n\tassert('undefined' === typeof action.class || Array.isArray(action.class),\n\t\t'action.class must be an array or undefined, got ' + JSON.stringify(action.class));\n\tassert('undefined' === typeof action.method || 'string' === typeof action.method,\n\t\t'action.method must be a string or undefined, got ' + JSON.stringify(action.method));\n\tassert('undefined' === typeof action.title || 'string' === typeof action.title,\n\t\t'action.title must be a string or undefined, got ' + JSON.stringify(action.title));\n\tassert('undefined' === typeof action.type || 'string' === typeof action.type,\n\t\t'action.type must be a string or undefined, got ' + JSON.stringify(action.type));\n\tassert('undefined' === typeof action.fields || Array.isArray(action.fields),\n\t\t'action.fields must be an array or undefined, got ' + JSON.stringify(action.fields));\n\n\tthis.name = action.name;\n\tthis.href = action.href;\n\n\tif (action.class) {\n\t\tthis.class = action.class;\n\t}\n\n\tthis.method = action.method || 'GET';\n\n\tif (action.title) {\n\t\tthis.title = action.title;\n\t}\n\n\tthis.type = action.type || 'application/x-www-form-urlencoded';\n\n\tthis._fieldsByName = {};\n\tthis._fieldsByClass = {};\n\tthis._fieldsByType = {};\n\tif (action.fields) {\n\t\tthis.fields = [];\n\n\t\taction.fields.forEach(field => {\n\t\t\tconst fieldInstance = new Field(field);\n\t\t\tthis.fields.push(fieldInstance);\n\n\t\t\tthis._fieldsByName[field.name] = fieldInstance;\n\n\t\t\tif (fieldInstance.type) {\n\t\t\t\tthis._fieldsByType[fieldInstance.type] = this._fieldsByType[fieldInstance.type] || [];\n\t\t\t\tthis._fieldsByType[fieldInstance.type].push(fieldInstance);\n\t\t\t}\n\n\t\t\tif (fieldInstance.class) {\n\t\t\t\tfieldInstance.class.forEach(cls => {\n\t\t\t\t\tthis._fieldsByClass[cls] = this._fieldsByClass[cls] || [];\n\t\t\t\t\tthis._fieldsByClass[cls].push(fieldInstance);\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}\n}\n\nAction.prototype.toJSON = function() {\n\treturn {\n\t\tname: this.name,\n\t\thref: this.href,\n\t\tclass: this.class,\n\t\tmethod: this.method,\n\t\ttitle: this.title,\n\t\ttype: this.type,\n\t\tfields: this.fields\n\t};\n};\n\nAction.prototype.hasClass = function(cls) {\n\treturn this.class instanceof Array && contains(this.class, cls);\n};\n\nAction.prototype.hasField = function(fieldName) {\n\treturn this.hasFieldByName(fieldName);\n};\n\nAction.prototype.hasFieldByName = function(fieldName) {\n\treturn hasProperty(this._fieldsByName, fieldName);\n};\n\nAction.prototype.hasFieldByClass = function(fieldClass) {\n\treturn hasProperty(this._fieldsByClass, fieldClass);\n};\n\nAction.prototype.hasFieldByType = function(fieldType) {\n\treturn hasProperty(this._fieldsByType, fieldType);\n};\n\nAction.prototype.getField = function(fieldName) {\n\treturn this.getFieldByName(fieldName);\n};\n\nAction.prototype.getFieldByName = function(fieldName) {\n\treturn getMatchingValue(this._fieldsByName, fieldName);\n};\n\nAction.prototype.getFieldByClass = function(fieldClass) {\n\tconst vals = getMatchingValue(this._fieldsByClass, fieldClass);\n\treturn vals ? vals[0] : undefined;\n};\n\nAction.prototype.getFieldsByClass = function(fieldClass) {\n\tconst vals = getMatchingValue(this._fieldsByClass, fieldClass);\n\treturn vals ? vals.slice() : [];\n};\n\nAction.prototype.getFieldByClasses = function(fieldClasses) {\n\tconst vals = getMatchingValuesByAll(this.fields, fieldClasses, 'class');\n\treturn vals && vals.length > 0 ? vals[0] : undefined;\n};\n\nAction.prototype.getFieldsByClasses = function(fieldClasses) {\n\tconst vals = getMatchingValuesByAll(this.fields, fieldClasses, 'class');\n\treturn vals && vals.length > 0 ? vals.slice() : [];\n};\n\nAction.prototype.getFieldByType = function(fieldType) {\n\tconst vals = getMatchingValue(this._fieldsByType, fieldType);\n\treturn vals ? vals[0] : undefined;\n};\n\nAction.prototype.getFieldsByType = function(fieldType) {\n\tconst vals = getMatchingValue(this._fieldsByType, fieldType);\n\treturn vals ? vals.slice() : [];\n};\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAH,sBAAA,CAAAC,OAAA;AAA4B,SAAAD,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,gBAAAA,GAAA;AAAA,SAAAE,QAAAF,GAAA,0CAAAG,MAAA,0BAAAA,MAAA,CAAAC,QAAA,iBAAAF,OAAA,YAAAA,QAAAF,GAAA,kBAAAA,GAAA,cAAAE,OAAA,YAAAA,QAAAF,GAAA,WAAAA,GAAA,WAAAG,MAAA,mBAAAH,GAAA,CAAAK,WAAA,KAAAF,MAAA,IAAAH,GAAA,KAAAG,MAAA,CAAAG,SAAA,qBAAAN,GAAA,cAAAE,OAAA,CAAAF,GAAA;AAEb,SAASO,MAAMA,CAACC,MAAM,EAAE;EAAA,IAAAC,KAAA;EACtC,IAAID,MAAM,YAAYD,MAAM,EAAE;IAC7B,OAAOC,MAAM;EACd;EACA,IAAI,EAAE,IAAI,YAAYD,MAAM,CAAC,EAAE;IAC9B,OAAO,IAAIA,MAAM,CAACC,MAAM,CAAC;EAC1B;EAEA,IAAAE,kBAAM,EAAC,QAAQ,KAAAR,OAAA,CAAYM,MAAM,GAAE,gCAAgC,GAAGG,IAAI,CAACC,SAAS,CAACJ,MAAM,CAAC,CAAC;EAC7F,IAAAE,kBAAM,EAAC,QAAQ,KAAK,OAAOF,MAAM,CAACK,IAAI,EAAE,oCAAoC,GAAGF,IAAI,CAACC,SAAS,CAACJ,MAAM,CAACK,IAAI,CAAC,CAAC;EAC3G,IAAAH,kBAAM,EAAC,QAAQ,KAAK,OAAOF,MAAM,CAACM,IAAI,EAAE,oCAAoC,GAAGH,IAAI,CAAC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IAAI,GAAGA,IAAI,CAAC,CAAC,CAAC,GAAGC,SAAS;AAClC,CAAC;AAEDvC,MAAM,CAACD,SAAS,CAACiD,eAAe,GAAG,UAASf,SAAS,EAAE;EACtD,IAAMK,IAAI,GAAG,IAAAF,sBAAgB,EAAC,IAAI,CAACpB,aAAa,EAAEiB,SAAS,CAAC;EAC5D,OAAOK,IAAI,GAAGA,IAAI,CAACG,KAAK,CAAC,CAAC,GAAG,EAAE;AAChC,CAAC","ignoreList":[]}
package/dist/Field.js CHANGED
@@ -4,26 +4,18 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = Field;
7
-
8
7
  var _assert = _interopRequireDefault(require("./assert"));
9
-
10
8
  var _util = require("./util");
11
-
12
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
13
-
14
10
  function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
15
-
16
11
  var VALID_TYPES = ['hidden', 'text', 'search', 'tel', 'url', 'email', 'password', 'datetime', 'date', 'month', 'week', 'time', 'datetime-local', 'number', 'range', 'color', 'checkbox', 'radio', 'file'];
17
-
18
12
  function Field(field) {
19
13
  if (field instanceof Field) {
20
14
  return field;
21
15
  }
22
-
23
16
  if (!(this instanceof Field)) {
24
17
  return new Field(field);
25
18
  }
26
-
27
19
  (0, _assert["default"])('object' === _typeof(field), 'field must be an object, got ' + JSON.stringify(field));
28
20
  (0, _assert["default"])('string' === typeof field.name, 'field.name must be a string, got ' + JSON.stringify(field.name));
29
21
  (0, _assert["default"])('undefined' === typeof field["class"] || Array.isArray(field["class"]), 'field.class must be an array or undefined, got ' + JSON.stringify(field["class"]));
@@ -32,32 +24,25 @@ function Field(field) {
32
24
  (0, _assert["default"])('undefined' === typeof field.min || 'number' === typeof field.min, 'field.min must be a number or undefined, got ' + JSON.stringify(field.min));
33
25
  (0, _assert["default"])('undefined' === typeof field.max || 'number' === typeof field.max, 'field.max must be a number or undefined, got ' + JSON.stringify(field.max));
34
26
  this.name = field.name;
35
-
36
27
  if (field["class"]) {
37
28
  this["class"] = field["class"];
38
29
  }
39
-
40
30
  if (field.type) {
41
31
  this.type = field.type;
42
32
  }
43
-
44
33
  if (Object.prototype.hasOwnProperty.call(field, 'value')) {
45
34
  this.value = field.value;
46
35
  }
47
-
48
36
  if (field.title) {
49
37
  this.title = field.title;
50
38
  }
51
-
52
39
  if (typeof field.min === 'number') {
53
40
  this.min = field.min;
54
41
  }
55
-
56
42
  if (typeof field.max === 'number') {
57
43
  this.max = field.max;
58
44
  }
59
45
  }
60
-
61
46
  Field.prototype.toJSON = function () {
62
47
  return {
63
48
  name: this.name,
@@ -69,7 +54,6 @@ Field.prototype.toJSON = function () {
69
54
  max: this.max
70
55
  };
71
56
  };
72
-
73
57
  Field.prototype.hasClass = function (cls) {
74
58
  return this["class"] instanceof Array && (0, _util.contains)(this["class"], cls);
75
59
  };
package/dist/Field.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/Field.js"],"names":["VALID_TYPES","Field","field","JSON","stringify","name","Array","isArray","type","indexOf","toLowerCase","title","min","max","Object","prototype","hasOwnProperty","call","value","toJSON","hasClass","cls"],"mappings":";;;;;;;AAAA;;AACA;;;;;;AAEA,IAAMA,WAAW,GAAG,CACnB,QADmB,EAEnB,MAFmB,EAGnB,QAHmB,EAInB,KAJmB,EAKnB,KALmB,EAMnB,OANmB,EAOnB,UAPmB,EAQnB,UARmB,EASnB,MATmB,EAUnB,OAVmB,EAWnB,MAXmB,EAYnB,MAZmB,EAanB,gBAbmB,EAcnB,QAdmB,EAenB,OAfmB,EAgBnB,OAhBmB,EAiBnB,UAjBmB,EAkBnB,OAlBmB,EAmBnB,MAnBmB,CAAp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F,KAAK,CAACW,GAArB,CADnD;AAGA,OAAKR,IAAL,GAAYH,KAAK,CAACG,IAAlB;;AAEA,MAAIH,KAAK,SAAT,EAAiB;AAChB,oBAAaA,KAAK,SAAlB;AACA;;AAED,MAAIA,KAAK,CAACM,IAAV,EAAgB;AACf,SAAKA,IAAL,GAAYN,KAAK,CAACM,IAAlB;AACA;;AAED,MAAIM,MAAM,CAACC,SAAP,CAAiBC,cAAjB,CAAgCC,IAAhC,CAAqCf,KAArC,EAA4C,OAA5C,CAAJ,EAA0D;AACzD,SAAKgB,KAAL,GAAahB,KAAK,CAACgB,KAAnB;AACA;;AAED,MAAIhB,KAAK,CAACS,KAAV,EAAiB;AAChB,SAAKA,KAAL,GAAaT,KAAK,CAACS,KAAnB;AACA;;AAED,MAAI,OAAOT,KAAK,CAACU,GAAb,KAAqB,QAAzB,EAAmC;AAClC,SAAKA,GAAL,GAAWV,KAAK,CAACU,GAAjB;AACA;;AAED,MAAI,OAAOV,KAAK,CAACW,GAAb,KAAqB,QAAzB,EAAmC;AAClC,SAAKA,GAAL,GAAWX,KAAK,CAACW,GAAjB;AACA;AACD;;AAEDZ,KAAK,CAACc,SAAN,CAAgBI,MAAhB,GAAyB,YAAW;AACnC,SAAO;AACNd,IAAAA,IAAI,EAAE,KAAKA,IADL;AAEN,aAAO,aAFD;AAGNG,IAAAA,IAAI,EAAE,KAAKA,IAHL;AAINU,IAAAA,KAAK,EAAE,KAAKA,KAJN;AAKNP,IAAAA,KAAK,EAAE,KAAKA,KALN;AAMNC,IAAAA,GAAG,EAAE,KAAKA,GANJ;AAONC,IAAAA,GAAG,EAAE,KAAKA;AAPJ,GAAP;AASA,CAVD;;AAYAZ,KAAK,CAACc,SAAN,CAAgBK,QAAhB,GAA2B,UAASC,GAAT,EAAc;AACxC,SAAO,yBAAsBf,KAAtB,IAA+B,oBAAS,aAAT,EAAqBe,GAArB,CAAtC;AACA,CAFD","sourcesContent":["import assert from './assert';\nimport { contains } from './util';\n\nconst VALID_TYPES = [\n\t'hidden',\n\t'text',\n\t'search',\n\t'tel',\n\t'url',\n\t'email',\n\t'password',\n\t'datetime',\n\t'date',\n\t'month',\n\t'week',\n\t'time',\n\t'datetime-local',\n\t'number',\n\t'range',\n\t'color',\n\t'checkbox',\n\t'radio',\n\t'file'\n];\n\nexport default function Field(field) {\n\tif (field instanceof Field) {\n\t\treturn field;\n\t}\n\tif (!(this instanceof Field)) {\n\t\treturn new Field(field);\n\t}\n\n\tassert('object' === typeof field, 'field must be an object, got ' + JSON.stringify(field));\n\tassert('string' === typeof field.name, 'field.name must be a string, got ' + JSON.stringify(field.name));\n\tassert('undefined' === typeof field.class || Array.isArray(field.class),\n\t\t'field.class must be an array or undefined, got ' + JSON.stringify(field.class));\n\tassert('undefined' === typeof field.type || ('string' === typeof field.type && VALID_TYPES.indexOf(field.type.toLowerCase()) > -1),\n\t\t'field.type must be a valid field type string or undefined, got ' + JSON.stringify(field.type));\n\tassert('undefined' === typeof field.title || 'string' === typeof field.title,\n\t\t'field.title must be a string or undefined, got ' + JSON.stringify(field.title));\n\tassert('undefined' === typeof field.min || 'number' === typeof field.min,\n\t\t'field.min must be a number or undefined, got ' + JSON.stringify(field.min));\n\tassert('undefined' === typeof field.max || 'number' === typeof field.max,\n\t\t'field.max must be a number or undefined, got ' + JSON.stringify(field.max));\n\n\tthis.name = field.name;\n\n\tif (field.class) {\n\t\tthis.class = field.class;\n\t}\n\n\tif (field.type) {\n\t\tthis.type = field.type;\n\t}\n\n\tif (Object.prototype.hasOwnProperty.call(field, 'value')) {\n\t\tthis.value = field.value;\n\t}\n\n\tif (field.title) {\n\t\tthis.title = field.title;\n\t}\n\n\tif (typeof field.min === 'number') {\n\t\tthis.min = field.min;\n\t}\n\n\tif (typeof field.max === 'number') {\n\t\tthis.max = field.max;\n\t}\n}\n\nField.prototype.toJSON = function() {\n\treturn {\n\t\tname: this.name,\n\t\tclass: this.class,\n\t\ttype: this.type,\n\t\tvalue: this.value,\n\t\ttitle: this.title,\n\t\tmin: this.min,\n\t\tmax: this.max\n\t};\n};\n\nField.prototype.hasClass = function(cls) {\n\treturn this.class instanceof Array && contains(this.class, cls);\n};\n"],"file":"Field.js"}
1
+ {"version":3,"file":"Field.js","names":["_assert","_interopRequireDefault","require","_util","obj","__esModule","_typeof","Symbol","iterator","constructor","prototype","VALID_TYPES","Field","field","assert","JSON","stringify","name","Array","isArray","type","indexOf","toLowerCase","title","min","max","Object","hasOwnProperty","call","value","toJSON","hasClass","cls","contains"],"sources":["../src/Field.js"],"sourcesContent":["import assert from './assert';\nimport { contains } from './util';\n\nconst VALID_TYPES = [\n\t'hidden',\n\t'text',\n\t'search',\n\t'tel',\n\t'url',\n\t'email',\n\t'password',\n\t'datetime',\n\t'date',\n\t'month',\n\t'week',\n\t'time',\n\t'datetime-local',\n\t'number',\n\t'range',\n\t'color',\n\t'checkbox',\n\t'radio',\n\t'file'\n];\n\nexport default function Field(field) {\n\tif (field instanceof Field) {\n\t\treturn field;\n\t}\n\tif (!(this instanceof Field)) {\n\t\treturn new Field(field);\n\t}\n\n\tassert('object' === typeof field, 'field must be an object, got ' + JSON.stringify(field));\n\tassert('string' === typeof field.name, 'field.name must be a string, got ' + JSON.stringify(field.name));\n\tassert('undefined' === typeof field.class || Array.isArray(field.class),\n\t\t'field.class must be an array or undefined, got ' + JSON.stringify(field.class));\n\tassert('undefined' === typeof field.type || ('string' === typeof field.type && VALID_TYPES.indexOf(field.type.toLowerCase()) > -1),\n\t\t'field.type must be a valid field type string or undefined, got ' + JSON.stringify(field.type));\n\tassert('undefined' === typeof field.title || 'string' === typeof field.title,\n\t\t'field.title must be a string or undefined, got ' + JSON.stringify(field.title));\n\tassert('undefined' === typeof field.min || 'number' === typeof field.min,\n\t\t'field.min must be a number or undefined, got ' + JSON.stringify(field.min));\n\tassert('undefined' === typeof field.max || 'number' === typeof field.max,\n\t\t'field.max must be a number or undefined, got ' + JSON.stringify(field.max));\n\n\tthis.name = field.name;\n\n\tif (field.class) {\n\t\tthis.class = field.class;\n\t}\n\n\tif (field.type) {\n\t\tthis.type = field.type;\n\t}\n\n\tif (Object.prototype.hasOwnProperty.call(field, 'value')) {\n\t\tthis.value = field.value;\n\t}\n\n\tif (field.title) {\n\t\tthis.title = field.title;\n\t}\n\n\tif (typeof field.min === 'number') {\n\t\tthis.min = field.min;\n\t}\n\n\tif (typeof field.max === 'number') {\n\t\tthis.max = field.max;\n\t}\n}\n\nField.prototype.toJSON = function() {\n\treturn {\n\t\tname: this.name,\n\t\tclass: this.class,\n\t\ttype: this.type,\n\t\tvalue: this.value,\n\t\ttitle: this.title,\n\t\tmin: this.min,\n\t\tmax: this.max\n\t};\n};\n\nField.prototype.hasClass = function(cls) {\n\treturn this.class instanceof Array && contains(this.class, cls);\n};\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAAkC,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,gBAAAA,GAAA;AAAA,SAAAE,QAAAF,GAAA,0CAAAG,MAAA,0BAAAA,MAAA,CAAAC,QAAA,iBAAAF,OAAA,YAAAA,QAAAF,GAAA,kBAAAA,GAAA,cAAAE,OAAA,YAAAA,QAAAF,GAAA,WAAAA,GAAA,WAAAG,MAAA,mBAAAH,GAAA,CAAAK,WAAA,KAAAF,MAAA,IAAAH,GAAA,KAAAG,MAAA,CAAAG,SAAA,qBAAAN,GAAA,cAAAE,OAAA,CAAAF,GAAA;AAElC,IAAMO,WAAW,GAAG,CACnB,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,KAAK,EACL,KAAK,EACL,OAAO,EACP,UAAU,EACV,UAAU,EACV,MAAM,EACN,OAAO,EACP,MAAM,EACN,MAAM,EACN,gBAAgB,EAChB,QAAQ,EACR,OAAO,EACP,OAAO,EACP,UAAU,EACV,OAAO,EACP,MAAM,CACN;AAEc,SAASC,KAAKA,CAACC,K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,CAAC;AAEDb,KAAK,CAACF,SAAS,CAACqB,QAAQ,GAAG,UAASC,GAAG,EAAE;EACxC,OAAO,IAAI,SAAM,YAAYd,KAAK,IAAI,IAAAe,cAAQ,EAAC,IAAI,SAAM,EAAED,GAAG,CAAC;AAChE,CAAC","ignoreList":[]}
package/dist/Link.js CHANGED
@@ -4,24 +4,17 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = Link;
7
-
8
7
  var _assert = _interopRequireDefault(require("./assert"));
9
-
10
8
  var _util = require("./util");
11
-
12
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
13
-
14
10
  function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
15
-
16
11
  function Link(link) {
17
12
  if (link instanceof Link) {
18
13
  return link;
19
14
  }
20
-
21
15
  if (!(this instanceof Link)) {
22
16
  return new Link(link);
23
17
  }
24
-
25
18
  (0, _assert["default"])('object' === _typeof(link), 'link must be an object, got ' + JSON.stringify(link));
26
19
  (0, _assert["default"])(Array.isArray(link.rel), 'link.rel must be an array, got ' + JSON.stringify(link.rel));
27
20
  (0, _assert["default"])('string' === typeof link.href, 'link.href must be a string, got ' + JSON.stringify(link.href));
@@ -30,20 +23,16 @@ function Link(link) {
30
23
  (0, _assert["default"])('undefined' === typeof link.type || 'string' === typeof link.type, 'link.type must be a string or undefined, got ' + JSON.stringify(link.type));
31
24
  this.rel = link.rel;
32
25
  this.href = link.href;
33
-
34
26
  if (link["class"]) {
35
27
  this["class"] = link["class"];
36
28
  }
37
-
38
29
  if (link.title) {
39
30
  this.title = link.title;
40
31
  }
41
-
42
32
  if (link.type) {
43
33
  this.type = link.type;
44
34
  }
45
35
  }
46
-
47
36
  Link.prototype.toJSON = function () {
48
37
  return {
49
38
  rel: this.rel,
@@ -53,7 +42,6 @@ Link.prototype.toJSON = function () {
53
42
  type: this.type
54
43
  };
55
44
  };
56
-
57
45
  Link.prototype.hasClass = function (cls) {
58
46
  return this["class"] instanceof Array && (0, _util.contains)(this["class"], cls);
59
47
  };
package/dist/Link.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/Link.js"],"names":["Link","link","JSON","stringify","Array","isArray","rel","href","title","type","prototype","toJSON","hasClass","cls"],"mappings":";;;;;;;AAAA;;AACA;;;;;;AAEe,SAASA,IAAT,CAAcC,IAAd,EAAoB;AAClC,MAAIA,IAAI,YAAYD,IAApB,EAA0B;AACzB,WAAOC,IAAP;AACA;;AACD,MAAI,EAAE,gBAAgBD,IAAlB,CAAJ,EAA6B;AAC5B,WAAO,IAAIA,IAAJ,CAASC,IAAT,CAAP;AACA;;AAED,0BAAO,qBAAoBA,IAApB,CAAP,EAAiC,iCAAiCC,IAAI,CAACC,SAAL,CAAeF,IAAf,CAAlE;AACA,0BAAOG,KAAK,CAACC,OAAN,CAAcJ,IAAI,CAACK,GAAnB,CAAP,EAAgC,oCAAoCJ,IAAI,CAACC,SAAL,CAAeF,IAAI,CAACK,GAApB,CAApE;AACA,0BAAO,aAAa,OAAOL,IAAI,CAACM,IAAhC,EAAsC,qCAAqCL,IAAI,CAACC,SAAL,CAAeF,IAAI,CAACM,IAApB,CAA3E;AACA,0BAAO,gBAAgB,OAAON,IAAI,SAA3B,IAAqCG,KAAK,CAACC,OAAN,CAAcJ,IAAI,SAAlB,CAA5C,EACC,mDAAmDC,IAAI,CAACC,SAAL,CAAeF,IAAI,SAAnB,CADpD;AAEA,0BAAO,gBAAgB,OAAOA,IAAI,CAACO,KAA5B,IAAqC,aAAa,OAAOP,IAAI,CAACO,KAArE,EACC,mDAAmDN,IAAI,CAACC,SAAL,CAAeF,IAAI,CAACO,KAApB,CADpD;AAEA,0BAAO,gBAAgB,OAAOP,IAAI,CAACQ,IAA5B,IAAoC,aAAa,OAAOR,IAAI,CAACQ,IAApE,EACC,kDAAkDP,IAAI,CAACC,SAAL,CAAeF,IAAI,CAACQ,IAApB,CADnD;AAGA,OAAKH,GAAL,GAAWL,IAAI,CAACK,GAAhB;AACA,OAAKC,IAAL,GAAYN,IAAI,CAACM,IAAjB;;AAEA,MAAIN,IAAI,SAAR,EAAgB;AACf,oBAAaA,IAAI,SAAjB;AACA;;AAED,MAAIA,IAAI,CAACO,KAAT,EAAgB;AACf,SAAKA,KAAL,GAAaP,IAAI,CAACO,KAAlB;AACA;;AAED,MAAIP,IAAI,CAACQ,IAAT,EAAe;AACd,SAAKA,IAAL,GAAYR,IAAI,CAACQ,IAAjB;AACA;AACD;;AAEDT,IAAI,CAACU,SAAL,CAAeC,MAAf,GAAwB,YAAW;AAClC,SAAO;AACNL,IAAAA,GAAG,EAAE,KAAKA,GADJ;AAENC,IAAAA,IAAI,EAAE,KAAKA,IAFL;AAGN,aAAO,aAHD;AAINC,IAAAA,KAAK,EAAE,KAAKA,KAJN;AAKNC,IAAAA,IAAI,EAAE,KAAKA;AALL,GAAP;AAOA,CARD;;AAUAT,IAAI,CAACU,SAAL,CAAeE,QAAf,GAA0B,UAASC,GAAT,EAAc;AACvC,SAAO,yBAAsBT,KAAtB,IAA+B,oBAAS,aAAT,EAAqBS,GAArB,CAAtC;AACA,CAFD","sourcesContent":["import assert from './assert';\nimport { contains } from './util';\n\nexport default function Link(link) {\n\tif (link instanceof Link) {\n\t\treturn link;\n\t}\n\tif (!(this instanceof Link)) {\n\t\treturn new Link(link);\n\t}\n\n\tassert('object' === typeof link, 'link must be an object, got ' + JSON.stringify(link));\n\tassert(Array.isArray(link.rel), 'link.rel must be an array, got ' + JSON.stringify(link.rel));\n\tassert('string' === typeof link.href, 'link.href must be a string, got ' + JSON.stringify(link.href));\n\tassert('undefined' === typeof link.class || Array.isArray(link.class),\n\t\t'link.class must be an array or undefined, got ' + JSON.stringify(link.class));\n\tassert('undefined' === typeof link.title || 'string' === typeof link.title,\n\t\t'link.title must be a string or undefined, got ' + JSON.stringify(link.title));\n\tassert('undefined' === typeof link.type || 'string' === typeof link.type,\n\t\t'link.type must be a string or undefined, got ' + JSON.stringify(link.type));\n\n\tthis.rel = link.rel;\n\tthis.href = link.href;\n\n\tif (link.class) {\n\t\tthis.class = link.class;\n\t}\n\n\tif (link.title) {\n\t\tthis.title = link.title;\n\t}\n\n\tif (link.type) {\n\t\tthis.type = link.type;\n\t}\n}\n\nLink.prototype.toJSON = function() {\n\treturn {\n\t\trel: this.rel,\n\t\thref: this.href,\n\t\tclass: this.class,\n\t\ttitle: this.title,\n\t\ttype: this.type\n\t};\n};\n\nLink.prototype.hasClass = function(cls) {\n\treturn this.class instanceof Array && contains(this.class, cls);\n};\n"],"file":"Link.js"}
1
+ {"version":3,"file":"Link.js","names":["_assert","_interopRequireDefault","require","_util","obj","__esModule","_typeof","Symbol","iterator","constructor","prototype","Link","link","assert","JSON","stringify","Array","isArray","rel","href","title","type","toJSON","hasClass","cls","contains"],"sources":["../src/Link.js"],"sourcesContent":["import assert from './assert';\nimport { contains } from './util';\n\nexport default function Link(link) {\n\tif (link instanceof Link) {\n\t\treturn link;\n\t}\n\tif (!(this instanceof Link)) {\n\t\treturn new Link(link);\n\t}\n\n\tassert('object' === typeof link, 'link must be an object, got ' + JSON.stringify(link));\n\tassert(Array.isArray(link.rel), 'link.rel must be an array, got ' + JSON.stringify(link.rel));\n\tassert('string' === typeof link.href, 'link.href must be a string, got ' + JSON.stringify(link.href));\n\tassert('undefined' === typeof link.class || Array.isArray(link.class),\n\t\t'link.class must be an array or undefined, got ' + JSON.stringify(link.class));\n\tassert('undefined' === typeof link.title || 'string' === typeof link.title,\n\t\t'link.title must be a string or undefined, got ' + JSON.stringify(link.title));\n\tassert('undefined' === typeof link.type || 'string' === typeof link.type,\n\t\t'link.type must be a string or undefined, got ' + JSON.stringify(link.type));\n\n\tthis.rel = link.rel;\n\tthis.href = link.href;\n\n\tif (link.class) {\n\t\tthis.class = link.class;\n\t}\n\n\tif (link.title) {\n\t\tthis.title = link.title;\n\t}\n\n\tif (link.type) {\n\t\tthis.type = link.type;\n\t}\n}\n\nLink.prototype.toJSON = function() {\n\treturn {\n\t\trel: this.rel,\n\t\thref: this.href,\n\t\tclass: this.class,\n\t\ttitle: this.title,\n\t\ttype: this.type\n\t};\n};\n\nLink.prototype.hasClass = function(cls) {\n\treturn this.class instanceof Array && contains(this.class, cls);\n};\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAAkC,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,gBAAAA,GAAA;AAAA,SAAAE,QAAAF,GAAA,0CAAAG,MAAA,0BAAAA,MAAA,CAAAC,QAAA,iBAAAF,OAAA,YAAAA,QAAAF,GAAA,kBAAAA,GAAA,cAAAE,OAAA,YAAAA,QAAAF,GAAA,WAAAA,GAAA,WAAAG,MAAA,mBAAAH,GAAA,CAAAK,WAAA,KAAAF,MAAA,IAAAH,GAAA,KAAAG,MAAA,CAAAG,SAAA,qBAAAN,GAAA,cAAAE,OAAA,CAAAF,GAAA;AAEnB,SAASO,IAAIA,CAACC,IAAI,EAAE;EAClC,IAAIA,IAAI,YAAYD,IAAI,EAAE;IACzB,OAAOC,IAAI;EACZ;EACA,IAAI,EAAE,IAAI,YAAYD,IAAI,CAAC,EAAE;IAC5B,OAAO,IAAIA,IAAI,CAACC,IAAI,CAAC;EACtB;EAEA,IAAAC,kBAAM,EAAC,QAAQ,KAAAP,OAAA,CAAYM,IAAI,GAAE,8BAA8B,GAAGE,IAAI,CAACC,SAAS,CAACH,IAAI,CAAC,CAAC;EACvF,IAAAC,kBAAM,EAACG,KAAK,CAACC,OAAO,CAACL,IAAI,CAACM,GAAG,CAAC,EAAE,iCAAiC,GAAGJ,IAAI,CAAC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I;IACf,SAAO,IAAI,SAAM;IACjBC,KAAK,EAAE,IAAI,CAACA,KAAK;IACjBC,IAAI,EAAE,IAAI,CAACA;EACZ,CAAC;AACF,CAAC;AAEDV,IAAI,CAACD,SAAS,CAACa,QAAQ,GAAG,UAASC,GAAG,EAAE;EACvC,OAAO,IAAI,SAAM,YAAYR,KAAK,IAAI,IAAAS,cAAQ,EAAC,IAAI,SAAM,EAAED,GAAG,CAAC;AAChE,CAAC","ignoreList":[]}
package/dist/assert.js CHANGED
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = _default;
7
-
8
7
  function _default(expectation, msg) {
9
8
  if (!expectation) {
10
9
  throw new Error(msg);
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/assert.js"],"names":["expectation","msg","Error"],"mappings":";;;;;;;AAAe,kBAASA,WAAT,EAAsBC,GAAtB,EAA2B;AACzC,MAAI,CAACD,WAAL,EAAkB;AACjB,UAAM,IAAIE,KAAJ,CAAUD,GAAV,CAAN;AACA;AACD","sourcesContent":["export default function(expectation, msg) {\n\tif (!expectation) {\n\t\tthrow new Error(msg);\n\t}\n}\n"],"file":"assert.js"}
1
+ {"version":3,"file":"assert.js","names":["_default","expectation","msg","Error"],"sources":["../src/assert.js"],"sourcesContent":["export default function(expectation, msg) {\n\tif (!expectation) {\n\t\tthrow new Error(msg);\n\t}\n}\n"],"mappings":";;;;;;AAAe,SAAAA,SAASC,WAAW,EAAEC,GAAG,EAAE;EACzC,IAAI,CAACD,WAAW,EAAE;IACjB,MAAM,IAAIE,KAAK,CAACD,GAAG,CAAC;EACrB;AACD","ignoreList":[]}
@@ -4,42 +4,30 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = _default;
7
-
8
7
  var _Action = _interopRequireDefault(require("./Action"));
9
-
10
8
  var _index = _interopRequireDefault(require("./index"));
11
-
12
9
  var _Field = _interopRequireDefault(require("./Field"));
13
-
14
10
  var _Link = _interopRequireDefault(require("./Link"));
15
-
16
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
17
-
18
12
  function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
19
-
20
13
  function _default(chai, utils) {
21
- var Assertion = chai.Assertion; // .all.
14
+ var Assertion = chai.Assertion;
22
15
 
23
- Assertion.addProperty('all',
24
- /* @this */
25
- function () {
16
+ // .all.
17
+ Assertion.addProperty('all', /* @this */function () {
26
18
  utils.flag(this, 'all', true);
27
- }); // expect(resource).to.have.Xs(x1, x2, ...)
19
+ });
28
20
 
21
+ // expect(resource).to.have.Xs(x1, x2, ...)
29
22
  function multipleArgMethod(name, key, validTypes) {
30
- Assertion.addChainableMethod(name,
31
- /* @this */
32
- function () {
23
+ Assertion.addChainableMethod(name, /* @this */function () {
33
24
  var _this = this;
34
-
35
25
  var desiredValues = Array.prototype.slice.call(arguments);
36
-
37
26
  if (Array.isArray(this._obj)) {
38
27
  if (utils.flag(this, 'all')) {
39
28
  desiredValues.forEach(function (desiredValue) {
40
29
  _this._obj.forEach(function (obj) {
41
30
  new Assertion(obj.constuctor in validTypes);
42
-
43
31
  _this.assert(Array.isArray(obj[key]) && obj[key].indexOf(desiredValue) > -1, 'expected #{this} to have Siren ' + key + ' #{exp}', 'expected #{this} to not have Siren ' + key + ' #{exp}', desiredValue);
44
32
  });
45
33
  });
@@ -49,7 +37,6 @@ function _default(chai, utils) {
49
37
  new Assertion(obj.constuctor in validTypes);
50
38
  return Array.isArray(obj[key]) && obj[key].indexOf(desiredValue) > -1;
51
39
  });
52
-
53
40
  _this.assert(found, 'expected #{this} to have Siren ' + key + ' #{exp}', 'expected #{this} to not have Siren ' + key + ' #{exp}', desiredValue);
54
41
  });
55
42
  }
@@ -61,21 +48,17 @@ function _default(chai, utils) {
61
48
  }
62
49
  });
63
50
  }
64
-
65
51
  multipleArgMethod('classes', 'class', [_Action["default"], _index["default"], _Field["default"], _Link["default"]]);
66
- multipleArgMethod('rels', 'rel', [_index["default"], _Link["default"]]); // expect(resource).to.have.X(x)
52
+ multipleArgMethod('rels', 'rel', [_index["default"], _Link["default"]]);
67
53
 
54
+ // expect(resource).to.have.X(x)
68
55
  function singleArgMethod(name, key, validTypes) {
69
- Assertion.addChainableMethod(name,
70
- /* @this */
71
- function (desiredValue) {
56
+ Assertion.addChainableMethod(name, /* @this */function (desiredValue) {
72
57
  var _this2 = this;
73
-
74
58
  if (Array.isArray(this._obj)) {
75
59
  if (utils.flag(this, 'all')) {
76
60
  this._obj.forEach(function (obj) {
77
61
  new Assertion(obj.constuctor in validTypes);
78
-
79
62
  _this2.assert(obj[key] === desiredValue, 'expected #{this} to have Siren ' + key + ' #{exp}', 'expected #{this} to not have Siren ' + key + ' #{exp}', desiredValue);
80
63
  });
81
64
  } else {
@@ -83,7 +66,6 @@ function _default(chai, utils) {
83
66
  new Assertion(obj.constuctor in validTypes);
84
67
  return desiredValue === obj[key];
85
68
  });
86
-
87
69
  this.assert(found, 'expected #{this} to have Siren ' + key + ' #{exp}', 'expected #{this} to not have Siren ' + key + ' #{exp}', desiredValue);
88
70
  }
89
71
  } else {
@@ -92,25 +74,22 @@ function _default(chai, utils) {
92
74
  }
93
75
  });
94
76
  }
95
-
96
77
  singleArgMethod('href', 'href', [_Action["default"], _Link["default"]]);
97
78
  singleArgMethod('name', 'name', [_Action["default"], _Field["default"]]);
98
79
  singleArgMethod('method', 'method', [_Action["default"]]);
99
80
  singleArgMethod('title', 'title', [_Action["default"], _index["default"], _Field["default"], _Link["default"]]);
100
81
  singleArgMethod('type', 'type', [_Action["default"], _Field["default"], _Link["default"]]);
101
- singleArgMethod('value', 'value', [_Field["default"]]); // expect(resource).to.have.X, where X is an Array
102
- // changes the subject of the assertion to be X
82
+ singleArgMethod('value', 'value', [_Field["default"]]);
103
83
 
84
+ // expect(resource).to.have.X, where X is an Array
85
+ // changes the subject of the assertion to be X
104
86
  function arrayProperty(name, key, subjectType) {
105
- Assertion.addProperty(name,
106
- /* @this */
107
- function () {
87
+ Assertion.addProperty(name, /* @this */function () {
108
88
  new Assertion(this._obj).to.be.an["instanceof"](subjectType);
109
89
  this.assert(Array.isArray(this._obj[key]), 'expected #{this} to have Siren ' + key, 'expected #{this} to not have Siren ' + key);
110
90
  utils.flag(this, 'object', this._obj[key]);
111
91
  });
112
92
  }
113
-
114
93
  arrayProperty('sirenAction', 'actions', _index["default"]);
115
94
  arrayProperty('sirenActions', 'actions', _index["default"]);
116
95
  arrayProperty('sirenEntity', 'entities', _index["default"]);
@@ -118,19 +97,17 @@ function _default(chai, utils) {
118
97
  arrayProperty('sirenField', 'fields', _Action["default"]);
119
98
  arrayProperty('sirenFields', 'fields', _Action["default"]);
120
99
  arrayProperty('sirenLink', 'links', _index["default"]);
121
- arrayProperty('sirenLinks', 'links', _index["default"]); // expect(resource).to.have.X, where X is an object
122
- // changes the subject of the assertion to be X
100
+ arrayProperty('sirenLinks', 'links', _index["default"]);
123
101
 
102
+ // expect(resource).to.have.X, where X is an object
103
+ // changes the subject of the assertion to be X
124
104
  function objectProperty(name, key, subjectType) {
125
- Assertion.addProperty(name,
126
- /* @this */
127
- function () {
105
+ Assertion.addProperty(name, /* @this */function () {
128
106
  new Assertion(this._obj).to.be.an["instanceof"](subjectType);
129
107
  this.assert('object' === _typeof(this._obj[key]), 'expected #{this} to have Siren ' + key, 'expected #{this} to not have Siren ' + key);
130
108
  utils.flag(this, 'object', this._obj[key]);
131
109
  });
132
110
  }
133
-
134
111
  objectProperty('sirenProperty', 'properties', _index["default"]);
135
112
  objectProperty('sirenProperties', 'properties', _index["default"]);
136
113
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/chaiPlugin.js"],"names":["chai","utils","Assertion","addProperty","flag","multipleArgMethod","name","key","validTypes","addChainableMethod","desiredValues","Array","prototype","slice","call","arguments","isArray","_obj","forEach","desiredValue","obj","constuctor","assert","indexOf","found","some","Action","Entity","Field","Link","singleArgMethod","arrayProperty","subjectType","to","be","an","objectProperty"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;AAEe,kBAASA,IAAT,EAAeC,KAAf,EAAsB;AACpC,MAAMC,SAAS,GAAGF,IAAI,CAACE,SAAvB,CADoC,CAGpC;;AACAA,EAAAA,SAAS,CAACC,WAAV,CAAsB,KAAtB;AAA6B;AAAY,cAAW;AACnDF,IAAAA,KAAK,CAACG,IAAN,CAAW,IAAX,EAAiB,KAAjB,EAAwB,IAAxB;AACA,GAFD,EAJoC,CAQpC;;AACA,WAASC,iBAAT,CAA2BC,IAA3B,EAAiCC,GAAjC,EAAsCC,UAAtC,EAAkD;AACjDN,IAAAA,SAAS,CAACO,kBAAV,CAA6BH,IAA7B;AAAmC;AAAY,gBAAW;AAAA;;AACzD,UAAMI,aAAa,GAAGC,KAAK,CAACC,SAAN,CAAgBC,KAAhB,CAAsBC,IAAtB,CAA2BC,SAA3B,CAAtB;;AAEA,UAAIJ,KAAK,CAACK,OAAN,CAAc,KAAKC,IAAnB,CAAJ,EAA8B;AAC7B,YAAIhB,KAAK,CAACG,IAAN,CAAW,IAAX,EAAiB,KAAjB,CAAJ,EAA6B;AAC5BM,UAAAA,aAAa,CAACQ,OAAd,CAAsB,UAAAC,YAAY,EAAI;AACrC,YAAA,KAAI,CAACF,IAAL,CAAUC,OAAV,CAAkB,UAAAE,GAAG,EAAI;AACxB,kBAAIlB,SAAJ,CAAckB,GAAG,CAACC,UAAJ,IAAkBb,UAAhC;;AACA,cAAA,KAAI,CAACc,MAAL,CACCX,KAAK,CAACK,OAAN,CAAcI,GAAG,CAACb,GAAD,CAAjB,KAA2Ba,GAAG,CAACb,GAAD,CAAH,CAASgB,OAAT,CAAiBJ,YAAjB,IAAiC,CAAC,CAD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,SAAhB,EAA2BJ,iBAA3B,CAAb;AACAI,EAAAA,aAAa,CAAC,cAAD,EAAiB,SAAjB,EAA4BJ,iBAA5B,CAAb;AACAI,EAAAA,aAAa,CAAC,aAAD,EAAgB,UAAhB,EAA4BJ,iBAA5B,CAAb;AACAI,EAAAA,aAAa,CAAC,eAAD,EAAkB,UAAlB,EAA8BJ,iBAA9B,CAAb;AACAI,EAAAA,aAAa,CAAC,YAAD,EAAe,QAAf,EAAyBL,kBAAzB,CAAb;AACAK,EAAAA,aAAa,CAAC,aAAD,EAAgB,QAAhB,EAA0BL,kBAA1B,CAAb;AACAK,EAAAA,aAAa,CAAC,WAAD,EAAc,OAAd,EAAuBJ,iBAAvB,CAAb;AACAI,EAAAA,aAAa,CAAC,YAAD,EAAe,OAAf,EAAwBJ,iBAAxB,CAAb,CAjHoC,CAmHpC;AACA;;AACA,WAASS,cAAT,CAAwB9B,IAAxB,EAA8BC,GAA9B,EAAmCyB,WAAnC,EAAgD;AAC/C9B,IAAAA,SAAS,CAACC,WAAV,CAAsBG,IAAtB;AAA4B;AAAY,gBAAW;AAClD,UAAIJ,SAAJ,CAAc,KAAKe,IAAnB,EAAyBgB,EAAzB,CAA4BC,EAA5B,CAA+BC,EAA/B,eAA6CH,WAA7C;AACA,WAAKV,MAAL,CACC,qBAAoB,KAAKL,IAAL,CAAUV,GAAV,CAApB,CADD,EAEC,oCAAoCA,GAFrC,EAGC,wCAAwCA,GAHzC;AAIAN,MAAAA,KAAK,CAACG,IAAN,CAAW,IAAX,EAAiB,QAAjB,EAA2B,KAAKa,IAAL,CAAUV,GAAV,CAA3B;AACA,KAPD;AAQA;;AACD6B,EAAAA,cAAc,CAAC,eAAD,EAAkB,YAAlB,EAAgCT,iBAAhC,CAAd;AACAS,EAAAA,cAAc,CAAC,iBAAD,EAAoB,YAApB,EAAkCT,iBAAlC,CAAd;AACA","sourcesContent":["import Action from './Action';\nimport Entity from './index';\nimport Field from './Field';\nimport Link from './Link';\n\nexport default function(chai, utils) {\n\tconst Assertion = chai.Assertion;\n\n\t// .all.\n\tAssertion.addProperty('all', /* @this */ function() {\n\t\tutils.flag(this, 'all', true);\n\t});\n\n\t// expect(resource).to.have.Xs(x1, x2, ...)\n\tfunction multipleArgMethod(name, key, validTypes) {\n\t\tAssertion.addChainableMethod(name, /* @this */ function() {\n\t\t\tconst desiredValues = Array.prototype.slice.call(arguments);\n\n\t\t\tif (Array.isArray(this._obj)) {\n\t\t\t\tif (utils.flag(this, 'all')) {\n\t\t\t\t\tdesiredValues.forEach(desiredValue => {\n\t\t\t\t\t\tthis._obj.forEach(obj => {\n\t\t\t\t\t\t\tnew Assertion(obj.constuctor in validTypes);\n\t\t\t\t\t\t\tthis.assert(\n\t\t\t\t\t\t\t\tArray.isArray(obj[key]) && obj[key].indexOf(desiredValue) > -1,\n\t\t\t\t\t\t\t\t'expected #{this} to have Siren ' + key + ' #{exp}',\n\t\t\t\t\t\t\t\t'expected #{this} to not have Siren ' + key + ' #{exp}',\n\t\t\t\t\t\t\t\tdesiredValue);\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tdesiredValues.forEach(desiredValue => {\n\t\t\t\t\t\tconst found = this._obj.some(obj => {\n\t\t\t\t\t\t\tnew Assertion(obj.constuctor in validTypes);\n\t\t\t\t\t\t\treturn Array.isArray(obj[key]) && obj[key].indexOf(desiredValue) > -1;\n\t\t\t\t\t\t});\n\t\t\t\t\t\tthis.assert(\n\t\t\t\t\t\t\tfound,\n\t\t\t\t\t\t\t'expected #{this} to have Siren ' + key + ' #{exp}',\n\t\t\t\t\t\t\t'expected #{this} to not have Siren ' + key + ' #{exp}',\n\t\t\t\t\t\t\tdesiredValue);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tnew Assertion(this._obj.constuctor in validTypes);\n\t\t\t\tdesiredValues.forEach(desiredValue => {\n\t\t\t\t\tthis.assert(\n\t\t\t\t\t\tArray.isArray(this._obj[key]) && this._obj[key].indexOf(desiredValue) > -1,\n\t\t\t\t\t\t'expected #{this} to have Siren ' + key + ' #{exp}',\n\t\t\t\t\t\t'expected #{this} to not have Siren ' + key + ' #{exp}',\n\t\t\t\t\t\tdesiredValue);\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}\n\tmultipleArgMethod('classes', 'class', [Action, Entity, Field, Link]);\n\tmultipleArgMethod('rels', 'rel', [Entity, Link]);\n\n\t// expect(resource).to.have.X(x)\n\tfunction singleArgMethod(name, key, validTypes) {\n\t\tAssertion.addChainableMethod(name, /* @this */ function(desiredValue) {\n\t\t\tif (Array.isArray(this._obj)) {\n\t\t\t\tif (utils.flag(this, 'all')) {\n\t\t\t\t\tthis._obj.forEach(obj => {\n\t\t\t\t\t\tnew Assertion(obj.constuctor in validTypes);\n\t\t\t\t\t\tthis.assert(\n\t\t\t\t\t\t\tobj[key] === desiredValue,\n\t\t\t\t\t\t\t'expected #{this} to have Siren ' + key + ' #{exp}',\n\t\t\t\t\t\t\t'expected #{this} to not have Siren ' + key + ' #{exp}',\n\t\t\t\t\t\t\tdesiredValue);\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tconst found = this._obj.some(obj => {\n\t\t\t\t\t\tnew Assertion(obj.constuctor in validTypes);\n\t\t\t\t\t\treturn desiredValue === obj[key];\n\t\t\t\t\t});\n\t\t\t\t\tthis.assert(\n\t\t\t\t\t\tfound,\n\t\t\t\t\t\t'expected #{this} to have Siren ' + key + ' #{exp}',\n\t\t\t\t\t\t'expected #{this} to not have Siren ' + key + ' #{exp}',\n\t\t\t\t\t\tdesiredValue);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tnew Assertion(this._obj.constuctor in validTypes);\n\t\t\t\tthis.assert(\n\t\t\t\t\tdesiredValue === this._obj[key],\n\t\t\t\t\t'expected #{this} to have Siren ' + key + ' #{exp}',\n\t\t\t\t\t'expected #{this} to not have Siren ' + key + ' #{exp}',\n\t\t\t\t\tdesiredValue);\n\t\t\t}\n\t\t});\n\t}\n\tsingleArgMethod('href', 'href', [Action, Link]);\n\tsingleArgMethod('name', 'name', [Action, Field]);\n\tsingleArgMethod('method', 'method', [Action]);\n\tsingleArgMethod('title', 'title', [Action, Entity, Field, Link]);\n\tsingleArgMethod('type', 'type', [Action, Field, Link]);\n\tsingleArgMethod('value', 'value', [Field]);\n\n\t// expect(resource).to.have.X, where X is an Array\n\t// changes the subject of the assertion to be X\n\tfunction arrayProperty(name, key, subjectType) {\n\t\tAssertion.addProperty(name, /* @this */ function() {\n\t\t\tnew Assertion(this._obj).to.be.an.instanceof(subjectType);\n\t\t\tthis.assert(\n\t\t\t\tArray.isArray(this._obj[key]),\n\t\t\t\t'expected #{this} to have Siren ' + key,\n\t\t\t\t'expected #{this} to not have Siren ' + key);\n\t\t\tutils.flag(this, 'object', this._obj[key]);\n\t\t});\n\t}\n\tarrayProperty('sirenAction', 'actions', Entity);\n\tarrayProperty('sirenActions', 'actions', Entity);\n\tarrayProperty('sirenEntity', 'entities', Entity);\n\tarrayProperty('sirenEntities', 'entities', Entity);\n\tarrayProperty('sirenField', 'fields', Action);\n\tarrayProperty('sirenFields', 'fields', Action);\n\tarrayProperty('sirenLink', 'links', Entity);\n\tarrayProperty('sirenLinks', 'links', Entity);\n\n\t// expect(resource).to.have.X, where X is an object\n\t// changes the subject of the assertion to be X\n\tfunction objectProperty(name, key, subjectType) {\n\t\tAssertion.addProperty(name, /* @this */ function() {\n\t\t\tnew Assertion(this._obj).to.be.an.instanceof(subjectType);\n\t\t\tthis.assert(\n\t\t\t\t'object' === typeof this._obj[key],\n\t\t\t\t'expected #{this} to have Siren ' + key,\n\t\t\t\t'expected #{this} to not have Siren ' + key);\n\t\t\tutils.flag(this, 'object', this._obj[key]);\n\t\t});\n\t}\n\tobjectProperty('sirenProperty', 'properties', Entity);\n\tobjectProperty('sirenProperties', 'properties', Entity);\n}\n"],"file":"chaiPlugin.js"}
1
+ {"version":3,"file":"chaiPlugin.js","names":["_Action","_interopRequireDefault","require","_index","_Field","_Link","obj","__esModule","_typeof","Symbol","iterator","constructor","prototype","_default","chai","utils","Assertion","addProperty","flag","multipleArgMethod","name","key","validTypes","addChainableMethod","_this","desiredValues","Array","slice","call","arguments","isArray","_obj","forEach","desiredValue","constuctor","assert","indexOf","found","some","Action","Entity","Field","Link","singleArgMethod","_this2","arrayProperty","subjectType","to","be","an","objectProperty"],"sources":["../src/chaiPlugin.js"],"sourcesContent":["import Action from './Action';\nimport Entity from './index';\nimport Field from './Field';\nimport Link from './Link';\n\nexport default function(chai, utils) {\n\tconst Assertion = chai.Assertion;\n\n\t// .all.\n\tAssertion.addProperty('all', /* @this */ function() {\n\t\tutils.flag(this, 'all', true);\n\t});\n\n\t// expect(resource).to.have.Xs(x1, x2, ...)\n\tfunction multipleArgMethod(name, key, validTypes) {\n\t\tAssertion.addChainableMethod(name, /* @this */ function() {\n\t\t\tconst desiredValues = Array.prototype.slice.call(arguments);\n\n\t\t\tif (Array.isArray(this._obj)) {\n\t\t\t\tif (utils.flag(this, 'all')) {\n\t\t\t\t\tdesiredValues.forEach(desiredValue => {\n\t\t\t\t\t\tthis._obj.forEach(obj => {\n\t\t\t\t\t\t\tnew Assertion(obj.constuctor in validTypes);\n\t\t\t\t\t\t\tthis.assert(\n\t\t\t\t\t\t\t\tArray.isArray(obj[key]) && obj[key].indexOf(desiredValue) > -1,\n\t\t\t\t\t\t\t\t'expected #{this} to have Siren ' + key + ' #{exp}',\n\t\t\t\t\t\t\t\t'expected #{this} to not have Siren ' + key + ' #{exp}',\n\t\t\t\t\t\t\t\tdesiredValue);\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tdesiredValues.forEach(desiredValue => {\n\t\t\t\t\t\tconst found = this._obj.some(obj => {\n\t\t\t\t\t\t\tnew Assertion(obj.constuctor in validTypes);\n\t\t\t\t\t\t\treturn Array.isArray(obj[key]) && obj[key].indexOf(desiredValue) > -1;\n\t\t\t\t\t\t});\n\t\t\t\t\t\tthis.assert(\n\t\t\t\t\t\t\tfound,\n\t\t\t\t\t\t\t'expected #{this} to have Siren ' + key + ' #{exp}',\n\t\t\t\t\t\t\t'expected #{this} to not have Siren ' + key + ' #{exp}',\n\t\t\t\t\t\t\tdesiredValue);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tnew Assertion(this._obj.constuctor in validTypes);\n\t\t\t\tdesiredValues.forEach(desiredValue => {\n\t\t\t\t\tthis.assert(\n\t\t\t\t\t\tArray.isArray(this._obj[key]) && this._obj[key].indexOf(desiredValue) > -1,\n\t\t\t\t\t\t'expected #{this} to have Siren ' + key + ' #{exp}',\n\t\t\t\t\t\t'expected #{this} to not have Siren ' + key + ' #{exp}',\n\t\t\t\t\t\tdesiredValue);\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}\n\tmultipleArgMethod('classes', 'class', [Action, Entity, Field, Link]);\n\tmultipleArgMethod('rels', 'rel', [Entity, Link]);\n\n\t// expect(resource).to.have.X(x)\n\tfunction singleArgMethod(name, key, validTypes) {\n\t\tAssertion.addChainableMethod(name, /* @this */ function(desiredValue) {\n\t\t\tif (Array.isArray(this._obj)) {\n\t\t\t\tif (utils.flag(this, 'all')) {\n\t\t\t\t\tthis._obj.forEach(obj => {\n\t\t\t\t\t\tnew Assertion(obj.constuctor in validTypes);\n\t\t\t\t\t\tthis.assert(\n\t\t\t\t\t\t\tobj[key] === desiredValue,\n\t\t\t\t\t\t\t'expected #{this} to have Siren ' + key + ' #{exp}',\n\t\t\t\t\t\t\t'expected #{this} to not have Siren ' + key + ' #{exp}',\n\t\t\t\t\t\t\tdesiredValue);\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tconst found = this._obj.some(obj => {\n\t\t\t\t\t\tnew Assertion(obj.constuctor in validTypes);\n\t\t\t\t\t\treturn desiredValue === obj[key];\n\t\t\t\t\t});\n\t\t\t\t\tthis.assert(\n\t\t\t\t\t\tfound,\n\t\t\t\t\t\t'expected #{this} to have Siren ' + key + ' #{exp}',\n\t\t\t\t\t\t'expected #{this} to not have Siren ' + key + ' #{exp}',\n\t\t\t\t\t\tdesiredValue);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tnew Assertion(this._obj.constuctor in validTypes);\n\t\t\t\tthis.assert(\n\t\t\t\t\tdesiredValue === this._obj[key],\n\t\t\t\t\t'expected #{this} to have Siren ' + key + ' #{exp}',\n\t\t\t\t\t'expected #{this} to not have Siren ' + key + ' #{exp}',\n\t\t\t\t\tdesiredValue);\n\t\t\t}\n\t\t});\n\t}\n\tsingleArgMethod('href', 'href', [Action, Link]);\n\tsingleArgMethod('name', 'name', [Action, Field]);\n\tsingleArgMethod('method', 'method', [Action]);\n\tsingleArgMethod('title', 'title', [Action, Entity, Field, Link]);\n\tsingleArgMethod('type', 'type', [Action, Field, Link]);\n\tsingleArgMethod('value', 'value', [Field]);\n\n\t// expect(resource).to.have.X, where X is an Array\n\t// changes the subject of the assertion to be X\n\tfunction arrayProperty(name, key, subjectType) {\n\t\tAssertion.addProperty(name, /* @this */ function() {\n\t\t\tnew Assertion(this._obj).to.be.an.instanceof(subjectType);\n\t\t\tthis.assert(\n\t\t\t\tArray.isArray(this._obj[key]),\n\t\t\t\t'expected #{this} to have Siren ' + key,\n\t\t\t\t'expected #{this} to not have Siren ' + key);\n\t\t\tutils.flag(this, 'object', this._obj[key]);\n\t\t});\n\t}\n\tarrayProperty('sirenAction', 'actions', Entity);\n\tarrayProperty('sirenActions', 'actions', Entity);\n\tarrayProperty('sirenEntity', 'entities', Entity);\n\tarrayProperty('sirenEntities', 'entities', Entity);\n\tarrayProperty('sirenField', 'fields', Action);\n\tarrayProperty('sirenFields', 'fields', Action);\n\tarrayProperty('sirenLink', 'links', Entity);\n\tarrayProperty('sirenLinks', 'links', Entity);\n\n\t// expect(resource).to.have.X, where X is an object\n\t// changes the subject of the assertion to be X\n\tfunction objectProperty(name, key, subjectType) {\n\t\tAssertion.addProperty(name, /* @this */ function() {\n\t\t\tnew Assertion(this._obj).to.be.an.instanceof(subjectType);\n\t\t\tthis.assert(\n\t\t\t\t'object' === typeof this._obj[key],\n\t\t\t\t'expected #{this} to have Siren ' + key,\n\t\t\t\t'expected #{this} to not have Siren ' + key);\n\t\t\tutils.flag(this, 'object', this._obj[key]);\n\t\t});\n\t}\n\tobjectProperty('sirenProperty', 'properties', Entity);\n\tobjectProperty('sirenProperties', 'properties', Entity);\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,MAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,KAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAA0B,SAAAD,uBAAAK,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,gBAAAA,GAAA;AAAA,SAAAE,QAAAF,GAAA,0CAAAG,MAAA,0BAAAA,MAAA,CAAAC,QAAA,iBAAAF,OAAA,YAAAA,QAAAF,GAAA,kBAAAA,GAAA,cAAAE,OAAA,YAAAA,QAAAF,GAAA,WAAAA,GAAA,WAAAG,MAAA,mBAAAH,GAAA,CAAAK,WAAA,KAAAF,MAAA,IAAAH,GAAA,KAAAG,MAAA,CAAAG,SAAA,qBAAAN,GAAA,cAAAE,OAAA,CAAAF,GAAA;AAEX,SAAAO,SAASC,IAAI,EAAEC,KAAK,EAAE;EACpC,IAAMC,SAAS,GAAGF,IAAI,CAACE,SAAS;;EAEhC;EACAA,SAAS,CAACC,WAAW,CAAC,KAAK,EAAE,WAAY,YAAW;IACnDF,KAAK,CAACG,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC;EAC9B,CAAC,CAAC;;EAEF;EACA,SAASC,iBAAiBA,CAACC,IAAI,EAAEC,GAAG,EAAEC,UAAU,EAAE;IACjDN,SAAS,CAACO,kBAAkB,CAACH,IAAI,EAA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