Package Exports
- auto-parse
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (auto-parse) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Auto Parse
Installation
npm install auto-parse --save
Why Auto Parse
Auto parse was built to solve the simple use cause of auto parsing data. I know there are lots of ways to parse out there and the reason you would use this one over any other one is if you cant control what users are sending you. Sometimes you need to know what they ment even if they capitalize, put in extra spaces or everything came as a string in a object.
How to use Auto Parse
// Lodash Mixin
var autoParse = require('auto-parse')
_.mixin({'autoParse':autoParse})
// Require, Delcare & Call
var autoParse = require('auto-parse')
console.log(autoParse('Green Pioneer')) // Parses as a String
Check the Usage examples out below
What is Auto Parse
auto-parse
any value you happen to send in (String
, Number
, Boolean
,
Array
, Object
, Function
, undefined
and null
). You send it we will
try to find a way to parse it.
Usage
var autoParse = require('auto-parse')
autoParse('Green Pioneer') // Parses as a String
autoParse('26')// Parses as a Number
autoParse('TrUe ')// Parses as a Boolean
autoParse(['80', '92', '23', 'TruE', false]) // Parses as a Array
autoParse({
name: 'jason', // Parses as a String
age: '50',// Parses as a Number
admin: 'true',// Parses as a Boolean
grade: ['80', '90', '100']// Parses as a Array full of Numbers
}) // Parses as a Object
autoParse(function () {
return '9'
})// Parses as a Number
autoParse(' Undefined ')// Parses as a undefined
autoParse(' Null ')// Parses as a null
autoParse('{}') // Parses as a json
autoParse('["42"]') // Parses as a json
autoParse('NaN') // Parses as a NaN
License
The MIT License (MIT)
Copyright (c) 2014-2017 Green Pioneer
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.
Created by