validate.d.ts 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /**
  2. * Copyright (C) 2016-2019 Michael Kourlas
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. /**
  17. * Returns true if the specified string only contains characters permitted by
  18. * the XML specification.
  19. */
  20. export declare function validateChar(str: string): boolean;
  21. /**
  22. * Returns a version of the specified string that only contains characters
  23. * permitted by the XML specification, with invalid characters replaced
  24. * by the replacement character U+FFFD.
  25. */
  26. export declare function fixChar(str: string): string;
  27. /**
  28. * Returns true if the specified string only contains a single character, and
  29. * that this character is permitted by the XML specification.
  30. */
  31. export declare function validateSingleChar(str: string): boolean;
  32. /**
  33. * Returns true if the specified string only contains characters permitted by
  34. * the XML specification for names.
  35. */
  36. export declare function validateName(str: string): boolean;
  37. /**
  38. * Returns a version of the specified string that only contains characters
  39. * permitted by the XML specification for names, with invalid characters
  40. * replaced by the replacement character U+FFFD.
  41. */
  42. export declare function fixName(str: string): string;
  43. /**
  44. * Returns true if the specified value is undefined.
  45. */
  46. export declare function isUndefined(val: unknown): val is undefined;