Giter VIP home page Giter VIP logo

valid-identifier's Introduction

Build Status npm version

#Usage

npm install valid-identifier

var validateIdentifier = require('valid-identifier');
validateIdentifier("$dollarSign"); // returns true
validateIdentifier("org.apache.cordova.myapp"); // true

validateIdentifier("private.name"); // false, private is a reserved word
validateIdentifier("org.8bit"); // false, portion starts with a number
validateIdentifier("extra.dot."); // false

#Running the tests

npm test

valid-identifier's People

Contributors

clelland avatar purplecabbage avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

valid-identifier's Issues

Should provide sanitized identifiers based on input

@tony-- has encountered some cases where the identifier is too strict in its lowest common denominator approach. It would be nice if the valid-identifier package could return a valid identifier, which could be used.

More from Tony and team here :

Windows (Identity/Name)
The name is an attribute of the Identity element in the application manifest file.
Must consist of of between 3-50 characters.
The identity/Name must contain only letters, numbers, the “-“, and the “.”.
Cannot end in a period.
The Identity/Name cannot be:
“CON"
"PRN"
"AUX"
"NULL"
“COM1” - “COM9"
“LPT1” - “LPT9"
Link: https://msdn.microsoft.com/en-us/library/windows/apps/dn423277.aspx (window 8.1)
Windows (Application/Id)
This field is updated with the text put into the Identity/Name field by Cordova. These fields have conflicting specifications so I have listed it here. I have hi-lighted the potentially conflicting requirements.
The Application/Id name in the application manifest file.
Must consist of between 1-64 characters
The Application/Id must contain only letters, numbers, and the “.”.
Each section must begin with an ASCII alphabetic character.
The Identity/Name cannot be:
“CON"
"PRN"
"AUX"
"NULL"
“COM1” - “COM9"
“LPT1” - “LPT9"

iOS (Bundle Id)
Is the BundleId of the application plist file.
Is a Uniform Type Identifier (UTI)
Contain at least two sections. Sections are separated by the period character “.”.
The bundle id must only contain letters, numbers, the “_”, “-“, and the “."
Should be organized in the reverse-DNS format.
Cannot end in a period.
Link: https://developer.apple.com/library/prerelease/watchos/documentation/IDEs/Conceptual/AppDistributionGuide/ConfiguringYourApp/ConfiguringYourApp.html#//apple_ref/doc/uid/TP40012582-CH28-SW2

Android (Package Name)
Is a name in the AndroidManifest.xml file.
Must have at least two sections. Sections are separated by the period character “.”.
Each section must have at least one character.
The first character must be lower case.
Each section must not start with a number
Each section must not be a Java keyword
Each section cannot start with the word “java”.
The package name must only contain letters, numbers, the “_”, and the “."
Cannot end in a period.
Android Link: http://developer.android.com/guide/topics/manifest/manifest-element.html#package
Java Link: https://docs.oracle.com/javase/specs/jls/se7/html/jls-6.html#jls-6.1 (java 7)

Decimal a Keyword

Hello,

I am curious why 'decimal' is considered a banned key word I seem to be able to create App id's with it in the identifier for Xcode, Android Studio, VisualStudio and Appcelerator Titanium.

What is blocking here and what can I do to help?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.