{"id":16442384,"url":"https://github.com/doug-martin/is-extended","last_synced_at":"2025-10-25T02:44:41.695Z","repository":{"id":6415742,"uuid":"7654114","full_name":"doug-martin/is-extended","owner":"doug-martin","description":"is-extended is a Javascript library for type detection that can be used standalone or incorporated into extended","archived":false,"fork":false,"pushed_at":"2013-06-06T21:31:51.000Z","size":254,"stargazers_count":3,"open_issues_count":6,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-18T19:18:50.081Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/doug-martin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-01-16T21:17:49.000Z","updated_at":"2015-05-02T23:30:13.000Z","dependencies_parsed_at":"2022-09-06T01:20:13.106Z","dependency_job_id":null,"html_url":"https://github.com/doug-martin/is-extended","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doug-martin%2Fis-extended","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doug-martin%2Fis-extended/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doug-martin%2Fis-extended/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doug-martin%2Fis-extended/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/doug-martin","download_url":"https://codeload.github.com/doug-martin/is-extended/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245078067,"owners_count":20557274,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T09:17:14.878Z","updated_at":"2025-10-25T02:44:41.604Z","avatar_url":"https://github.com/doug-martin.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/doug-martin/is-extended.png?branch=master)](undefined)\n\n[![browser support](https://ci.testling.com/doug-martin/is-extended.png)](http://ci.testling.com/doug-martin/is-extended)\n\n# is-extended\n\n`is-extended` is a Javascript library that can be used standalone or incorporated into [`extended`](https://github.com/doug-martin/extended)\n\n```javascript\nvar is = require(\"is-extended\");\n```\n\nOr\n\n```javascript\nvar myextended = require(\"extended\")\n\t.register(require(\"is-extended\"));\n```\n\n## Installation\n\n```\nnpm install is-extended\n```\n\nOr [download the source](https://raw.github.com/doug-martin/is-extended/master/index.js) ([minified](https://raw.github.com/doug-martin/is-extended/master/is-extended.min.js))\n\n## Usage\n\n`is-extended` includes the following type coercion methods.\n\n* `isFunction` : Test if something is a function\n* `isObject` : Test if something is an object.\n* `isEmpty` : Test if something is empty.\n* `isHash` : Test if something is a hash.\n\n```javascript\nis.isHash({}); //true\nis.isHash(new Number(1)); //false\n\nis.isObject({}); //true\nis.isObject(new Number(1)); //true\n```\n\n* `isNumber` : Test if something is a number.\n* `isString` : Test if something is a string.\n* `isDate` : Test if something is a `Date`.\n* `isArray` : Test if something is an `Object`\n* `isBoolean` : Test if something is a boolean value.\n* `isUndefined` : Test if something is strictly equal to `undefined`.\n* `isDefined` : Test if something is strictly not equal to `undefined`.\n* `isUndefinedOrNull` : Test if something is strictly equal to `null` or `undefined`.\n* `isNull` : Test if something is strictly equal to `null`.\n* `isArguments` : Test if something is an `Object`\n* `instanceOf` : Test if something is an `Object`\n* `isRegExp` : Test if something is a `RegExp`\n* `isTrue` : Test if something is strictly equal to `true`\n* `isFalse` : Test if something is strictly equal to `false`\n* `isNotNull` : Test if something is strictly not equal to `null`.\n\n**`deepEqual`**\n\nTests if two object are deep equal.\n\n```javascript\n\nis.deepEqual([1,2,3], [1,2,3]); //true\nis([1,2,3]).deepEqual([1,2,3]); //true\n\n\nis.deepEqual({ a: { b: \"c\"}}, {a : false}); //false\nis({ a: { b: \"c\"}}).deepEqual({ a: { b: \"c\"}}); //true\n\n```\n\n\n**`isEq`**\n\nTest if two objects are `==`\n\n**`isNeq`**\n\nTest if two objects are `!=`\n\n**`isSeq`**\n\nTest if two objects are `===`\n\n**`isSneq`**\n\nTest if two objects are `!==`\n\n**`isIn`**\n\nTest if an object is in a array.\n\n```javascript\nis.isIn('a', ['a', 'b', 'c']); //true\n\nis('a').isIn(['a', 'b', 'c']); //true\n```\n\n**`isNotIn`**\n\nTest if something is not in an array.\n\n```javascript\nis.isIn('d', ['a', 'b', 'c']); //true\n\nis('d').isIn(['a', 'b', 'c']); //true\n```\n\n**`isLt`**\n\nCheck if a value is `\u003c` a given value.\n\n```javascript\nis.isLt(1, 2); //true\nis(\"a\").isLt(\"b\"); //true\n```\n\n**`isLte`**\n\nCheck if a value is `\u003c=` a given value.\n\n```javascript\nis.isLte(2, 2); //true\nis(\"a\").isLte(\"b\"); //true\n```\n\n**`isGt`**\n\nCheck if a value is `\u003e` a given value.\n\n```javascript\nis.isGt(2, 1); //true\nis(\"b\").isGt(\"a\"); //true\n```\n\n**`isGte`**\n\nCheck if a value is `\u003e=` a given value.\n\n```javascript\nis.isGte(2, 2); //true\nis(\"b\").isLt(\"a\"); //true\n```\n\n**`isLike`**\n\nCheck if a value is like a given regexp.\n\n```javascript\nis.isLike(\"a\", /a/); //true\nis.isLike(\"a\", \"a\"); //true\nis(1).isLike(/\\d/); //true\nis.isLike(1, \"\\\\d\"); //true\n```\n\n**`isNotLike`**\n\nCheck if a value is not like a given regexp.\n\n```javascript\nis.isNotLike(\"a\", /\\d/); //true\nis(\"a\").isNotLike(\"b\"); //true\n```\n\n**`contains`**\n\nChecks if an array contains a given value.\n\n```javascript\nis.contains([1,2,3], 2); //true\nis([1,2,3]).contains(2); //true\n```\n\n**`notContains`**\n\nChecks if an array does not contain a given value.\n\n```javascript\nis.notContains([1,2,3], 2); //true\nis([1,2,3]).notContains(2); //true\n```\n\n**`containsAt`**\n\nChecks if an array contains a given value at the specified index\n\n```javascript\nis.contains([1,2,3], 2, 1); //true\nis([1,2,3]).containsAt(2, 1); //true\n```\n\n**`notContainsAt`**\n\nChecks if an array does not contain a given value at the specified index\n\n```javascript\nis.notContains([1,2,3], 2, 0); //true\nis([1,2,3]).notContains(2, 0); //true\n```\n\n**`has`**\n\nChecks if a value has the specified property.\n\n```javascript\nis.has([1,2,3], \"length\"); //true\nis.has({a: \"a\"}, \"a\"); //true\nis([1,2,3]).has(\"length\"); //true\nis({a: \"a\"}).has(\"a\"); //true\n```\n\n**`notHas`**\n\nChecks if an array does not contain a given value.\n\n```javascript\nis.notHas([1,2,3], \"someProperty\"); //true\nis.notHas({a: \"a\"}, \"b\"); //true\nis([1,2,3]).notHas(\"someProperty\"); //true\nis({a: \"a\"}).notHas(\"b\"); //true\n```\n\n**`isLength`**\n\nChecks if a value has the specified length;\n\n```javascript\nis.isLength([1,2,3], 3); //true\nis.isLength(\"abc\", 3); //true\nis.isLength(function(a, b, c){}, 3); //true\n\nis([1,2,3]).isLength(3); //true\nis(\"abc\").isLength(3); //true\nis(function(a, b, c){}).isLength(3); //true\n```\n\n**`isNotLength`**\n\nChecks if an value does not have the specified length.\n\n```javascript\nis.isNotLength([1,2,3], 3); //false\nis.isNotLength(\"abc\", 3); //false\nis.isNotLength(function(a, b, c){}, 3); //false\n\nis([1,2,3]).isNotLength(3); //false\nis(\"abc\").isNotLength(3); //false\nis(function(a, b, c){}).isNotLength(3); //false\n```\n\n\n## Creating a custom tester.\n\nTo create a custom type tester you can use the `tester` method.\n\n```javascript\nvar tester = is.tester().isArray().isDate().isBoolean().tester();\ntester([]); //true\ntester(new Array()); //true\ntester(new Date()); //true\ntester(true); //true\ntester(false); //true\ntester(new Boolean()); //true\n\ntester(\"hello\"); //false\ntester(); //false\ntester(new String()); //false\ntester({}); //false\ntester(new Object()); //false\n```\n\n## `switcher`\n\nThe `is-exteded` `switcher` method allows you to create a structure that executes certain code when a value passes a test.\n\n```javascript\nvar mySwitcher = is.switcher()\n    .isLt(0, function (num) {\n        return num + \" is lt 0\";\n    })\n    .isLte(5, function (num) {\n        return num + \" is gte 0 lte 5\";\n    })\n    .isLte(10, function (num) {\n        return num + \" is gt 5 lte 10\";\n    })\n    .isGt(10, function (num) {\n        return num + \" is gt 10\";\n    })\n    .def(function (num) {\n        return num + \" is unknown value\";\n    })\n    .switcher();\n\nfor (var i = -1; i \u003c 12; i++) {\n    console.log(mySwitcher(i));\n}\n```\n\n\nOutputs the following\n\n```\n-1 is lt 0\n0 is gte 0 lte 5\n1 is gte 0 lte 5\n2 is gte 0 lte 5\n3 is gte 0 lte 5\n4 is gte 0 lte 5\n5 is gte 0 lte 5\n6 is gt 5 lte 10\n7 is gt 5 lte 10\n8 is gt 5 lte 10\n9 is gt 5 lte 10\n10 is gt 5 lte 10\n11 is gt 10\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoug-martin%2Fis-extended","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdoug-martin%2Fis-extended","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoug-martin%2Fis-extended/lists"}