pax_global_header00006660000000000000000000000064127777726050014536gustar00rootroot0000000000000052 comment=7fd288102ed5cc48c5081b2a8299eae5a5dd3544 symbol-observable-1.0.4/000077500000000000000000000000001277777260500151675ustar00rootroot00000000000000symbol-observable-1.0.4/.babelrc000066400000000000000000000000431277777260500165570ustar00rootroot00000000000000{ "presets": ["es2015", "es3"] } symbol-observable-1.0.4/.editorconfig000066400000000000000000000002231277777260500176410ustar00rootroot00000000000000root = 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/.gitattributes000066400000000000000000000000141277777260500200550ustar00rootroot00000000000000* text=auto symbol-observable-1.0.4/.gitignore000066400000000000000000000000411277777260500171520ustar00rootroot00000000000000node_modules lib ts-test/test.js symbol-observable-1.0.4/.travis.yml000066400000000000000000000001011277777260500172700ustar00rootroot00000000000000language: node_js node_js: - '5' - '4' - '0.12' - '0.10' symbol-observable-1.0.4/CHANGELOG.md000066400000000000000000000075071277777260500170110ustar00rootroot00000000000000 ## [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/000077500000000000000000000000001277777260500155765ustar00rootroot00000000000000symbol-observable-1.0.4/es/index.js000066400000000000000000000006201277777260500172410ustar00rootroot00000000000000/* 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.js000066400000000000000000000005151277777260500177710ustar00rootroot00000000000000export 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.ts000066400000000000000000000001111277777260500170610ustar00rootroot00000000000000declare const observableSymbol: symbol; export default observableSymbol; symbol-observable-1.0.4/index.js000066400000000000000000000000511277777260500166300ustar00rootroot00000000000000module.exports = require('./lib/index'); symbol-observable-1.0.4/license000066400000000000000000000022101277777260500165270ustar00rootroot00000000000000The 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.json000066400000000000000000000020441277777260500174550ustar00rootroot00000000000000{ "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.md000066400000000000000000000013471277777260500167530ustar00rootroot00000000000000# symbol-observable [![Build Status](https://travis-ci.org/blesh/symbol-observable.svg?branch=master)](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/000077500000000000000000000000001277777260500161465ustar00rootroot00000000000000symbol-observable-1.0.4/test/index.js000066400000000000000000000017601277777260500176170ustar00rootroot00000000000000/* 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.js000066400000000000000000000024011277777260500203350ustar00rootroot00000000000000/* 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/000077500000000000000000000000001277777260500165725ustar00rootroot00000000000000symbol-observable-1.0.4/ts-test/test.ts000066400000000000000000000004661277777260500201270ustar00rootroot00000000000000import $$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');