-
Notifications
You must be signed in to change notification settings - Fork 588
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(underscore)!: update to v1.13.6
Update underscore.js to v1.13.6. BREAKING CHANGE: This changes the behaviour for the following underscore functions, please see underscore.js documentation for details. * .template * .keys * .after * .range * .reduce * .reduceRight * .reduceLeft Fixes #110
- Loading branch information
Showing
13 changed files
with
139 additions
and
3,568 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Copyright (c) 2009-2022 Jeremy Ashkenas, Julian Gonggrijp, and DocumentCloud and Investigative Reporters & Editors | ||
|
||
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. |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,9 @@ | ||
# underscore | ||
-- | ||
import "github.com/robertkrimen/otto/underscore" | ||
|
||
Package underscore contains the source for the JavaScript utility-belt library. | ||
[![Reference](https://pkg.go.dev/badge/github.com/robertkrimen/otto/underscore.svg)](https://pkg.go.dev/github.com/robertkrimen/otto/underscore) [![License](https://img.shields.io/badge/MIT-blue.svg)](https://opensource.org/licenses/MIT) | ||
|
||
import ( | ||
_ "github.com/robertkrimen/otto/underscore" | ||
) | ||
// Every Otto runtime will now include underscore | ||
To update the version of underscore run: | ||
|
||
http://underscorejs.org | ||
|
||
https://github.com/documentcloud/underscore | ||
|
||
By importing this package, you'll automatically load underscore every time you | ||
create a new Otto runtime. | ||
|
||
To prevent this behavior, you can do the following: | ||
|
||
import ( | ||
"github.com/robertkrimen/otto/underscore" | ||
) | ||
|
||
func init() { | ||
underscore.Disable() | ||
} | ||
|
||
## Usage | ||
|
||
#### func Disable | ||
|
||
```go | ||
func Disable() | ||
```shell | ||
go generate | ||
``` | ||
Disable underscore runtime inclusion. | ||
|
||
#### func Enable | ||
|
||
```go | ||
func Enable() | ||
``` | ||
Enable underscore runtime inclusion. | ||
|
||
#### func Source | ||
|
||
```go | ||
func Source() string | ||
``` | ||
Source returns the underscore source. | ||
|
||
-- | ||
**godocdown** http://github.com/robertkrimen/godocdown |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
//go:build generate | ||
|
||
package main | ||
|
||
import ( | ||
"context" | ||
"flag" | ||
"fmt" | ||
"io" | ||
"log" | ||
"net/http" | ||
"os" | ||
"time" | ||
) | ||
|
||
var ( | ||
url = flag.String("url", "", "url to read from") | ||
output = flag.String("output", "", "output file to write the result too") | ||
) | ||
|
||
func download(url, output string) (err error) { | ||
ctx, cancel := context.WithTimeout(context.Background(), time.Second*10) | ||
defer cancel() | ||
|
||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil) | ||
if err != nil { | ||
return fmt.Errorf("new request failed: %w", err) | ||
} | ||
|
||
resp, err := http.DefaultClient.Do(req) | ||
if err != nil { | ||
return fmt.Errorf("request failed: %w", err) | ||
} | ||
defer resp.Body.Close() | ||
|
||
var f *os.File | ||
if output != "" { | ||
if f, err = os.Create(output); err != nil { | ||
return fmt.Errorf("create file %q failed: %w", output, err) | ||
} | ||
|
||
defer f.Close() | ||
} else { | ||
f = os.Stdout | ||
} | ||
|
||
if _, err := io.Copy(f, resp.Body); err != nil { | ||
return fmt.Errorf("body save: %w", err) | ||
} | ||
|
||
return nil | ||
} | ||
|
||
func main() { | ||
flag.Parse() | ||
|
||
switch { | ||
case len(*url) == 0: | ||
log.Fatal("missing required --url parameter") | ||
} | ||
|
||
if err := download(*url, *output); err != nil { | ||
log.Fatal(err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package underscore | ||
|
||
//go:generate go run download.go --url https://underscorejs.org/underscore-min.js --output underscore.js | ||
//go:generate go run download.go --url https://raw.githubusercontent.com/jashkenas/underscore/master/LICENSE --output LICENSE.underscorejs |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters