Simple email application for Android. Original source code: https://framagit.org/dystopia-project/simple-email
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.

119 lines
1.8 KiB

  1. [![Coveralls – test coverage
  2. ](https://img.shields.io/coveralls/studio-b12/is-subset.svg?style=flat-square)
  3. ](https://coveralls.io/r/studio-b12/is-subset)
  4.  [![Travis – build status
  5. ](https://img.shields.io/travis/studio-b12/is-subset/master.svg?style=flat-square)
  6. ](https://travis-ci.org/studio-b12/is-subset)
  7.  [![David – status of dependencies
  8. ](https://img.shields.io/david/studio-b12/is-subset.svg?style=flat-square)
  9. ](https://david-dm.org/studio-b12/is-subset)
  10.  [![Code style: airbnb
  11. ](https://img.shields.io/badge/code%20style-airbnb-blue.svg?style=flat-square)
  12. ](https://github.com/airbnb/javascript)
  13. is-subset
  14. =========
  15. **Check if an object is contained within another one.**
  16. Installation
  17. ------------
  18. ```sh
  19. $ npm install is-subset
  20. ```
  21. Usage
  22. -----
  23. 1) Import the module:
  24. ```js
  25. import isSubset from 'is-subset/module';
  26. // …or:
  27. var isSubset = require('is-subset');
  28. ```
  29. 2) These are true:
  30. ```js
  31. isSubset(
  32. {a: 1, b: 2},
  33. {a: 1}
  34. );
  35. isSubset(
  36. {a: 1, b: {c: 3, d: 4}, e: 5},
  37. {a: 1, b: {c: 3}}
  38. );
  39. isSubset(
  40. {a: 1, bcd: [1, 2, 3]},
  41. {a: 1, bcd: [1, 2]}
  42. );
  43. ```
  44. …and these are false:
  45. ```js
  46. isSubset(
  47. {a: 1},
  48. {a: 2}
  49. );
  50. isSubset(
  51. {a: 1},
  52. {a: 1, b: 2}
  53. );
  54. isSubset(
  55. {a: 1, bcd: [1, 2, 3]},
  56. {a: 1, bcd: [1, 3]}
  57. );
  58. ```
  59. See the [specs][] for more info.
  60. [specs]: ./test.js
  61. API
  62. ===
  63. ### *isSubset*(*superset*, *subset*) ###
  64. Check if an object is contained within another object.
  65. Returns `true` if:
  66. - all enumerable keys of *subset* are also enumerable in *superset*, and
  67. - every value assigned to an enumerable key of *subset* strictly equals the value assigned to the same key of *superset* – or is a subset of it.
  68. **Parameters:**
  69. - `Object` *superset*
  70. - `Object` *subset*
  71. **Return value:**
  72. - `Boolean`
  73. License
  74. -------
  75. [MIT][] © [Studio B12 GmbH][]
  76. [MIT]: ./License.md
  77. [Studio B12 GmbH]: https://github.com/studio-b12