Skip to content

Commit

Permalink
📦 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ungoldman committed Aug 21, 2015
0 parents commit 43e8535
Show file tree
Hide file tree
Showing 9 changed files with 234 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules
11 changes: 11 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
language: node_js
node_js:
- '0.10'
- '0.12'
- 'iojs'
sudo: false
cache:
directories:
- node_modules
script:
- npm test
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# format-spatial-ref change log

All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## 1.0.0 - 2015-08-21
* engage
61 changes: 61 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Contributing Guidelines

Contributions welcome!

**Before spending lots of time on something, ask for feedback on your idea first!**

Please search issues and pull requests before adding something new to avoid duplicating efforts and conversations.

In addition to improving the project by refactoring code and implementing relevant features, this project welcomes the following types of contributions:

- **Ideas**: participate in an issue thread or start your own to have your voice heard.
- **Writing**: contribute your expertise in an area by helping expand the included content.
- **Copy editing**: fix typos, clarify language, and generally improve the quality of the content.
- **Formatting**: help keep content easy to read with consistent formatting.

## Installing

Fork and clone the repo, then `npm install` to install all dependencies.

## Testing

Tests are run with `npm test`. Unless you're creating a failing test to increase test coverage or show a problem, please make sure all tests are passing before submitting a pull request.

## Code Style

[![standard][standard-image]][standard-url]

This repository uses [`standard`][standard-url] to maintain code style and consistency and avoid style arguments. `npm test` runs `standard` so you don't have to!

[standard-image]: https://cdn.rawgit.com/feross/standard/master/badge.svg
[standard-url]: https://github.com/feross/standard
[semistandard-image]: https://cdn.rawgit.com/flet/semistandard/master/badge.svg
[semistandard-url]: https://github.com/Flet/semistandard

---

# Collaborating Guidelines

**This is an OPEN Open Source Project.**

## What?

Individuals making significant and valuable contributions are given commit access to the project to contribute as they see fit. This project is more like an open wiki than a standard guarded open source project.

## Rules

There are a few basic ground rules for collaborators:

1. **No `--force` pushes** or modifying the Git history in any way.
1. **Non-master branches** ought to be used for ongoing work.
1. **External API changes and significant modifications** ought to be subject to an **internal pull request** to solicit feedback from other collaborators.
1. Internal pull requests to solicit feedback are *encouraged* for any other non-trivial contribution but left to the discretion of the contributor.
1. Contributors should attempt to adhere to the prevailing code style.

## Releases

Declaring formal releases remains the prerogative of the project maintainer.

## Changes to this arrangement

This is an experiment and feedback is welcome! This document may also be subject to pull requests or changes by collaborators where you believe you have something valuable to add or change.
13 changes: 13 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright 2015 ESRI

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# format-spatial-ref

> Format WKID spatial reference variations into a standard structure.
[![npm][npm-image]][npm-url]
[![travis][travis-image]][travis-url]

[npm-image]: https://img.shields.io/npm/v/format-spatial-ref.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/format-spatial-ref
[travis-image]: https://img.shields.io/travis/koopjs/format-spatial-ref.svg?style=flat-square
[travis-url]: https://travis-ci.org/koopjs/format-spatial-ref

## Install

```
npm install format-spatial-ref
```

## Usage

```js
var formatSpatialRef = require('format-spatial-ref')

formatSpatialRef({"wkid": 4326})
formatSpatialRef('{"wkid": 4326}')
formatSpatialRef(4326)

// All of the above will return { "wkid": 4326 }
```

## Contributing

Contributions welcome! Please read the [contributing guidelines](CONTRIBUTING.md) first.

## License

[Apache-2.0](LICENSE)
25 changes: 25 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* Format WKID spatial reference variations into a standard structure.
*
* @param {string|number|object} spatialRef - spatial reference variation
* @return {object} standard spatial reference object
*/
function formatSpatialRef (spatialRef) {
if (typeof spatialRef === 'string') {
try {
return JSON.parse(spatialRef)
} catch (e) {
return spatialRef
}
}

if (typeof spatialRef === 'number') {
return {
wkid: spatialRef
}
}

return spatialRef
}

module.exports = formatSpatialRef
33 changes: 33 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "format-spatial-ref",
"description": "Format WKID spatial reference variations into a standard structure.",
"version": "1.0.0",
"author": "Nate Goldman <[email protected]>",
"bugs": {
"url": "https://github.com/koopjs/format-spatial-ref/issues"
},
"devDependencies": {
"standard": "^5.1.0",
"tap-spec": "^4.0.2",
"tape": "^4.0.0"
},
"homepage": "https://github.com/koopjs/format-spatial-ref",
"keywords": [
"arcgis",
"esri",
"format",
"reference",
"spatial",
"well-known",
"wkid"
],
"license": "Apache-2.0",
"main": "index.js",
"repository": {
"type": "git",
"url": "https://github.com/koopjs/format-spatial-ref.git"
},
"scripts": {
"test": "standard && tape test/*.js | tap-spec"
}
}
20 changes: 20 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
var test = require('tape')
var formatSpatialRef = require('../')

test('returns correct wkid from json', function (t) {
var sr = formatSpatialRef({wkid: 4326})
t.equal(sr.wkid, 4326)
t.end()
})

test('returns correct wkid from stringified json', function (t) {
var sr = formatSpatialRef('{"wkid": 4326}')
t.equal(sr.wkid, 4326)
t.end()
})

test('returns correct wkid from numeric value', function (t) {
var sr = formatSpatialRef(4326)
t.equal(sr.wkid, 4326)
t.end()
})

0 comments on commit 43e8535

Please sign in to comment.