From 29243bea96456e0455f850857e59f140af2ed125 Mon Sep 17 00:00:00 2001 From: Gabe Johnson Date: Thu, 13 Apr 2017 07:33:49 -0500 Subject: [PATCH] types: add Symbol --- index.js | 8 ++++++++ test/index.js | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/index.js b/index.js index f1f3eb4..75911ca 100644 --- a/index.js +++ b/index.js @@ -713,6 +713,11 @@ //. Type comprising every primitive String value. var String_ = NullaryTypeWithUrl('String', typeofEq('string')); + //# Symbol :: Type + //. + //. Type comprising every Symbol value. + var Symbol_ = NullaryTypeWithUrl('Symbol', typeofEq('symbol')); + //# Type :: Type //. //. Type comprising every `Type` value. @@ -779,6 +784,7 @@ //. - RegExp //. - StrMap(Unknown) //. - String + //. - Symbol //. - Undefined var env = [ AnyFunction, @@ -793,6 +799,7 @@ RegExp_, StrMap(Unknown), String_, + Symbol_, Undefined ]; @@ -2447,6 +2454,7 @@ RegexFlags: RegexFlags, StrMap: fromUncheckedUnaryType(StrMap), String: String_, + Symbol: Symbol_, Undefined: Undefined, Unknown: Unknown, ValidDate: ValidDate, diff --git a/test/index.js b/test/index.js index 74464e0..22177fa 100644 --- a/test/index.js +++ b/test/index.js @@ -1432,6 +1432,11 @@ describe('def', function() { eq($.String.url, 'https://github.com/sanctuary-js/sanctuary-def/tree/v' + version + '#String'); }); + it('provides the "Symbol" type', function() { + eq($.Symbol.name, 'Symbol'); + eq($.Symbol.url, 'https://github.com/sanctuary-js/sanctuary-def/tree/v' + version + '#Symbol'); + }); + it('provides the "Undefined" type', function() { eq($.Undefined.name, 'Undefined'); eq($.Undefined.url, 'https://github.com/sanctuary-js/sanctuary-def/tree/v' + version + '#Undefined');