From 73b9f38e3d3c0435e639a7e054714d71b6ddae9b Mon Sep 17 00:00:00 2001 From: Arthur Verschaeve Date: Wed, 18 Feb 2015 13:13:52 +0100 Subject: [PATCH] init --- .editorconfig | 15 +++++++++++++++ .gitattributes | 1 + .gitignore | 1 + .jshintrc | 13 +++++++++++++ .travis.yml | 5 +++++ index.js | 5 +++++ license | 21 +++++++++++++++++++++ package.json | 29 +++++++++++++++++++++++++++++ readme.md | 25 +++++++++++++++++++++++++ test/test.js | 10 ++++++++++ 10 files changed, 125 insertions(+) create mode 100644 .editorconfig create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 .jshintrc create mode 100644 .travis.yml create mode 100644 index.js create mode 100644 license create mode 100644 package.json create mode 100644 readme.md create mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..86c8f59 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,15 @@ +root = true + +[*] +indent_style = tab +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[package.json] +indent_style = space +indent_size = 2 + +[*.md] +trim_trailing_whitespace = false diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..176a458 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000..804f8af --- /dev/null +++ b/.jshintrc @@ -0,0 +1,13 @@ +{ + "node": true, + "esnext": true, + "bitwise": true, + "camelcase": true, + "curly": true, + "immed": true, + "newcap": true, + "noarg": true, + "undef": true, + "unused": "vars", + "strict": true +} diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..ea4c8c5 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,5 @@ +sudo: false +language: node_js +node_js: + - 'iojs' + - '0.12' diff --git a/index.js b/index.js new file mode 100644 index 0000000..ef1b106 --- /dev/null +++ b/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = function (o) { + return Object.prototype.toString.call(o) === '[object Map]'; +}; diff --git a/license b/license new file mode 100644 index 0000000..0ae0ee9 --- /dev/null +++ b/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Arthur Verschaeve + +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. diff --git a/package.json b/package.json new file mode 100644 index 0000000..0b43d1e --- /dev/null +++ b/package.json @@ -0,0 +1,29 @@ +{ + "name": "is-map", + "version": "0.0.0", + "description": "Easily check if a givin object is an ES6 Map", + "keywords": [ + "map", + "es6", + "esnext", + "harmony", + "typeof", + "type", + "object" + ], + "license": "MIT", + "author": "Arthur Verschaeve ", + "files": [ + "index.js" + ], + "repository": "arthurvr/is-map", + "scripts": { + "test": "node test/test.js" + }, + "devDependencies": { + "ava": "^0.0.4" + }, + "engines": { + "node": ">=0.12.0" + } +} diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..803aa43 --- /dev/null +++ b/readme.md @@ -0,0 +1,25 @@ +# is-map [![Build Status](https://travis-ci.org/arthurvr/is-map.svg?branch=master)](https://travis-ci.org/arthurvr/is-map) + +> Node module to easily check if an object is an [ES6 `Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) + +## Installation + +``` +$ npm install is-map --save +``` + +## Usage + +```javascript +var isMap = require('is-map'); + +isMap(new Map()); +//=> true + +isMap({}); +//=> false +``` + +## License + +MIT © Arthur Verschaeve diff --git a/test/test.js b/test/test.js new file mode 100644 index 0000000..e381bef --- /dev/null +++ b/test/test.js @@ -0,0 +1,10 @@ +'use strict'; + +var test = require('ava'); +var isMap = require('../'); + +test(function (t) { + t.assert(isMap(new Map())); + t.assert(!isMap(new Set())); + t.assert(!isMap({})); +});