pax_global_header 0000666 0000000 0000000 00000000064 12777772605 0014536 g ustar 00root root 0000000 0000000 52 comment=7fd288102ed5cc48c5081b2a8299eae5a5dd3544
symbol-observable-1.0.4/ 0000775 0000000 0000000 00000000000 12777772605 0015167 5 ustar 00root root 0000000 0000000 symbol-observable-1.0.4/.babelrc 0000664 0000000 0000000 00000000043 12777772605 0016557 0 ustar 00root root 0000000 0000000 {
"presets": ["es2015", "es3"]
}
symbol-observable-1.0.4/.editorconfig 0000664 0000000 0000000 00000000223 12777772605 0017641 0 ustar 00root root 0000000 0000000 root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
symbol-observable-1.0.4/.gitattributes 0000664 0000000 0000000 00000000014 12777772605 0020055 0 ustar 00root root 0000000 0000000 * text=auto
symbol-observable-1.0.4/.gitignore 0000664 0000000 0000000 00000000041 12777772605 0017152 0 ustar 00root root 0000000 0000000 node_modules
lib
ts-test/test.js
symbol-observable-1.0.4/.travis.yml 0000664 0000000 0000000 00000000101 12777772605 0017270 0 ustar 00root root 0000000 0000000 language: node_js
node_js:
- '5'
- '4'
- '0.12'
- '0.10'
symbol-observable-1.0.4/CHANGELOG.md 0000664 0000000 0000000 00000007507 12777772605 0017011 0 ustar 00root root 0000000 0000000
## [1.0.4](https://github.com/blesh/symbol-observable/compare/1.0.3...v1.0.4) (2016-10-13)
### Bug Fixes
* **global:** global variable location no longer assumes `module` exists ([4f85ede](https://github.com/blesh/symbol-observable/commit/4f85ede)), closes [#24](https://github.com/blesh/symbol-observable/issues/24)
## [1.0.3](https://github.com/blesh/symbol-observable/compare/1.0.2...v1.0.3) (2016-10-11)
### Bug Fixes
* **mozilla addons support:** fix obtaining global object (#23) ([38da34d](https://github.com/blesh/symbol-observable/commit/38da34d)), closes [#23](https://github.com/blesh/symbol-observable/issues/23)
## [1.0.2](https://github.com/blesh/symbol-observable/compare/1.0.1...v1.0.2) (2016-08-09)
### Bug Fixes
* **ECMAScript 3**: ensure output is ES3 compatible ([3f37af3](https://github.com/blesh/symbol-observable/commit/3f37af3))
## [1.0.1](https://github.com/blesh/symbol-observable/compare/1.0.0...v1.0.1) (2016-06-15)
### Bug Fixes
* **bundlers:** fix issue that caused some bundlers not to be able to locate `/lib` (#19) ([dd8fdfe](https://github.com/blesh/symbol-observable/commit/dd8fdfe)), closes [(#19](https://github.com/(/issues/19) [#17](https://github.com/blesh/symbol-observable/issues/17)
# [1.0.0](https://github.com/blesh/symbol-observable/compare/0.2.4...v1.0.0) (2016-06-13)
### Bug Fixes
* **index.js:** use typeof to check for global or window definitions (#8) ([5f4c2c6](https://github.com/blesh/symbol-observable/commit/5f4c2c6))
* **types:** use default syntax for typedef ([240e3a6](https://github.com/blesh/symbol-observable/commit/240e3a6))
* **TypeScript:** exported ponyfill now works with TypeScript ([c0b894e](https://github.com/blesh/symbol-observable/commit/c0b894e))
### Features
* **es2015:** add es2015 implementation to support rollup (#10) ([7a41de9](https://github.com/blesh/symbol-observable/commit/7a41de9))
### BREAKING CHANGES
* TypeScript: CJS users will now have to `require('symbol-observable').default` rather than just `require('symbol-observable')` this was done to better support ES6 module bundlers.
## [0.2.4](https://github.com/blesh/symbol-observable/compare/0.2.2...v0.2.4) (2016-04-25)
### Bug Fixes
* **IE8 support:** Ensure ES3 support so IE8 is happy ([9aaa7c3](https://github.com/blesh/symbol-observable/commit/9aaa7c3))
* **Symbol.observable:** should NOT equal `Symbol.for('observable')`. ([3b0fdee](https://github.com/blesh/symbol-observable/commit/3b0fdee)), closes [#7](https://github.com/blesh/symbol-observable/issues/7)
## [0.2.3](https://github.com/blesh/symbol-observable/compare/0.2.3...v0.2.3) (2016-04-24)
### Bug Fixes
- **IE8/ECMAScript 3**: Make sure legacy browsers don't choke on a property named `for`. ([9aaa7c](https://github.com/blesh/symbol-observable/9aaa7c))
## [0.2.2](https://github.com/sindresorhus/symbol-observable/compare/0.2.1...v0.2.2) (2016-04-19)
### Features
* **TypeScript:** add TypeScript typings file ([befd7a](https://github.com/sindresorhus/symbol-observable/commit/befd7a))
## [0.2.1](https://github.com/sindresorhus/symbol-observable/compare/0.2.0...v0.2.1) (2016-04-19)
### Bug Fixes
* **publish:** publish all required files ([5f26c3a](https://github.com/sindresorhus/symbol-observable/commit/5f26c3a))
# [0.2.0](https://github.com/sindresorhus/symbol-observable/compare/v0.1.0...v0.2.0) (2016-04-19)
### Bug Fixes
* **Symbol.observable:** ensure Symbol.for(\'observable\') matches Symbol.observable ([ada343f](https://github.com/sindresorhus/symbol-observable/commit/ada343f)), closes [#1](https://github.com/sindresorhus/symbol-observable/issues/1) [#2](https://github.com/sindresorhus/symbol-observable/issues/2)
symbol-observable-1.0.4/es/ 0000775 0000000 0000000 00000000000 12777772605 0015576 5 ustar 00root root 0000000 0000000 symbol-observable-1.0.4/es/index.js 0000664 0000000 0000000 00000000620 12777772605 0017241 0 ustar 00root root 0000000 0000000 /* global window */
import ponyfill from './ponyfill';
var root;
if (typeof self !== 'undefined') {
root = self;
} else if (typeof window !== 'undefined') {
root = window;
} else if (typeof global !== 'undefined') {
root = global;
} else if (typeof module !== 'undefined') {
root = module;
} else {
root = Function('return this')();
}
var result = ponyfill(root);
export default result;
symbol-observable-1.0.4/es/ponyfill.js 0000664 0000000 0000000 00000000515 12777772605 0017771 0 ustar 00root root 0000000 0000000 export default function symbolObservablePonyfill(root) {
var result;
var Symbol = root.Symbol;
if (typeof Symbol === 'function') {
if (Symbol.observable) {
result = Symbol.observable;
} else {
result = Symbol('observable');
Symbol.observable = result;
}
} else {
result = '@@observable';
}
return result;
};
symbol-observable-1.0.4/index.d.ts 0000664 0000000 0000000 00000000111 12777772605 0017061 0 ustar 00root root 0000000 0000000 declare const observableSymbol: symbol;
export default observableSymbol;
symbol-observable-1.0.4/index.js 0000664 0000000 0000000 00000000051 12777772605 0016630 0 ustar 00root root 0000000 0000000 module.exports = require('./lib/index');
symbol-observable-1.0.4/license 0000664 0000000 0000000 00000002210 12777772605 0016527 0 ustar 00root root 0000000 0000000 The MIT License (MIT)
Copyright (c) Sindre Sorhus (sindresorhus.com)
Copyright (c) Ben Lesh
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
symbol-observable-1.0.4/package.json 0000664 0000000 0000000 00000002044 12777772605 0017455 0 ustar 00root root 0000000 0000000 {
"name": "symbol-observable",
"version": "1.0.4",
"description": "Symbol.observable ponyfill",
"license": "MIT",
"repository": "blesh/symbol-observable",
"author": {
"name": "Ben Lesh",
"email": "ben@benlesh.com"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "npm run build && mocha && tsc ./ts-test/test.ts && node ./ts-test/test.js && check-es3-syntax -p lib/ --kill",
"build": "babel es --out-dir lib",
"prepublish": "npm test"
},
"files": [
"index.js",
"ponyfill.js",
"index.d.ts",
"es/index.js",
"es/ponyfill/js",
"lib/index.js",
"lib/ponyfill.js"
],
"jsnext:main": "es/index.js",
"typings": "index.d.ts",
"keywords": [
"symbol",
"observable",
"observables",
"ponyfill",
"polyfill",
"shim"
],
"devDependencies": {
"babel-cli": "^6.9.0",
"babel-preset-es2015": "^6.9.0",
"babel-preset-es3": "^1.0.0",
"chai": "^3.5.0",
"check-es3-syntax-cli": "^0.1.0",
"mocha": "^2.4.5",
"typescript": "^1.8.10"
}
}
symbol-observable-1.0.4/readme.md 0000664 0000000 0000000 00000001347 12777772605 0016753 0 ustar 00root root 0000000 0000000 # symbol-observable [](https://travis-ci.org/blesh/symbol-observable)
> [`Symbol.observable`](https://github.com/zenparsing/es-observable) [ponyfill](https://ponyfill.com)
## Install
```
$ npm install --save symbol-observable
```
## Usage
```js
const symbolObservable = require('symbol-observable');
console.log(symbolObservable);
//=> Symbol(observable)
```
## Related
- [is-observable](https://github.com/sindresorhus/is-observable) - Check if a value is an Observable
- [observable-to-promise](https://github.com/sindresorhus/observable-to-promise) - Convert an Observable to a Promise
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)
symbol-observable-1.0.4/test/ 0000775 0000000 0000000 00000000000 12777772605 0016146 5 ustar 00root root 0000000 0000000 symbol-observable-1.0.4/test/index.js 0000664 0000000 0000000 00000001760 12777772605 0017617 0 ustar 00root root 0000000 0000000 /* global describe, it */
var expect = require('chai').expect;
var $$observable = require('../').default;
describe('integration test', function () {
if (typeof Symbol === 'function') {
describe('when global Symbol exists', function () {
describe('returned value', function () {
it('should be of type "symbol"', function () {
expect($$observable).to.be.a('symbol');
});
});
describe('Symbol.observable', function () {
if (typeof Symbol.for === 'function') {
it('should NOT be the same as Symbol.for("observable")', function () {
expect(Symbol.observable).to.not.equal(Symbol.for('observable'));
});
}
it('should be of type "symbol"', function () {
expect(Symbol.observable).to.be.a('symbol');
});
});
});
} else {
describe('when no global Symbol is present', function () {
it('should be "@@observable"', function () {
expect($$observable).to.be.a('string');
expect($$observable).to.equal('@@observable');
});
});
}
});
symbol-observable-1.0.4/test/ponyfill.js 0000664 0000000 0000000 00000002401 12777772605 0020335 0 ustar 00root root 0000000 0000000 /* global describe, it */
var expect = require('chai').expect;
var ponyfill = require('../lib/ponyfill').default;
describe('ponyfill unit tests', function () {
describe('when Symbol does NOT exist as a function', function () {
it('should return "@@observable"', function () {
expect(ponyfill({})).to.equal('@@observable');
});
});
describe('when Symbol exists as a function', function () {
describe('and Symbol.observable exists', function () {
it('should return Symbol.observable', function () {
var Symbol = function () {};
Symbol.observable = 'I came from Symbol.observable';
var root = { Symbol: Symbol };
var result = ponyfill(root);
expect(result).to.equal(Symbol.observable);
});
});
describe('and Symbol.observable does NOT exist', function () {
it('should use Symbol(), polyfill Symbol.observable and return it', function () {
var Symbol = function (description) {
return 'Symbol(' + description + ')';
};
var root = {
Symbol: Symbol
};
var result = ponyfill(root);
expect(Symbol.observable).to.equal('Symbol(observable)');
expect(result).to.equal('Symbol(observable)');
});
});
});
});
symbol-observable-1.0.4/ts-test/ 0000775 0000000 0000000 00000000000 12777772605 0016572 5 ustar 00root root 0000000 0000000 symbol-observable-1.0.4/ts-test/test.ts 0000664 0000000 0000000 00000000466 12777772605 0020127 0 ustar 00root root 0000000 0000000 import $$symbolObservable from '../';
console.log('RUNNING TYPESCRIPT TEST...');
if (typeof $$symbolObservable !== 'symbol' && $$symbolObservable !== '@@observable') {
console.log('FAIL');
throw new Error('Sorry, $symbolObservable is ' + JSON.stringify($$symbolObservable));
}
console.log('PASS');