Skip to content

Commit

Permalink
Remove goog.string dependency. (#633)
Browse files Browse the repository at this point in the history
  • Loading branch information
gkdn authored Dec 4, 2024
1 parent 9ac6aa5 commit 3c38a67
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
10 changes: 9 additions & 1 deletion closure/compiler/test/goog_es6_interop/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,21 @@
load("//closure/compiler:closure_js_library.bzl", "closure_js_library")
load("//closure/testing:closure_js_test.bzl", "closure_js_test")

closure_js_library(
name = "string",
srcs = [
"string.js",
],
suppress = ["useOfGoogProvide"],
)

closure_js_library(
name = "person",
srcs = [
"person.js",
],
deps = [
"@com_google_javascript_closure_library//closure/goog/string",
":string",
],
)

Expand Down
2 changes: 1 addition & 1 deletion closure/compiler/test/goog_es6_interop/person.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* @fileoverview A person, implementes as ES6 module.
*/

import {capitalize} from 'goog:goog.string';
import {capitalize} from 'goog:person.string';

/**
* Represents a person.
Expand Down
27 changes: 27 additions & 0 deletions closure/compiler/test/goog_es6_interop/string.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright 2024 The Closure Rules Authors. All rights reserved.
//
// 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.

/**
* @fileoverview A goog.provide file for testing interoperability.
*/
goog.provide('person.string');

/**
* @param {string} str String value to capitalize.
* @return {string} String value with first letter in uppercase.
*/
person.string.capitalize = function(str) {
return String(str.charAt(0)).toUpperCase() +
String(str.slice(1)).toLowerCase();
};

0 comments on commit 3c38a67

Please sign in to comment.