Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. validate-npm-package-license
  2. ============================
  3. Give me a string and I'll tell you if it's a valid npm package license string.
  4. ```javascript
  5. var valid = require('validate-npm-package-license');
  6. ```
  7. SPDX license identifiers are valid license strings:
  8. ```javascript
  9. var assert = require('assert');
  10. var validSPDXExpression = {
  11. validForNewPackages: true,
  12. validForOldPackages: true,
  13. spdx: true
  14. };
  15. assert.deepEqual(valid('MIT'), validSPDXExpression);
  16. assert.deepEqual(valid('BSD-2-Clause'), validSPDXExpression);
  17. assert.deepEqual(valid('Apache-2.0'), validSPDXExpression);
  18. assert.deepEqual(valid('ISC'), validSPDXExpression);
  19. ```
  20. The function will return a warning and suggestion for nearly-correct license identifiers:
  21. ```javascript
  22. assert.deepEqual(
  23. valid('Apache 2.0'),
  24. {
  25. validForOldPackages: false,
  26. validForNewPackages: false,
  27. warnings: [
  28. 'license should be ' +
  29. 'a valid SPDX license expression (without "LicenseRef"), ' +
  30. '"UNLICENSED", or ' +
  31. '"SEE LICENSE IN <filename>"',
  32. 'license is similar to the valid expression "Apache-2.0"'
  33. ]
  34. }
  35. );
  36. ```
  37. SPDX expressions are valid, too ...
  38. ```javascript
  39. // Simple SPDX license expression for dual licensing
  40. assert.deepEqual(
  41. valid('(GPL-3.0-only OR BSD-2-Clause)'),
  42. validSPDXExpression
  43. );
  44. ```
  45. ... except if they contain `LicenseRef`:
  46. ```javascript
  47. var warningAboutLicenseRef = {
  48. validForOldPackages: false,
  49. validForNewPackages: false,
  50. spdx: true,
  51. warnings: [
  52. 'license should be ' +
  53. 'a valid SPDX license expression (without "LicenseRef"), ' +
  54. '"UNLICENSED", or ' +
  55. '"SEE LICENSE IN <filename>"',
  56. ]
  57. };
  58. assert.deepEqual(
  59. valid('LicenseRef-Made-Up'),
  60. warningAboutLicenseRef
  61. );
  62. assert.deepEqual(
  63. valid('(MIT OR LicenseRef-Made-Up)'),
  64. warningAboutLicenseRef
  65. );
  66. ```
  67. If you can't describe your licensing terms with standardized SPDX identifiers, put the terms in a file in the package and point users there:
  68. ```javascript
  69. assert.deepEqual(
  70. valid('SEE LICENSE IN LICENSE.txt'),
  71. {
  72. validForNewPackages: true,
  73. validForOldPackages: true,
  74. inFile: 'LICENSE.txt'
  75. }
  76. );
  77. assert.deepEqual(
  78. valid('SEE LICENSE IN license.md'),
  79. {
  80. validForNewPackages: true,
  81. validForOldPackages: true,
  82. inFile: 'license.md'
  83. }
  84. );
  85. ```
  86. If there aren't any licensing terms, use `UNLICENSED`:
  87. ```javascript
  88. var unlicensed = {
  89. validForNewPackages: true,
  90. validForOldPackages: true,
  91. unlicensed: true
  92. };
  93. assert.deepEqual(valid('UNLICENSED'), unlicensed);
  94. assert.deepEqual(valid('UNLICENCED'), unlicensed);
  95. ```