smartlog-destination-devtools/.cache/8a/7a25cfc67ec1cec3072e81f6041872.json

1 line
59 KiB
JSON
Raw Normal View History

2018-11-13 00:32:39 +00:00
{"id":"node_modules/chai-string/chai-string.js","dependencies":[{"name":"/Users/philkunz/gitlab/pushrocks_meta/smartlog-destination-devtools/package.json","includedInParent":true,"mtime":1542067438335},{"name":"/Users/philkunz/gitlab/pushrocks_meta/smartlog-destination-devtools/node_modules/chai-string/package.json","includedInParent":true,"mtime":1542058764034}],"generated":{"js":"var define;\n(function (plugin) {\r\n if (typeof require === \"function\" && typeof exports === \"object\" && typeof module === \"object\") {\r\n // NodeJS\r\n module.exports = plugin;\r\n }\r\n else {\r\n if (typeof define === \"function\" && define.amd) {\r\n // AMD\r\n define(function () {\r\n return plugin;\r\n });\r\n }\r\n else {\r\n // Other environment (usually <script> tag): plug in to global chai instance directly.\r\n chai.use(plugin);\r\n }\r\n }\r\n}(function (chai, utils) {\r\n chai.string = chai.string || {};\r\n\r\n function isString(value) {\r\n return typeof value === 'string';\r\n }\r\n\r\n chai.string.startsWith = function (str, prefix) {\r\n if (!isString(str) || !isString(prefix)) {\r\n return false;\r\n }\r\n return str.indexOf(prefix) === 0;\r\n };\r\n\r\n chai.string.endsWith = function (str, suffix) {\r\n if (!isString(str) || !isString(suffix)) {\r\n return false;\r\n }\r\n return str.indexOf(suffix, str.length - suffix.length) !== -1;\r\n };\r\n\r\n chai.string.equalIgnoreCase = function (str1, str2) {\r\n if (!isString(str1) || !isString(str2)) {\r\n return false;\r\n }\r\n return str1.toLowerCase() === str2.toLowerCase();\r\n };\r\n\r\n chai.string.equalIgnoreSpaces = function (str1, str2) {\r\n if (!isString(str1) || !isString(str2)) {\r\n return false;\r\n }\r\n return str1.replace(/\\s/g, '') === str2.replace(/\\s/g, '');\r\n };\r\n\r\n chai.string.containIgnoreSpaces = function (str1, str2) {\r\n if (!isString(str1) || !isString(str2)) {\r\n return false;\r\n }\r\n return str1.replace(/\\s/g, '').indexOf(str2.replace(/\\s/g, '')) > -1;\r\n };\r\n\r\n chai.string.containIgnoreCase = function (str1, str2) {\r\n if (!isString(str1) || !isString(str2)) {\r\n return false;\r\n }\r\n return str1.toLowerCase().indexOf(str2.toLowerCase()) > -1;\r\n }\r\n\r\n chai.string.singleLine = function (str) {\r\n if (!isString(str)) {\r\n return false;\r\n }\r\n return str.trim().indexOf(\"\\n\") === -1;\r\n };\r\n\r\n chai.string.reverseOf = function (str, reversed) {\r\n if (!isString(str) || !isString(reversed)) {\r\n return false;\r\n }\r\n return str.split('').reverse().join('') === reversed;\r\n };\r\n\r\n chai.string.palindrome = function (str) {\r\n if (!isString(str)) {\r\n return false;\r\n }\r\n var len = str.length;\r\n for (var i = 0; i < Math.floor(len / 2); i++) {\r\n if (str[i] !== str[len - 1 - i]) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n\r\n chai.string.entriesCount = function (str, substr, count) {\r\n var matches = 0;\r\n if (isString(str) && isString(substr)) {\r\n var i = 0;\r\n var len = str.length;\r\n while (i < len) {\r\n var indx = str.indexOf(substr, i);\r\n if (indx === -1) {\r\n break;\r\n }\r\n else {\r\n matches++;\r\n i = indx + 1;\r\n }\r\n }\r\n }\r\n return matches === count;\r\n };\r\n\r\n chai.string.indexOf = function (str, substr, index) {\r\n var indx = !isString(str) || !isString(substr) ? -1 : str.indexOf(substr);\r\n return indx === index;\r\n };\r\n\r\n var startsWithMethodWrapper = function (expected) {\r\n var actual = this._obj;\r\n\r\n return this.assert(\r\n chai.string.startsWith(actual, expected),\r\n 'expected ' + this._obj + ' to start with ' + expected,\r\n 'expected ' + this._obj + ' not to start with ' + expected\r\n );\r\n };\r\n\r\n chai.Assertion.addChainableMethod('startsWith', startsWithMethod